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]

[Patch] PR41217 Driver crashes if -o specified without filename


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


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