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

--- Comment #4 from Li Shaohua <shaohua.li at inf dot ethz.ch> ---
(In reply to Andrew Pinski from comment #2)
>       i = i - 6822162149299574294;
> 
> Is not being invoked on the executable code.
> 
> If we look at look at the original code:
> 
> 
>     if ((i * (unsigned long)7 <= 1) << j)
>       ;
>     else {
>       i = i - 6822162149299574294;
>       if (j) {
>         if (*g)
>           break;
>         continue;
>       }
>       return 8;
>     }
> ...
>   return h;
> 
> The only path where the undefined behavior even matters is inside the path
> that had continue in it. Which is where the subtraction is pushed to now.
> 
> I don't know if we should declear this as a valid thing to do or not.

When I compiled the source code with `-O1 -fsanitize=undefined` and then used
gdb to check the execution trace of the binary, I indeed observed that `i = i -
6822162149299574294` was executed.

Reply via email to