[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 Eric Botcazou changed: What|Removed |Added CC||ebotcazou at gcc dot gnu.org --- Comment #8 from Eric Botcazou --- > Yes, but code generation incorrect. It's not runtime yet. The criterion is as follows: does the code invoke undefined behavior when executed in the abstract machine specified by the C standard? If so, then the compiler is allowed to generate object code that does anything, including playing some music or erasing the hard drive; here it generates an infinite loop and that's OK.
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 --- Comment #7 from Dmitry Lesnikov --- (In reply to Andrew Pinski from comment #5) > (In reply to Dmitry Lesnikov from comment #4) > > (In reply to Andrew Pinski from comment #1) > > > signed overflow is undefined behavior at runtime. > > > > for(int i=0; i<10; i++) > > > > this loop is correct. > > But there is an overflow with the variable a when i is 6. Why does the line C1 c1; affect the behavior of the loop?
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 --- Comment #6 from Dmitry Lesnikov --- (In reply to Andrew Pinski from comment #5) > (In reply to Dmitry Lesnikov from comment #4) > > (In reply to Andrew Pinski from comment #1) > > > signed overflow is undefined behavior at runtime. > > > > for(int i=0; i<10; i++) > > > > this loop is correct. > > But there is an overflow with the variable a when i is 6. Yes, but code generation incorrect. It's not runtime yet.
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 --- Comment #5 from Andrew Pinski --- (In reply to Dmitry Lesnikov from comment #4) > (In reply to Andrew Pinski from comment #1) > > signed overflow is undefined behavior at runtime. > > for(int i=0; i<10; i++) > > this loop is correct. But there is an overflow with the variable a when i is 6.
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 --- Comment #4 from Dmitry Lesnikov --- (In reply to Andrew Pinski from comment #1) > signed overflow is undefined behavior at runtime. for(int i=0; i<10; i++) this loop is correct.
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski --- Does not matter, the behavior is undefined.
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 Dmitry Lesnikov changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #2 from Dmitry Lesnikov --- gcc 5.4.1 make correct code.
[Bug c++/84816] [7.2.0/8.0.1 x86_64] Incorrect code generation if signed overflow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84816 Andrew Pinski changed: What|Removed |Added Target|x86_84 | Status|UNCONFIRMED |RESOLVED Known to work|5.4.1 | Host|Ubuntu 16.04 x86_84 | Resolution|--- |INVALID Known to fail|7.2.0, 8.0.1| --- Comment #1 from Andrew Pinski --- signed overflow is undefined behavior at runtime.