https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101546
Bug ID: 101546 Summary: Sporadic issue during compiling a code with a '--save-temps' option Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: filip.bascarevic at siemens dot com Target Milestone: --- Created attachment 51185 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51185&action=edit Patch file for the --save-temps bug Dear GCC community, We saw one problem in a GCC 11.1.0. We faced sporadic issue during compiling a code with a '--save-temps' option. Generally the gcc.exe creates temporary files containing all include-paths and call internally cc1.exe but in the gcc 10.2.0 these files have random names but in a gcc 11.1.0 names are not random (it is .args.0). So during parallel compilation it can happen that the file can be overwritten. Problematic part of a code is at path "gcc-11.1.0/gcc/gcc.c" Source :Gcc.c /* Create a temporary @file name. */ static char *make_at_file (void) { static int fileno = 0; char filename[20]; const char *base, *ext; if (!save_temps_flag) <- skipped for -save-temps return make_temp_file (""); <- This function generate a random file name base = dumpbase; if (!(base && *base)) base = dumpdir; if (!(base && *base)) base = "a"; sprintf (filename, ".args.%d", fileno++); <- fixed file name ext = filename; if (base == dumpdir && dumpdir_trailing_dash_added) ext++; return concat (base, ext, NULL); } For us we prepared a fix and it seems it works. If you agree with our solution you can also apply this patch in a next versions of the GCC. The patch is in the attachment. With best regards, MSc. Filip Bascarevic Siemens, s.r.o. ADV D EU CZ AE AC 4 Anglicke nabrezi 2434/1 301 00 Plzen, Czech Republic filip.bascare...@siemens.com