[Bug c++/11681] New: g++ crashes gracefully on parse error, but fixed in 2.96 redhat

binary1230 at yahoo dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 27 05:36:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11681

           Summary: g++ crashes gracefully on parse error, but fixed in 2.96
                    redhat
           Product: gcc
           Version: 2.95.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: binary1230 at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: -same-
  GCC host triplet: i386-linux
GCC target triplet: -same-

g++ crashes on a syntax error.

I narrowed the problem to the following two lines of code (no headers needed). 
This is the result from the .ii file:

    class c_derived : public c_base () {};
    c_derived::c_derived() {}

Command to compile it:
    g++ t.cpp -ggdb

NOTE! without -ggdb this code just is a syntax error and not a crash.

Naturally, the syntax error is the () after c2, but g++ does this:

t.cpp:1: parse error before `('
t.cpp:2: invalid use of undefined type `class c1'
t.cpp:1: forward declaration of `class c1'
t.cpp: In method `c1::c1()':
t.cpp:2: Internal compiler error:
t.cpp:2: Internal compiler error in `scope_die_for', at dwarf2out.c:7804
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

gcc -v on gcc's that crash on this:
:gcc version 2.95.4 20011002 (Debian prerelease)
:GNU C++ version 2.95.2 20000220 (Debian GNU/Linux) (i386-linux) compiled by GNU
C version 2.95.2 20000220 (Debian GNU/Linux)
:gcc version 2.95.2 20000220 (Debian GNU/Linux)

however, this bug is fixed in:
:gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
:gcc version 3.0.4



More information about the Gcc-bugs mailing list