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.]


-- 
           Summary: [4.4 regression] ICE with goto
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, ice-on-invalid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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

Reply via email to