[llvm-commits] [llvm-gcc-4.2] r55666 - /llvm-gcc-4.2/trunk/driverdriver.c

Bill Wendling isanbard at gmail.com
Tue Sep 2 14:56:15 PDT 2008


Author: void
Date: Tue Sep  2 16:56:15 2008
New Revision: 55666

URL: http://llvm.org/viewvc/llvm-project?rev=55666&view=rev
Log:
Allocate enough space in the driver-driver.

Modified:
    llvm-gcc-4.2/trunk/driverdriver.c

Modified: llvm-gcc-4.2/trunk/driverdriver.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/driverdriver.c?rev=55666&r1=55665&r2=55666&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/driverdriver.c (original)
+++ llvm-gcc-4.2/trunk/driverdriver.c Tue Sep  2 16:56:15 2008
@@ -624,8 +624,8 @@
 
   /* Total number of arguments in separate compiler invocation is :
      total number of original arguments - total no input files + one input
-     file + "-o" + output file .  */
-  new_new_argv = (const char **) malloc ((new_argc - num_infiles + 4) * sizeof (const char *));
+     file + "-o" + output file + arch specific options + NULL .  */
+  new_new_argv = (const char **) malloc ((new_argc - num_infiles + 5) * sizeof (const char *));
   if (!new_new_argv)
     abort ();
 
@@ -711,7 +711,9 @@
 }
 
 /* Replace -arch <blah> options with appropriate "-mcpu=<blah>" OR
-   "-march=<blah>".  INDEX is the index in arches[] table. */
+   "-march=<blah>".  INDEX is the index in arches[] table.  We cannot
+   return more than 1 as do_compile_separately only allocated one
+   extra slot for us.  */
 
 static int
 add_arch_options (int index, const char **current_argv, int arch_index)
@@ -1382,7 +1384,7 @@
       else if (!strcmp (argv[i], "-o"))
 	{
 	  if (i + 1 >= argc)
-	    abort ();
+	    fatal ("argument to '-o' is missing");
 
 	  output_filename = argv[i+1];
 	  i++;





More information about the llvm-commits mailing list