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

--- Comment #11 from Krzysztof Pecka <krzysiu858519851 at gmail dot com> ---
(In reply to Andrew Pinski from comment #10)
> Note my self contained example I attached I had actually made the change to:
>         index = line.find_first_of(semicolonChar);
> 
> This is why at first I didn't see the issue :).
> Also I suspect it is not there is a null character after the stack variable
> but rather GCC knows that strlen(&a); has to be 0; otherwise it is undefined
> for reading past the bounds of the "array" of 1.

Interesting. I honestly forgot about null character.
Still for me, interesting to see those different behaviors with different
optimization flags.

Reply via email to