[Bug rtl-optimization/110791] [12/13/14 Regression] arm: Wrong code with -Os -march=armv8.1-m.main

xry111 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 24 11:24:18 GMT 2023


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110791

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
                 CC|                            |xry111 at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-07-24

--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Isn't this a UB?

  while (p >= path && *p != '/')
    p--;

This will cause p to become "&main::path[0] - 1".  C23 6.5.6p9:

If the pointer operand and the result do not point to elements of the same
array object or one past the last element of the array object, the behavior is
undefined.


More information about the Gcc-bugs mailing list