[Bug driver/41217] New: Driver crashes if -o specified without filename
rmansfield at qnx dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 1 19:22:00 GMT 2009
$ ./xgcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --enable-languages=c
Thread model: posix
gcc version 4.5.0 20090901 (experimental) [trunk revision 151276] (GCC)
$ ./xgcc -B. -o
Segmentation fault
(gdb) bt
#0 0xb7f43613 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1 0x08065b27 in xstrdup (s=0x0) at ../../libiberty/xstrdup.c:33
#2 0x0804f55e in process_command (argc=3, argv=0x9ff62b8)
at ../../gcc/gcc.c:4164
#3 0x0805720f in main (argc=3, argv=0xbfe5d574) at ../../gcc/gcc.c:6823
Introduced by http://gcc.gnu.org/viewcvs?view=revision&revision=145470
Only happens in gcc 4.5.0.
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:
--
Summary: Driver crashes if -o specified without filename
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmansfield at qnx dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41217
More information about the Gcc-bugs
mailing list