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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0

--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Alex Coplan from comment #2)
> (In reply to Xi Ruoyao from comment #1)
> > Isn't this a UB?
> > 
> >   while (p >= path && *p != '/')
> >     p--;
> > 
> > This will cause p to become "&main::path[0] - 1".  C23 6.5.6p9:
> 
> In this case, with the input given in main, I think p should end up pointing
> to main::path + 1 (since we pass in main::path + 2, and foo can only ever
> decrement p at most one below its parameter path).

Sorry, I misread the code.  I guess I need to drink some coffee now...

Reply via email to