[Bug c/105969] [12/13 Regression] ICE in Floating point exception

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 15 08:50:00 GMT 2022


Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2022-06-15
   Target Milestone|---                         |12.2
           Keywords|                            |accepts-invalid,
                   |                            |needs-bisection
     Ever confirmed|0                           |1
                 CC|                            |jsm28 at gcc dot gnu.org
             Blocks|                            |105604
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---

(gdb) l
2318            unsigned HOST_WIDE_INT byteoff = idx * elbytes;
2320            if (byteoff < HOST_WIDE_INT_MAX
2321                && elbytes < HOST_WIDE_INT_MAX
2322                && byteoff / elbytes == idx)
2323              {
2324                /* For in-bounds constant offsets into constant-sized
2325                   bump up *OFF, and for what's likely arrays or structs of
2326                   arrays, also *FLDOFF, as necessary.  */
(gdb) p elbytes
$1 = 0

I think this testcase should probably be rejected given we have b with
an array element size of zero which means elements overlap.  Joseph?

The ICE can be mitigated by reworking the byteoff / elbytes == idx check
which seems to be looking for whether the byteoff computation overflowed?
(but we don't check whether *off += byteoff overflows).  The overflow
checking can be preserved by doing elbytes == 0 || byteoff / elbytes == idx.

Referenced Bugs:

[Bug 105604] [10/11 Regression] ICE: in tree_to_shwi with vla in struct and

More information about the Gcc-bugs mailing list