Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -366,20 +366,17 @@ if [ -z "$mode" ] || [ "$mode" = ld ]; then
done
fi

# Finish setting up the mode.
# Finish setting up the mode, and check whether -frandom-seed needs to be set.
eval "_set_frandom_seed=\${SPACK_${comp}_HAS_FRANDOM_SEED:-}"
if [ -z "$mode" ]; then
mode=ccld
for arg in "$@"; do
if [ "$arg" = "-E" ]; then
mode=cpp
break
elif [ "$arg" = "-S" ]; then
mode=as
break
elif [ "$arg" = "-c" ]; then
mode=cc
break
fi
case $arg in
-E) mode=cpp ;;
-S) mode=as ;;
-c) mode=cc ;;
-frandom-seed=*) _set_frandom_seed= ;;
esac
done
fi

Expand Down Expand Up @@ -956,6 +953,15 @@ extend args_list libs_list "-l"
full_command_list="$command"
extend full_command_list args_list

if [ -n "$_set_frandom_seed" ]; then
case "$mode" in
cc|ccld)
# Make GCC deterministic by setting the random seed to command line arguments
append full_command_list "-frandom-seed=$input_command"
;;
esac
fi

# prepend the ccache binary if we're using ccache
if [ -n "$SPACK_CCACHE_BINARY" ]; then
case "$lang_flags" in
Expand Down