public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113396] New: csmith: differences from -O2 to -O3
@ 2024-01-15 11:53 dcb314 at hotmail dot com
2024-01-15 12:16 ` [Bug c/113396] " dcb314 at hotmail dot com
` (36 more replies)
0 siblings, 37 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-15 11:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Bug ID: 113396
Summary: csmith: differences from -O2 to -O3
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Created attachment 57082
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57082&action=edit
C source code
The attached Csmith generated code does this:
foundBugs $ ~/gcc/results/bin/gcc -w bug998.c
foundBugs $ valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O2 bug998.c
foundBugs $ valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O3 bug998.c
foundBugs $ valgrind -q ./a.out
checksum = 130B5204
foundBugs $ ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing
-fno-loop-interchange bug998.c
foundBugs $ valgrind -q ./a.out
checksum = 130B5204
foundBugs $
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug c/113396] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
@ 2024-01-15 12:16 ` dcb314 at hotmail dot com
2024-01-15 19:14 ` dcb314 at hotmail dot com
` (35 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-15 12:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
foundBugs $ ~/gcc/results/bin/gcc -w -O2 bug998.c -o two.exe
foundBugs $ ~/gcc/results/bin/gcc -w -O3 bug998.c -o three.exe
foundBugs $ ./two.exe 1 > two.out
foundBugs $ ./three.exe 1 > three.out
foundBugs $ diff two.out three.out | head -20
510,520c510,520
< ...checksum after hashing g_179.f2 : F8C8E936
< ...checksum after hashing g_179.f3 : 22C7AEC4
< ...checksum after hashing g_179.f4 : E057A6AE
< ...checksum after hashing g_179.f5 : 494E34F0
< ...checksum after hashing g_179.f6 : 72F55A7C
< ...checksum after hashing g_179.f7 : 9B53D63F
< ...checksum after hashing g_179.f8 : DD10C49F
< ...checksum after hashing g_179.f9 : 979E03A7
< ...checksum after hashing g_195 : 63EDBCE7
< ...checksum after hashing g_196 : C1F2B26B
< ...checksum after hashing g_226[i][j] : 835FC1
---
> ...checksum after hashing g_179.f2 : A0B13872
> ...checksum after hashing g_179.f3 : A6EAB221
> ...checksum after hashing g_179.f4 : 744D7BAB
> ...checksum after hashing g_179.f5 : 4D71F83C
> ...checksum after hashing g_179.f6 : 54EDEE43
> ...checksum after hashing g_179.f7 : B280A60F
> ...checksum after hashing g_179.f8 : ECCE643D
foundBugs $
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug c/113396] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
2024-01-15 12:16 ` [Bug c/113396] " dcb314 at hotmail dot com
@ 2024-01-15 19:14 ` dcb314 at hotmail dot com
2024-01-15 19:15 ` dcb314 at hotmail dot com
` (34 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-15 19:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
The bug seems to exist from sometime before
g:d042f118798ae0648b45f97e63b0e5ab7c82c8ef, dated 20230205.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug c/113396] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
2024-01-15 12:16 ` [Bug c/113396] " dcb314 at hotmail dot com
2024-01-15 19:14 ` dcb314 at hotmail dot com
@ 2024-01-15 19:15 ` dcb314 at hotmail dot com
2024-01-15 22:34 ` [Bug middle-end/113396] [13/14 Regression] " pinskia at gcc dot gnu.org
` (33 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-15 19:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
Created attachment 57089
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57089&action=edit
C source code
Partly reduced C source code.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (2 preceding siblings ...)
2024-01-15 19:15 ` dcb314 at hotmail dot com
@ 2024-01-15 22:34 ` pinskia at gcc dot gnu.org
2024-01-16 8:46 ` dcb314 at hotmail dot com
` (32 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-15 22:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.3
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (3 preceding siblings ...)
2024-01-15 22:34 ` [Bug middle-end/113396] [13/14 Regression] " pinskia at gcc dot gnu.org
@ 2024-01-16 8:46 ` dcb314 at hotmail dot com
2024-01-16 9:30 ` dcb314 at hotmail dot com
` (31 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-16 8:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
foundBugs $ ../results.20220116/bin/gcc -w -O2 bug998.c
foundBugs $ ./a.out
checksum = 77A231E6
foundBugs $ ../results.20220116/bin/gcc -w -O3 bug998.c
foundBugs $ ./a.out
checksum = 77A231E6
foundBugs $ ../results.20230205/bin/gcc -w -O2 bug998.c
foundBugs $ ./a.out
checksum = 77A231E6
foundBugs $ ../results.20230205/bin/gcc -w -O3 bug998.c
foundBugs $ ./a.out
checksum = 130B5204
foundBugs $
So it goes wrong sometime between g:90045c5df5b3c8853e7740fb72a11aead1c489bb
and g:d042f118798ae0648b45f97e63b0e5ab7c82c8ef, a distance of 7403 commits.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (4 preceding siblings ...)
2024-01-16 8:46 ` dcb314 at hotmail dot com
@ 2024-01-16 9:30 ` dcb314 at hotmail dot com
2024-01-16 9:48 ` dcb314 at hotmail dot com
` (30 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-16 9:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
Bisect range seems to be g:e03a0a4d73a478928b26213363fa5dbb9fc8695f ..
g:4e1914625dec4aa09a5671c6294e877dbf4518f5, which is 1850 commits.
I will continue the bisection.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (5 preceding siblings ...)
2024-01-16 9:30 ` dcb314 at hotmail dot com
@ 2024-01-16 9:48 ` dcb314 at hotmail dot com
2024-01-16 10:22 ` dcb314 at hotmail dot com
` (29 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-16 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
Reduced bisect range seems to be g:2c11662391bafd74c9d19bf7626b7bcef41c1323 ..
g:9e0d5db3e04afd2d030ace4ccb5c1af5e9f05a8f, which is 462 commits.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (6 preceding siblings ...)
2024-01-16 9:48 ` dcb314 at hotmail dot com
@ 2024-01-16 10:22 ` dcb314 at hotmail dot com
2024-01-16 10:30 ` dcb314 at hotmail dot com
` (28 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-16 10:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
Current range seems to be g:54a5f478487a955c3ffaec3e9164a72599bc1cfb ..
g:1edfc8f2d3307a3ffa077a605f432832d7715462, which is 4 commits.
Of those 4, this one
commit 8c99e307b20c502e55c425897fb3884ba8f05882
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Sat Jun 25 18:58:02 2022 -0400
looks a likely candidate.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (7 preceding siblings ...)
2024-01-16 10:22 ` dcb314 at hotmail dot com
@ 2024-01-16 10:30 ` dcb314 at hotmail dot com
2024-01-17 17:28 ` jakub at gcc dot gnu.org
` (27 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-16 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
David Binderman <dcb314 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at redhat dot com
--- Comment #8 from David Binderman <dcb314 at hotmail dot com> ---
As expected:
$ git bisect good fc259b522c0f8b7bbca8e7adcd3da63330094a34
8c99e307b20c502e55c425897fb3884ba8f05882 is the first bad commit
commit 8c99e307b20c502e55c425897fb3884ba8f05882
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Sat Jun 25 18:58:02 2022 -0400
Over to Aldy for their best opinion.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (8 preceding siblings ...)
2024-01-16 10:30 ` dcb314 at hotmail dot com
@ 2024-01-17 17:28 ` jakub at gcc dot gnu.org
2024-01-17 17:32 ` dcb314 at hotmail dot com
` (26 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-17 17:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |jakub at gcc dot gnu.org
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
r13-1268-g8c99e307b20c502e55c425897fb3884ba8f05882
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (9 preceding siblings ...)
2024-01-17 17:28 ` jakub at gcc dot gnu.org
@ 2024-01-17 17:32 ` dcb314 at hotmail dot com
2024-03-15 15:02 ` law at gcc dot gnu.org
` (25 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-01-17 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #10 from David Binderman <dcb314 at hotmail dot com> ---
Created attachment 57117
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57117&action=edit
C source code
After many hours, cvise appears incapable of reducing the code
much beyond this version.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (10 preceding siblings ...)
2024-01-17 17:32 ` dcb314 at hotmail dot com
@ 2024-03-15 15:02 ` law at gcc dot gnu.org
2024-03-15 15:55 ` rguenth at gcc dot gnu.org
` (24 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-15 15:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |law at gcc dot gnu.org
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (11 preceding siblings ...)
2024-03-15 15:02 ` law at gcc dot gnu.org
@ 2024-03-15 15:55 ` rguenth at gcc dot gnu.org
2024-03-15 15:58 ` rguenth at gcc dot gnu.org
` (23 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-15 15:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2024-03-15
Priority|P1 |P2
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
13.1 was released and broken, so this can't be P1. It's also still
unconfirmed. The last reduced testcase does
> ./xgcc -B. t.c
> ./a.out
...checksum after hashing : FFFFFFFF6522DF69
Segmentation fault (core dumped)
Program received signal SIGSEGV, Segmentation fault.
0x0000000000400792 in main () at t.c:115
115 transparent_crc(g_7[main_i][main_j], "");
(gdb) p main_i
$1 = -1747789432
so it seems a useless reduction.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (12 preceding siblings ...)
2024-03-15 15:55 ` rguenth at gcc dot gnu.org
@ 2024-03-15 15:58 ` rguenth at gcc dot gnu.org
2024-03-15 16:47 ` dcb314 at hotmail dot com
` (22 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-15 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
The second testcase behaves the same with -O0, -O2 and -O3 on x86_64-linux for
me (and with trunk and GCC 13.2.1)
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (13 preceding siblings ...)
2024-03-15 15:58 ` rguenth at gcc dot gnu.org
@ 2024-03-15 16:47 ` dcb314 at hotmail dot com
2024-03-15 16:57 ` jakub at gcc dot gnu.org
` (21 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-03-15 16:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #13 from David Binderman <dcb314 at hotmail dot com> ---
I had another look at the original source code and got this with
recent gcc trunk:
foundBugs $ ~/gcc/results/bin/gcc -w bug998.c && ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O2 bug998.c && ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O3 bug998.c && ./a.out
checksum = 130B5204
foundBugs $ ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing
-fno-loop-interchange bug998.c && ./a.out
checksum = 130B5204
foundBugs $ ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing
-fno-loop-interchange bug998.c && valgrind -q ./a.out
checksum = 130B5204
foundBugs $ ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing
-fno-loop-interchange -fsanitize=address bug998.c && ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing
-fno-loop-interchange -fsanitize=undefined bug998.c && ./a.out
checksum = 77A231E6
foundBugs $
Case 3 looks suspicious. I guess if I knew the which flags -O3 switches on,
that aren't in -O2, I could find out which ones are causing trouble.
I don't know a -O2.5
Case 4 makes it look like aliasing and loop interchange aren't at fault.
Cases 5, 6 & 7 show that the usual tools find nothing wrong.
Cases 6 & 7 make it looks like switching on a sanitizer makes the code work.
I don't understand why that would be.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (14 preceding siblings ...)
2024-03-15 16:47 ` dcb314 at hotmail dot com
@ 2024-03-15 16:57 ` jakub at gcc dot gnu.org
2024-03-15 17:15 ` dcb314 at hotmail dot com
` (20 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-15 16:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
/* -O3 optimizations. */
{ OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_floop_interchange, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_floop_unroll_and_jam, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpeel_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fsplit_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fsplit_paths, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribution, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC
},
{ OPT_LEVELS_3_PLUS, OPT_fversion_loops_for_strides, NULL, 1 },
/* -O3 parameters. */
{ OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_auto_, NULL, 30 },
{ OPT_LEVELS_3_PLUS, OPT__param_early_inlining_insns_, NULL, 14 },
{ OPT_LEVELS_3_PLUS, OPT__param_inline_heuristics_hint_percent_, NULL, 600
},
{ OPT_LEVELS_3_PLUS, OPT__param_inline_min_speedup_, NULL, 15 },
{ OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_single_, NULL, 200 },
So, that is -O2 -fgcse-after-reload -fipa-cp-clone -floop-interchange
-floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops
-fsplit-paths -ftree-loop-distribution -ftree-partial-pre -funswitch-loops
-fvect-cost-model=dynamic -fversion-loops-for-strides
--param=max-inline-insns-auto=30 --param=early-inlining-insns=14
--param=inline-heuristics-hint-percent=600 --param=inline-min-speedup=15
--param=max-inline-insns-single=200
Of course, some further tweaks could be hidden in target files or something
could just test optimize >= 3 or similar.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (15 preceding siblings ...)
2024-03-15 16:57 ` jakub at gcc dot gnu.org
@ 2024-03-15 17:15 ` dcb314 at hotmail dot com
2024-03-15 17:21 ` dcb314 at hotmail dot com
` (19 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-03-15 17:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #15 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Jakub Jelinek from comment #14)
> So, that is -O2 -fgcse-after-reload -fipa-cp-clone -floop-interchange
> -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops
> -fsplit-paths -ftree-loop-distribution -ftree-partial-pre -funswitch-loops
> -fvect-cost-model=dynamic -fversion-loops-for-strides
> --param=max-inline-insns-auto=30 --param=early-inlining-insns=14
> --param=inline-heuristics-hint-percent=600 --param=inline-min-speedup=15
> --param=max-inline-insns-single=200
Thanks for that. None of the -f flags seems to affect anything.
foundBugs $ cat flag.list
--param=early-inlining-insns=14
--param=inline-heuristics-hint-percent=600
--param=inline-min-speedup=15
--param=max-inline-insns-auto=30
--param=max-inline-insns-single=200
-O2
foundBugs $ ~/gcc/results/bin/gcc -w -O2 bug998.c && ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w `cat flag.list` bug998.c && ./a.out
checksum = 130B5204
foundBugs $
So it looks like one or more of the --param flags is to blame.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (16 preceding siblings ...)
2024-03-15 17:15 ` dcb314 at hotmail dot com
@ 2024-03-15 17:21 ` dcb314 at hotmail dot com
2024-03-15 21:07 ` dcb314 at hotmail dot com
` (18 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-03-15 17:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #16 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #15)
> So it looks like one or more of the --param flags is to blame.
foundBugs $ ~/gcc/results/bin/gcc -w -O2 bug998.c && ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O2 --param=max-inline-insns-auto=30
bug998.c && ./a.out
checksum = 130B5204
foundBugs $
It seems to break sometime between 23 and 24.
foundBugs $ ~/gcc/results/bin/gcc -w -O2 --param=max-inline-insns-auto=23
bug998.c && ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results/bin/gcc -w -O2 --param=max-inline-insns-auto=24
bug998.c && ./a.out
checksum = 130B5204
foundBugs $
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (17 preceding siblings ...)
2024-03-15 17:21 ` dcb314 at hotmail dot com
@ 2024-03-15 21:07 ` dcb314 at hotmail dot com
2024-03-16 16:56 ` dcb314 at hotmail dot com
` (17 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-03-15 21:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #17 from David Binderman <dcb314 at hotmail dot com> ---
I tried out gcc-13.2 and got the following results:
foundBugs $ ~/gcc/results.13.2.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=23 bug998.c && valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results.13.2.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=24 bug998.c && valgrind -q ./a.out
checksum = 130B5204
foundBugs $
so it is something that has been going wrong since before gcc-13.2.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (18 preceding siblings ...)
2024-03-15 21:07 ` dcb314 at hotmail dot com
@ 2024-03-16 16:56 ` dcb314 at hotmail dot com
2024-03-16 18:33 ` dcb314 at hotmail dot com
` (16 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-03-16 16:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #18 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #17)
> I tried out gcc-13.2 and got the following results:
>
> foundBugs $ ~/gcc/results.13.2.asan.ubsan/bin/gcc -w -O2
> --param=max-inline-insns-auto=23 bug998.c && valgrind -q ./a.out
> checksum = 77A231E6
> foundBugs $ ~/gcc/results.13.2.asan.ubsan/bin/gcc -w -O2
> --param=max-inline-insns-auto=24 bug998.c && valgrind -q ./a.out
> checksum = 130B5204
> foundBugs $
>
> so it is something that has been going wrong since before gcc-13.2.
Similarly with 13.1:
foundBugs $ ~/gcc/results.13.1.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=23 bug998.c && valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results.13.1.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=24 bug998.c && valgrind -q ./a.out
checksum = 130B5204
foundBugs $
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (19 preceding siblings ...)
2024-03-16 16:56 ` dcb314 at hotmail dot com
@ 2024-03-16 18:33 ` dcb314 at hotmail dot com
2024-03-18 5:56 ` sjames at gcc dot gnu.org
` (15 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: dcb314 at hotmail dot com @ 2024-03-16 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #19 from David Binderman <dcb314 at hotmail dot com> ---
gcc 12.3 seems to get it right:
foundBugs $ ~/gcc/results.12.3.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=23 bug998.c && valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results.12.3.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=24 bug998.c && valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results.12.3.asan.ubsan/bin/gcc -w -O2
--param=max-inline-insns-auto=30 bug998.c && valgrind -q ./a.out
checksum = 77A231E6
foundBugs $ ~/gcc/results.12.3.asan.ubsan/bin/gcc -w -O3 bug998.c && valgrind
-q ./a.out
checksum = 77A231E6
foundBugs $
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (20 preceding siblings ...)
2024-03-16 18:33 ` dcb314 at hotmail dot com
@ 2024-03-18 5:56 ` sjames at gcc dot gnu.org
2024-03-19 3:47 ` sjames at gcc dot gnu.org
` (14 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-18 5:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sjames at gcc dot gnu.org
--- Comment #20 from Sam James <sjames at gcc dot gnu.org> ---
I'm going to throw my usual cvise setup for miscompiles at it for a few days
and see if anything useful falls out.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (21 preceding siblings ...)
2024-03-18 5:56 ` sjames at gcc dot gnu.org
@ 2024-03-19 3:47 ` sjames at gcc dot gnu.org
2024-03-19 5:01 ` pinskia at gcc dot gnu.org
` (13 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-19 3:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #21 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 57727
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57727&action=edit
reduced.c
This aborts for me at >= -O1 but I'm not convinced it's right.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (22 preceding siblings ...)
2024-03-19 3:47 ` sjames at gcc dot gnu.org
@ 2024-03-19 5:01 ` pinskia at gcc dot gnu.org
2024-03-19 5:16 ` pinskia at gcc dot gnu.org
` (12 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-19 5:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #22 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Adding -fno-tree-loop-im allows it to work.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (23 preceding siblings ...)
2024-03-19 5:01 ` pinskia at gcc dot gnu.org
@ 2024-03-19 5:16 ` pinskia at gcc dot gnu.org
2024-03-19 5:30 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-19 5:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #23 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 57728
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57728&action=edit
Reduced slightly more, removes the string compare
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (24 preceding siblings ...)
2024-03-19 5:16 ` pinskia at gcc dot gnu.org
@ 2024-03-19 5:30 ` pinskia at gcc dot gnu.org
2024-03-19 5:30 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-19 5:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #57727|0 |1
is obsolete| |
Attachment #57728|0 |1
is obsolete| |
--- Comment #24 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 57729
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57729&action=edit
More reduced
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (25 preceding siblings ...)
2024-03-19 5:30 ` pinskia at gcc dot gnu.org
@ 2024-03-19 5:30 ` pinskia at gcc dot gnu.org
2024-03-19 5:39 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-19 5:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #25 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (26 preceding siblings ...)
2024-03-19 5:30 ` pinskia at gcc dot gnu.org
@ 2024-03-19 5:39 ` pinskia at gcc dot gnu.org
2024-03-19 5:41 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-19 5:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #57729|0 |1
is obsolete| |
--- Comment #26 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 57730
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57730&action=edit
Slightly cleaned up
Note p has to be __int128, otherwise it works.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (27 preceding siblings ...)
2024-03-19 5:39 ` pinskia at gcc dot gnu.org
@ 2024-03-19 5:41 ` pinskia at gcc dot gnu.org
2024-03-19 6:21 ` sjames at gcc dot gnu.org
` (7 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-19 5:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-reduction |needs-bisection
--- Comment #27 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It might be useful to redo the bisect on the testcase in comment #26 at -O1 .
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (28 preceding siblings ...)
2024-03-19 5:41 ` pinskia at gcc dot gnu.org
@ 2024-03-19 6:21 ` sjames at gcc dot gnu.org
2024-03-19 7:32 ` [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50 sjames at gcc dot gnu.org
` (6 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-19 6:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #28 from Sam James <sjames at gcc dot gnu.org> ---
Running bisect
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (29 preceding siblings ...)
2024-03-19 6:21 ` sjames at gcc dot gnu.org
@ 2024-03-19 7:32 ` sjames at gcc dot gnu.org
2024-03-19 14:18 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-19 7:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amacleod at redhat dot com
Summary|[13/14 Regression] csmith: |[13/14 Regression] csmith:
|differences from -O2 to -O3 |differences from -O2 to -O3
| |since
| |r13-1268-g8c99e307b20c50
Keywords|needs-bisection |
--- Comment #29 from Sam James <sjames at gcc dot gnu.org> ---
r13-1268-g8c99e307b20c50 again
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (30 preceding siblings ...)
2024-03-19 7:32 ` [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50 sjames at gcc dot gnu.org
@ 2024-03-19 14:18 ` rguenth at gcc dot gnu.org
2024-03-19 14:25 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-19 14:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #30 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's LIM2 which applies store-motion to m[0] but keeps m[p] in the loop.
Then with range-info for the int128 of [0, +INF] we get into
get_ref_base_and_extent:
query = get_range_query (cfun);
if (TREE_CODE (index) == SSA_NAME
&& (low_bound = array_ref_low_bound (exp),
poly_int_tree_p (low_bound))
&& (unit_size = array_ref_element_size (exp),
TREE_CODE (unit_size) == INTEGER_CST)
&& query->range_of_expr (vr, index)
&& !vr.varying_p ()
&& !vr.undefined_p ())
{
wide_int min = vr.lower_bound ();
wide_int max = vr.upper_bound ();
poly_offset_int lbound = wi::to_poly_offset (low_bound);
/* Try to constrain maxsize with range information. */
offset_int omax
= offset_int::from (max, TYPE_SIGN (TREE_TYPE (index)));
if (known_lt (lbound, omax))
{
poly_offset_int rmaxsize;
rmaxsize = (omax - lbound + 1)
* wi::to_offset (unit_size) << LOG2_BITS_PER_UNIT;
if (!known_size_p (maxsize)
|| known_lt (rmaxsize, maxsize))
and compute rmaxsize == 0.
What's definitely questionable here is the offset_int::from, though it
fits. But omax - lbound + 1 overflows to zero here. It's probably
better to use widest-int here, even if that's possibly slower than
offset_int. Or ensure offset_int has one more bit than required for
the index type (offset_int has 64bit + 3bits, so 128bits).
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (31 preceding siblings ...)
2024-03-19 14:18 ` rguenth at gcc dot gnu.org
@ 2024-03-19 14:25 ` rguenth at gcc dot gnu.org
2024-03-20 8:22 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-19 14:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #31 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc
index cbd3774b21f..1dbd9bd7a00 100644
--- a/gcc/tree-dfa.cc
+++ b/gcc/tree-dfa.cc
@@ -549,7 +549,8 @@ get_ref_base_and_extent (tree exp, poly_int64 *poffset,
/* Try to constrain maxsize with range information. */
offset_int omax
= offset_int::from (max, TYPE_SIGN (TREE_TYPE (index)));
- if (known_lt (lbound, omax))
+ if (wi::get_precision (max) < ADDR_MAX_PRECISION
+ && known_lt (lbound, omax))
{
poly_offset_int rmaxsize;
rmaxsize = (omax - lbound + 1)
@@ -567,7 +568,8 @@ get_ref_base_and_extent (tree exp, poly_int64 *poffset,
/* Try to adjust bit_offset with range information. */
offset_int omin
= offset_int::from (min, TYPE_SIGN (TREE_TYPE (index)));
- if (known_le (lbound, omin))
+ if (wi::get_precision (min) < ADDR_MAX_PRECISION
+ && known_le (lbound, omin))
{
poly_offset_int woffset
= wi::sext (omin - lbound,
fixes the testcase but I'm not 100% sure the condition is correct. We
possibly need to cover for the << LOG2_BITS_PER_UNIT done, so maybe
using ADDR_MAX_BITSIZE is better. I'm going to test a variant with
using <= ADDR_MAX_BITSIZE.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (32 preceding siblings ...)
2024-03-19 14:25 ` rguenth at gcc dot gnu.org
@ 2024-03-20 8:22 ` cvs-commit at gcc dot gnu.org
2024-03-20 8:22 ` [Bug middle-end/113396] [13 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
36 siblings, 0 replies; 38+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-20 8:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #32 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:6a55e39bdb1fdb570730c08413ebbe744e493411
commit r14-9565-g6a55e39bdb1fdb570730c08413ebbe744e493411
Author: Richard Biener <rguenther@suse.de>
Date: Tue Mar 19 15:25:16 2024 +0100
middle-end/113396 - int128 array index and value-ranges
The following fixes bogus truncation of a value-range for an int128
array index when computing the maximum extent for a variable array
reference. Instead of possibly slowing things down by using
widest_int the following makes sure the range bounds fit within
the constraints offset_int were designed for.
PR middle-end/113396
* tree-dfa.cc (get_ref_base_and_extent): Use index range
bounds only if they fit within the address-range constraints
of offset_int.
* gcc.dg/torture/pr113396.c: New testcase.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (33 preceding siblings ...)
2024-03-20 8:22 ` cvs-commit at gcc dot gnu.org
@ 2024-03-20 8:22 ` rguenth at gcc dot gnu.org
2024-05-08 11:49 ` cvs-commit at gcc dot gnu.org
2024-05-08 11:50 ` rguenth at gcc dot gnu.org
36 siblings, 0 replies; 38+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-20 8:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |14.0
Summary|[13/14 Regression] csmith: |[13 Regression] csmith:
|differences from -O2 to -O3 |differences from -O2 to -O3
|since |since
|r13-1268-g8c99e307b20c50 |r13-1268-g8c99e307b20c50
--- Comment #33 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (34 preceding siblings ...)
2024-03-20 8:22 ` [Bug middle-end/113396] [13 " rguenth at gcc dot gnu.org
@ 2024-05-08 11:49 ` cvs-commit at gcc dot gnu.org
2024-05-08 11:50 ` rguenth at gcc dot gnu.org
36 siblings, 0 replies; 38+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-08 11:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
--- Comment #34 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:7baefcb0a358a47a7e2340432d49f29db798a200
commit r13-8718-g7baefcb0a358a47a7e2340432d49f29db798a200
Author: Richard Biener <rguenther@suse.de>
Date: Tue Mar 19 15:25:16 2024 +0100
middle-end/113396 - int128 array index and value-ranges
The following fixes bogus truncation of a value-range for an int128
array index when computing the maximum extent for a variable array
reference. Instead of possibly slowing things down by using
widest_int the following makes sure the range bounds fit within
the constraints offset_int were designed for.
PR middle-end/113396
* tree-dfa.cc (get_ref_base_and_extent): Use index range
bounds only if they fit within the address-range constraints
of offset_int.
* gcc.dg/torture/pr113396.c: New testcase.
(cherry picked from commit 6a55e39bdb1fdb570730c08413ebbe744e493411)
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Bug middle-end/113396] [13 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
` (35 preceding siblings ...)
2024-05-08 11:49 ` cvs-commit at gcc dot gnu.org
@ 2024-05-08 11:50 ` rguenth at gcc dot gnu.org
36 siblings, 0 replies; 38+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-08 11:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |13.2.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Known to work| |13.2.1
--- Comment #35 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2024-05-08 11:50 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
2024-01-15 12:16 ` [Bug c/113396] " dcb314 at hotmail dot com
2024-01-15 19:14 ` dcb314 at hotmail dot com
2024-01-15 19:15 ` dcb314 at hotmail dot com
2024-01-15 22:34 ` [Bug middle-end/113396] [13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-16 8:46 ` dcb314 at hotmail dot com
2024-01-16 9:30 ` dcb314 at hotmail dot com
2024-01-16 9:48 ` dcb314 at hotmail dot com
2024-01-16 10:22 ` dcb314 at hotmail dot com
2024-01-16 10:30 ` dcb314 at hotmail dot com
2024-01-17 17:28 ` jakub at gcc dot gnu.org
2024-01-17 17:32 ` dcb314 at hotmail dot com
2024-03-15 15:02 ` law at gcc dot gnu.org
2024-03-15 15:55 ` rguenth at gcc dot gnu.org
2024-03-15 15:58 ` rguenth at gcc dot gnu.org
2024-03-15 16:47 ` dcb314 at hotmail dot com
2024-03-15 16:57 ` jakub at gcc dot gnu.org
2024-03-15 17:15 ` dcb314 at hotmail dot com
2024-03-15 17:21 ` dcb314 at hotmail dot com
2024-03-15 21:07 ` dcb314 at hotmail dot com
2024-03-16 16:56 ` dcb314 at hotmail dot com
2024-03-16 18:33 ` dcb314 at hotmail dot com
2024-03-18 5:56 ` sjames at gcc dot gnu.org
2024-03-19 3:47 ` sjames at gcc dot gnu.org
2024-03-19 5:01 ` pinskia at gcc dot gnu.org
2024-03-19 5:16 ` pinskia at gcc dot gnu.org
2024-03-19 5:30 ` pinskia at gcc dot gnu.org
2024-03-19 5:30 ` pinskia at gcc dot gnu.org
2024-03-19 5:39 ` pinskia at gcc dot gnu.org
2024-03-19 5:41 ` pinskia at gcc dot gnu.org
2024-03-19 6:21 ` sjames at gcc dot gnu.org
2024-03-19 7:32 ` [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50 sjames at gcc dot gnu.org
2024-03-19 14:18 ` rguenth at gcc dot gnu.org
2024-03-19 14:25 ` rguenth at gcc dot gnu.org
2024-03-20 8:22 ` cvs-commit at gcc dot gnu.org
2024-03-20 8:22 ` [Bug middle-end/113396] [13 " rguenth at gcc dot gnu.org
2024-05-08 11:49 ` cvs-commit at gcc dot gnu.org
2024-05-08 11:50 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).