Bug 45754 - Driver core dump when duplicating -Wall command line option
Summary: Driver core dump when duplicating -Wall command line option
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-23 00:21 UTC by Martin Weitzel
Modified: 2010-12-08 05:57 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-cygwin
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Weitzel 2010-09-23 00:21:32 UTC
The following command line causes the gcc/g++ driver front-end to crash with a core dump (segmentation fault):

gcc -O -O -O -O -O -O -O -O -O -O -O -O -O -O -O -O -O -O -O -O -Wall -Wall hello.cpp

Note: The example is only meant as easy to reproduce failing case. Actually the problem occured in a command line with mixed options that happened to repeat -Wall two times and by accident had the "right" number of other options -D, -I, ... in a qmake-generated Makefile.

The EXACT number of command line options is critical: with more or with lesser options the problem is NOT triggered.

Also the option -Wall may be mixed with the others, as long as it appears exactly two times OR three times. 

For further info complete -v output:

Configured with: /gnu/gcc/releases/respins/4.3.4-3a/gcc4-4.3.4-3/src/gcc-4.3.4/configure --srcdir=/gnu/gcc/releases/respins/4.3.4-3a/gcc4-4.
3.4-3/src/gcc-4.3.4 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --loca
lstatedir=/var --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --datadir=/usr/share --infodir=/usr/share/info --mandir=/
usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --with-slibdir=/usr/bin --libexe
cdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disa
ble-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --disable-symvers --enable-libjava --program-suffix=-4 --enable-l
ibgomp --enable-libssp --enable-libada --enable-threads=posix --with-arch=i686 --with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-
4 CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind --with-ecj-jar=/usr/share/java/ecj.jar
Thread model: posix
gcc version 4.3.4 20090804 (release) 1 (GCC)
Comment 1 Richard Biener 2010-09-23 09:12:45 UTC
I can't reproduce this on x86_64-linux, so it must be target specific.
Comment 2 joseph@codesourcery.com 2010-09-23 15:13:17 UTC
Subject: Re:  Driver core dump when duplicating -Wall
 command line option

Unless this can be reproduced with trunk I'd guess it was fixed by:

2010-06-09  Dave Korn  <dave.korn.cygwin@gmail.com>

        * opts-common.c (prune_options): Ensure replacement argv array
        is correctly terminated by a NULL entry.

Comment 3 Dave Korn 2010-12-08 05:57:07 UTC
(In reply to comment #2)
> Subject: Re:  Driver core dump when duplicating -Wall
>  command line option
> 
> Unless this can be reproduced with trunk I'd guess it was fixed by:
> 
> 2010-06-09  Dave Korn  <dave.korn.cygwin@gmail.com>
> 
>         * opts-common.c (prune_options): Ensure replacement argv array
>         is correctly terminated by a NULL entry.

  Yes, I confirmed that the bug is fixed on head.  Martin, it is also fixed in the cygwin gcc-4.5.0-1 test release.

  BTW, use 'g++', not 'gcc', when compiling C++, or you will run into link errors vs. libstdc!