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.

Reply via email to