This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/61741] wrong code by LTO on x86_64-linux-gnu


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

--- Comment #2 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Andi Kleen from comment #1)
>  char c = 0;
>   for (; a; a--)
>     for (; c >= 0; c++);
> 
> Don't you rely on signed overflow which is undefined?

No, there is no signed overflow since the variable c is a char so the
increments are performed on int first and then cast back to char: (char) ((int)
c + 1).   

The same also holds for short.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]