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]
Other format: [Raw text]

Re: c++/7944: gcc 3.2: Internal compiler error in find_reloads_toplev, at reload.c:4462


Hi,

the bug can be reproduced with the following code snippet:

----------------------snip here------------------------
#include<iostream>

struct A
{
    int i;
    static void bar();
    static int quux() { bar(); return 0; }

    A() : i(quux()) {}
    ~A() {}
};

void foo()
{
    short s[4] = { 0, 0, 0, 1 };
    A     a[2] = { A(), A() };

    std::cout << s[0] << s[2];
}
----------------------snip here------------------------

This can be further simplified to:

----------------------snip here------------------------
struct B
{
    B& operator<<(short s)
    {
        int j;
        if (j) return operator<<(s); else return operator<<(s);
    }
};

struct A
{
    int i;
    static void bar();
    static int quux() { bar(); return 0; }

    A() : i(quux()) {}
    ~A() {}
};

void foo()
{
    short s[4] = { 0, 0, 0, 1 };
    A     a[2] = { A(), A() };

    B b;
    b << s[0] << s[2];
}
----------------------snip here------------------------

The code crashes gcc 3.0.x using "g++ -O -c" and gcc 3.1, gcc 3.2 and
the main trunk (as of 20020923) using "g++ -O2 -c".

The error message for the second snippet using gcc 3.0.x - 3.2 is

PR7944b.cc: In function `void foo()':
PR7944b.cc:27: Internal compiler error in find_reloads_toplev, at reload.c:4462
Please submit a full bug report, [etc.]

With the main trunk I get:

PR7944b.cc: In function `void foo()':
PR7944b.cc:27: error: unable to find a register to spill in class `GENERAL_REGS
   '
PR7944b.cc:27: error: this is the insn:
(insn:HI 212 382 222 13 0x40199e9c (set (reg/v:SI 1 edx [86])
        (sign_extend:SI (subreg:HI (const_double 0 [0x0] 65536 [0x10000] 0 [0x0] 0 [0x0] 0 [0x0]) 4))) 88 {extendhisi2} (nil)
    (expr_list:REG_DEAD (reg/v:DI 58)
        (nil)))
PR7944b.cc:27: internal compiler error: in spill_failure, at reload1.c:1916
Please submit a full bug report, [etc.]

It's a regression from 2.95.x, where the code compiles fine.
The bug should thus be marked "high priority".

Greetings,
Volker Reichelt

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7944



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