[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread saul.x.robinson at durham dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #8 from saul.x.robinson at durham dot ac.uk --- (In reply to Andrew Pinski from comment #7) > (In reply to saul.x.robinson from comment #6) > > > > Oh. > > Just encase it exist, is there a setting to make GCC assume overflows are > >

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #7 from Andrew Pinski --- (In reply to saul.x.robinson from comment #6) > > Oh. > Just encase it exist, is there a setting to make GCC assume overflows are > possible as I have found them to be useful quite often? I mentioned alrea

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread saul.x.robinson at durham dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #6 from saul.x.robinson at durham dot ac.uk --- (In reply to Andrew Pinski from comment #5) > (In reply to saul.x.robinson from comment #4) > > I know the integer overflows. > > Does that sort of undefined behavior cause issues with t

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #5 from Andrew Pinski --- (In reply to saul.x.robinson from comment #4) > I know the integer overflows. > Does that sort of undefined behavior cause issues with the final machine > code the compiler generates? Yes. In this case if y

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #3 from Andrew Pinski --- Please also read https://blog.regehr.org/archives/213 .

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #2 from Andrew Pinski --- Note -fsanitize=undefined does catch this: /app/example.c:5:4: runtime error: signed integer overflow: 2139095040 + 1065353216 cannot be represented in type 'int'

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread saul.x.robinson at durham dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 --- Comment #4 from saul.x.robinson at durham dot ac.uk --- (In reply to saul.x.robinson from comment #0) > I have confirmed is bug occurs on 15.1.0 and 12.2.0. Don't know how to find > more recent versions. > Those GCC versions were compiling fo

[Bug tree-optimization/119984] Incorrect code with -O2 and above

2025-04-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED