The following code snippet causes an ICE in the C++ frontend on mainline:

===============
int x[1/0];
===============

bug.cc:1: warning: division by zero in '1 / 0'
bug.cc:1: error: size of array 'x' is not an integral constant-expression
bug.cc:1: internal compiler error: tree check: expected class 'constant', have
'binary' (minus_expr) in compute_array_index_type, at cp/decl.c:6377
Please submit a full bug report, [etc.]

This was introduced with Roger's patch
http://gcc.gnu.org/ml/gcc-cvs/2005-12/msg00129.html

Roger, could you please have a look?

The C frontend ICE's on this code as well, but that's because of PR 25161.
So it's hard to tell whether the C frontend is affected by this particular
problem or not.


-- 
           Summary: [4.2 regression] ICE on invalid array bound: int x[1/0];
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, 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=25263

Reply via email to