This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] PR41217 Driver crashes if -o specified without filename
- From: Ryan Mansfield <rmansfield at qnx dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Sep 2009 15:41:46 -0400
- Subject: [Patch] PR41217 Driver crashes if -o specified without filename
- Reply-to: rmansfield at qnx dot com
This patch fixes a crash if -o is specified without an argument.
2009-09-01 Ryan Mansfield <rmansfield@qnx.com>
PR driver/41217
* gcc.c (process_command): Check that -o argument was specified.
Index: gcc.c
===================================================================
--- gcc.c (revision 151276)
+++ gcc.c (working copy)
@@ -4161,7 +4161,10 @@
argv[i] = convert_filename (argv[i], ! have_c, 0);
#endif
/* Save the output name in case -save-temps=obj was used. */
- save_temps_prefix = xstrdup ((p[1] == 0) ? argv[i + 1] :
argv[i] + 1);
+ if ((p[1] == 0) && argv[i + 1])
+ save_temps_prefix = xstrdup(argv[i + 1]);
+ else
+ save_temps_prefix = xstrdup(argv[i] + 1);
goto normal_switch;
default:
Regards,
Ryan Mansfield