[PATCH] Fix PR90369

Richard Biener rguenther@suse.de
Tue May 7 08:51:00 GMT 2019


The following fixes duplicate temporary file usage by lto-wrapper
with -save-temps.

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

2019-05-07  Richard Biener  <rguenther@suse.de>

	PR lto/90369
	* lto-wrapper.c (debug_objcopy): Use the original filename
	including archive offset for the filename used for -save-temps.

Index: gcc/lto-wrapper.c
===================================================================
--- gcc/lto-wrapper.c	(revision 270909)
+++ gcc/lto-wrapper.c	(working copy)
@@ -1044,6 +1044,7 @@ debug_objcopy (const char *infile, bool
   int err;
 
   const char *p;
+  const char *orig_infile = infile;
   off_t inoff = 0;
   long loffset;
   int consumed;
@@ -1080,9 +1081,9 @@ debug_objcopy (const char *infile, bool
 
   if (save_temps)
     {
-      outfile = (char *) xmalloc (strlen (infile)
+      outfile = (char *) xmalloc (strlen (orig_infile)
 				  + sizeof (".debug.temp.o") + 1);
-      strcpy (outfile, infile);
+      strcpy (outfile, orig_infile);
       strcat (outfile, ".debug.temp.o");
     }
   else



More information about the Gcc-patches mailing list