This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The following code snippet triggers an ICE on the trunk: ===================== void foo(int i) { goto *i; } ===================== bug.cc: In function 'void foo(int)': bug.cc:1: error: goto destination is neither a label nor a pointer goto i; bug.cc:1: internal compiler error: verify_gimple failed Please submit a full bug report, [etc.] The error message comes from verify_gimple_goto so this is not an error-recovey bug, but a crash in the middle-end. I'm not quite sure whether the code is valid or not, i.e. whether 'i' should be converted into a pointer automatically or not. The C frontend accepts the code. The C++ frontend accepted the code up to and including 4.3.x. A more complex (and definitely invalid) testcase crashes in a different position (since at least GCC 2.95.3): ========================== struct A {}; struct B : virtual A {}; void foo(B b) { goto *b; } ========================== bug.cc: In function 'void foo(B)': bug.cc:7: internal compiler error: in create_tmp_var, at gimplify.c:555 Please submit a full bug report, [etc.]
IMHO this is invalid. extend.texi says @smallexample goto *ptr; @end smallexample @noindent Any expression of type @code{void *} is allowed. and integers are not promoted to pointers. This checking is only enabled with checking.
The C FE converts this to void * pointer silently: 7168 tree 7169 c_finish_goto_ptr (tree expr) 7170 { 7171 pedwarn (input_location, OPT_pedantic, "ISO C forbids %<goto *expr;%>"); 7172 expr = convert (ptr_type_node, expr); 7173 return add_stmt (build1 (GOTO_EXPR, void_type_node, expr)); 7174 } but the C++ FE doesn't. Either C++ should do the same as C, or both should reject it.
Subject: Re: [4.4 regression] ICE with goto This being accepted for C is bug 32122.
*** Bug 38593 has been marked as a duplicate of this bug. ***
Subject: Bug 38725 Author: jakub Date: Thu Jan 8 00:23:48 2009 New Revision: 143177 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143177 Log: PR c++/38725 * semantics.c (finish_goto_stmt): Convert destination to void *. * g++.dg/ext/label11.C: New test. Added: trunk/gcc/testsuite/g++.dg/ext/label11.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
Fixed.