[Bug middle-end/95326] GCC can not detect signed-integer-overflow correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95326 Andrew Pinski changed: What|Removed |Added Known to fail||13.1.0 Known to work||12.3.0 Resolution|--- |DUPLICATE Status|NEW |RESOLVED --- Comment #5 from Andrew Pinski --- Fixed for GCC 13 by r13-4988-g8692b15ae7c05e so a dup of bug 108256. *** This bug has been marked as a duplicate of bug 108256 ***
[Bug middle-end/95326] GCC can not detect signed-integer-overflow correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95326 --- Comment #4 from Andrew Pinski --- (In reply to Haoxin Tu from comment #3) > Would GCC shorten the multiple to be other types early as well? I also find > some cases in "short" type with the same symptom. I am still testing now and > don't know there are any cases in rest of types(such as char, int, long...) > have the problem. Yes and I suspect it is the same issue. the shortening is happening in convert before the instrumentation of the undefined sanitizer is done.
[Bug middle-end/95326] GCC can not detect signed-integer-overflow correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95326 --- Comment #3 from Haoxin Tu --- Would GCC shorten the multiple to be other types early as well? I also find some cases in "short" type with the same symptom. I am still testing now and don't know there are any cases in rest of types(such as char, int, long...) have the problem. By the way, should I file a new bug report when I found another type (for example,int) that GCC can not detect the signed-integer-overflow UB issues?
[Bug middle-end/95326] GCC can not detect signed-integer-overflow correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95326 Andrew Pinski changed: What|Removed |Added Component|c++ |middle-end Last reconfirmed||2020-05-26 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- The problem is GCC is shortening the multiple to be unsigned short early on. That is doing: long tt; tt = l_volatile_uchar - l_var_short % g_const_uint * l_var_long; l_var_short = tt; Shows the issue.