This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc does not correctly handle subprocess crash


Caroline, you added a break in a loop in main() in gcc.c.  The effect
of it is that if cc1 crashes, gcc still exits with a status of 0.

Something like this patch fixes it.  This is not a perfect patch, but
it shows where the problem is.

Ian

Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.413
diff -u -r1.413 gcc.c
--- gcc.c	5 Apr 2004 19:22:42 -0000	1.413
+++ gcc.c	6 Apr 2004 17:43:54 -0000
@@ -6394,8 +6394,6 @@
       combine_inputs = false;
       for (i = 0; (int) i < n_infiles; i++)
 	{
-	  int this_file_error = 0;
-	  
 	  input_file_number = i;
 	  set_input (infiles[i].name);
 	  if (infiles[i].incompiler
@@ -6410,7 +6408,8 @@
 		{
 		  error ("%s: %s compiler not installed on this system",
 			 input_filename, &input_file_compiler->spec[1]);
-		  this_file_error = 1;
+		  delete_failure_queue ();
+		  error_count++;
 		}
 	      else
 		{
@@ -6426,17 +6425,13 @@
 
 		  if (value < 0)
 		    {
-		      this_file_error = 1;
+		      delete_failure_queue ();
+		      error_count++;
 		      break;
 		    }
 		}
 	    }
 
-	  if (this_file_error)
-	    {
-	      delete_failure_queue ();
-	      error_count++;
-	    }
 	  clear_failure_queue ();
 	}
       combine_inputs = save_combine_inputs;
@@ -6444,8 +6439,6 @@
 
   for (i = 0; (int) i < n_infiles; i++)
     {
-      int this_file_error = 0;
-
       /* Tell do_spec what to substitute for %i.  */
 
       input_file_number = i;
@@ -6475,7 +6468,8 @@
 	    {
 	      error ("%s: %s compiler not installed on this system",
 		     input_filename, &input_file_compiler->spec[1]);
-	      this_file_error = 1;
+	      delete_failure_queue ();
+	      error_count++;
 	    }
 	  else
 	    {
@@ -6483,7 +6477,8 @@
 	      infiles[i].compiled = true;
 	      if (value < 0)
 		{
-		  this_file_error = 1;
+		  delete_failure_queue ();
+		  error_count++;
 		  break;
 		}
 	    }
@@ -6495,14 +6490,6 @@
       else
 	explicit_link_files[i] = 1;
 
-      /* Clear the delete-on-failure queue, deleting the files in it
-	 if this compilation failed.  */
-
-      if (this_file_error)
-	{
-	  delete_failure_queue ();
-	  error_count++;
-	}
       /* If this compilation succeeded, don't delete those files later.  */
       clear_failure_queue ();
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]