[Bug c++/95334] GCC detect missing signed-integer-overflow when add "const"

2020-05-26 Thread haoxintu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95334 --- Comment #2 from Haoxin Tu --- I also find these cases test1.cc #include bool g_bool = 0; long g_long = -4075183478711827874L; const long l_long = 7122990940771016367L; int main () { g_bool = g_long * l_long; std::cout << g_bool <<

[Bug c++/95334] GCC detect missing signed-integer-overflow when add "const"

2020-05-26 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95334 --- Comment #1 from Jonathan Wakely --- My guess is that G++ folds the constants early and the overflow happens at compile time, so is never seen by UBsan.