https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66305
Peter Wu <peter at lekensteyn dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |peter at lekensteyn dot nl --- Comment #6 from Peter Wu <peter at lekensteyn dot nl> --- -frandom-seed=0 did not work for me. It appears that since GCC 8 introduced a bug where zero values resulted in a new random value anyway: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=edabe3d8b479e47a1bb3ed495f2a1d94b0ecbb2d Any of these would trigger that problematic case in get_random_seed: -frandom-seed=0 -frandom-seed=0x0 -frandom-seed=jNCWWJ (non-hexadecimal strings are hashed, see set_random_seed) -frandom-seed=1 does seem to result in a reproducible build with GCC 9.2.0, but only as long as the main source file passed to the compiler is a relative path. The main source path is hashed, so if it was absolute, then the source directory would still become part of the build environment: https://github.com/gcc-mirror/gcc/blob/e98ebda074bf8fc5f630a93085af81f52437d851/gcc/tree.c#L9609-L9626 file = LOCATION_FILE (input_location); len = strlen (file); q = (char *) alloca (9 + 19 + len + 1); memcpy (q, file, len + 1); snprintf (q + len, 9 + 19 + 1, "_%08X_" HOST_WIDE_INT_PRINT_HEX, crc32_string (0, name), get_random_seed (false)); ^^^^^^^^^^^^^^^^^^^^^^ (LOCATION_FILE is unaffected by -ffile-prefix-map, unlike fold_builtin_FILE in gcc/builtins.c for example.)