This is the mail archive of the gcc-bugs@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]

C++ ICE, segfault in find_basic_blocks_1


Current CVS g++ crashes when compiling the (legal) source code below.

------------------------------------------------
ppro:~$ g++ -v
Reading specs from /home/petero/gcc/lib/gcc-lib/i686-pc-linux/2.96/specs
gcc version 2.96 20000819 (experimental)
ppro:~$ g++ -O -c bug.C
bug.C: In function `int g (int)':
bug.C:20: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
ppro:~$ cat bug.C
struct A {
    ~A();
};
struct B : public A {
    B(A* a);
};

int f();

int g(int x)
{
    if (x)
        return 0;
    for (;;) {
        B b(0);
        if (f())
            break;
    }
    return 0;
}
------------------------------------------------

Running cc1plus in gdb gives the following backtrace for the crash:

#0  find_basic_blocks_1 (f=0x4012e1a0) at ../../egcs/gcc/flow.c:656
#1  0x822b2ae in find_basic_blocks (f=0x4012e1a0, nregs=57, file=0x0)
    at ../../egcs/gcc/flow.c:475
#2  0x8136e73 in rest_of_compilation (decl=0x4012a200)
    at ../../egcs/gcc/toplev.c:3145
#3  0x80799a1 in finish_function (flags=0) at ../../../egcs/gcc/cp/decl.c:14455
#4  0x8113f82 in expand_body (fn=0x4012a200)
    at ../../../egcs/gcc/cp/semantics.c:2670
#5  0x80d2793 in yyparse () at ../../../egcs/gcc/cp/parse.y:737
#6  0x8135a6d in compile_file (name=0x401222e8 "bug.C")
    at ../../egcs/gcc/toplev.c:2295
#7  0x8139b45 in main (argc=3, argv=0xbffffbf4) at ../../egcs/gcc/toplev.c:4763

In case it matters, I bootstrapped the compiler with
CFLAGS="-g -O2 -Wall -march=pentiumpro -mpentiumpro -fstrict-aliasing"

--
Peter Österlund           Email:    peter.osterlund@mailbox.swipnet.se
Sköndalsvägen 35                    f90-pos@nada.kth.se
S-128 66 Sköndal          Homepage: http://home1.swipnet.se/~w-15919
Sweden                    Phone:    +46 8 942647

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