http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47296

--- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-16 
08:29:55 UTC ---
After getting Win7-cygwin build of gcc latest trunk built, I was able to do
some more testing.  I could then reproduce another segfault.  As Janne
suggested and I certainly agree, the following simple patch clears this second
segfault.  It is interesting that the Windows/cygwin execution behaves
differently and the opp->file somewhere is getting touched or not initialized.

Index: unix.c
===================================================================
--- unix.c    (revision 168844)
+++ unix.c    (working copy)
@@ -1085,7 +1085,11 @@
 #endif /* HAVE_MKSTEMP */

   if (fd < 0)
-    free (template);
+    {
+      free (template);
+      opp->file = NULL;
+      opp->file_len = 0;
+    }
   else
     {
       opp->file = template;

I will commit this sometime tomorrow.

Reply via email to