Bug#180937: g++ internal compiler error: Error reporting routines re-entered
On Fri, Feb 14, 2003 at 12:14:01AM -0500, H. S. Teoh wrote:
> Package: g++
> Version: 3.2.2-0
> Severity: important
>
> The attached source file causes g++ to report an internal compiler error:
>
> % g++ -c g++bug.cc
> g++bug.cc: In function `int main(int, char**)':
> g++bug.cc:29: jump to case label
> g++bug.cc:26: crosses initialization of `someclass obj1'
> g++bug.cc:33: jump to case label
> g++bug.cc:30: crosses initialization of `someotherclass obj2'
> g++bug.cc:26: crosses initialization of `someclass obj1'
>
> Internal compiler error: Error reporting routines re-entered.
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
An ICE is always a bug, but...
> I'm not sure what is the cause of this; it seems to be something to do
> with the switch statement and the fact that someclass and someotherclass
> have destructors. (Commenting out the destructors in those classes makes
> the internal compiler error go away, somehow.)
>
> Also, why doesn't g++ like the declaration of objects inside a switch
> statement? Is this invalid according to the C++ spec, or is it a GCC
> oddity? Regardless, the internal compiler error is certainly a bug.
I'm pretty sure it's illegal. Consider this - what is the scope of
obj1 in the below? It starts at the first label, and goes until the
end of the case block. So it's in scope at CHOICE_B. But its
constructor wasn't called....
> switch (choice) {
> case CHOICE_A:
> someclass obj1(&commonobj);
>
> break;
> case CHOICE_B:
> someotherclass obj2(&commonobj);
>
> break;
> default:
> break;
> }
> }
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
Reply to: