[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #18 from Yuxuan Shui --- (In reply to Andrew Pinski from comment #17) > (In reply to Yuxuan Shui from comment #16) > > ... > > So -fno-strict-overflow does -fno-wrapv-pointer so we can assume pointer > arithmetic wraps now and then

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #17 from Andrew Pinski --- (In reply to Yuxuan Shui from comment #16) > I see. but if it's undefined, why was the `if (dso)` only removed when > -fno-strict-overflow is enabled? and it still happens with >

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #16 from Yuxuan Shui --- (In reply to Andrew Pinski from comment #13) > (In reply to Yuxuan Shui from comment #12) >> ... > > Except that is undefined ... > Manually unswitching introduces the undefined behavior in the code. > So

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #15 from Yuxuan Shui --- (In reply to Marek Polacek from comment #14) > I don't see a complete testcase that I could bisect. Please use the code sample in the original comment. since there are questions that the manually unswitched

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #14 from Marek Polacek --- I don't see a complete testcase that I could bisect.

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #13 from Andrew Pinski --- (In reply to Yuxuan Shui from comment #12) > I think this is the MRE: > > > void bug(struct obj *dso) { > if (>i) { > if (dso == (void *)0) > return; > >

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #12 from Yuxuan Shui --- I think this is the MRE: void bug(struct obj *dso) { if (>i) { if (dso == (void *)0) return; assert_not_null(dso); } }

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #11 from Yuxuan Shui --- reduced it a bit: void bug(struct obj **root, struct obj *dso) { if (>i) { while (1) { struct obj *this = *root; if (dso == (void

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 --- Comment #10 from Yuxuan Shui --- the manually unswitched version can probably be reduced further.

[Bug tree-optimization/113551] [13 Regression] Miscompilation with -O1 -fno-strict-overflow

2024-01-23 Thread yshuiv7 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551 Yuxuan Shui changed: What|Removed |Added Summary|[13 Regression] |[13 Regression]