public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed
@ 2023-06-04 21:27 zhendong.su at inf dot ethz.ch
2023-06-04 21:47 ` [Bug tree-optimization/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381 pinskia at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2023-06-04 21:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
Bug ID: 110117
Summary: ICE on valid code at -O1 with "": verify_ssa failed
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
It appears to be a recent regression.
Compiler Explorer: https://godbolt.org/z/fsxExbW9P
[584] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230604 (experimental) [master r14-924-gd709841ae0f] (GCC)
[585] %
[585] % gcctk -O1 -ftree-vrp -fno-tree-ccp -fno-tree-forwprop small.c
during RTL pass: expand
small.c: In function ‘main’:
small.c:9:12: internal compiler error: in as_a, at machmode.h:381
9 | c = ~h - (-g & f || e);
| ~~~^~~~~~~~~~~~~~~
0x7564c4 scalar_int_mode as_a<scalar_int_mode>(machine_mode)
../../gcc-trunk/gcc/machmode.h:381
0x758382 scalar_int_mode as_a<scalar_int_mode>(machine_mode)
../../gcc-trunk/gcc/tree.h:3669
0x758382 expand_single_bit_test
../../gcc-trunk/gcc/expr.cc:12914
0x758382 do_store_flag
../../gcc-trunk/gcc/expr.cc:13173
0xbbd259 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-trunk/gcc/expr.cc:10251
0xbc4ccd expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-trunk/gcc/expr.cc:10800
0xbc7324 expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
../../gcc-trunk/gcc/expr.h:310
0xbc7324 expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
rtx_def**, expand_modifier)
../../gcc-trunk/gcc/expr.cc:8577
0xbbcd0a expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-trunk/gcc/expr.cc:10591
0xbc4ccd expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-trunk/gcc/expr.cc:10800
0xbbd57a expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
../../gcc-trunk/gcc/expr.cc:8999
0xbbd57a expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
../../gcc-trunk/gcc/expr.h:310
0xbbd57a expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-trunk/gcc/expr.cc:9334
0xbc4ccd expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-trunk/gcc/expr.cc:10800
0xbc733c expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
../../gcc-trunk/gcc/expr.h:310
0xbc733c expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
rtx_def**, expand_modifier)
../../gcc-trunk/gcc/expr.cc:8578
0xbbcd0a expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-trunk/gcc/expr.cc:10591
0xbc4ccd expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-trunk/gcc/expr.cc:10800
0xbc185e expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
../../gcc-trunk/gcc/expr.cc:8999
0xbc185e expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
../../gcc-trunk/gcc/expr.h:310
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[586] %
[586] % cat small.c
int a, b, d;
unsigned c;
int main() {
char e = -10;
int f = 1, g = 0;
if (a) {
char h = e;
i:
c = ~h - (-g & f || e);
int j = b % c;
g = j % 9;
if (c) {
if (d)
e = 0;
while (!g)
;
int k = 0;
l:
if (k)
goto i;
}
}
if (e > -10) {
if (g)
f = 0;
goto l;
}
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
@ 2023-06-04 21:47 ` pinskia at gcc dot gnu.org
2023-06-04 21:57 ` [Bug middle-end/110117] " pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-04 21:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Target Milestone|--- |14.0
Summary|ICE on valid code at -O1 |[14 Regression] ICE on
|with "-ftree-vrp |valid code at -O1 with
|-fno-tree-ccp |"-ftree-vrp -fno-tree-ccp
|-fno-tree-forwprop": in |-fno-tree-forwprop": in
|as_a, at machmode.h:381 |as_a, at machmode.h:381
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Keywords| |ice-on-valid-code
Last reconfirmed| |2023-06-04
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
2023-06-04 21:47 ` [Bug tree-optimization/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381 pinskia at gcc dot gnu.org
@ 2023-06-04 21:57 ` pinskia at gcc dot gnu.org
2023-06-04 22:01 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-04 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
_4 = 0;
_5 = _4 & 1;
_39 = _5 != 0;
The reason why it worked before was that when creating trees, it simplify down
to 0 and then expand that. Now we are expanding directly to rtl, we get:
(const_int 0) for inner and there is no mode associated with that.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
2023-06-04 21:47 ` [Bug tree-optimization/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381 pinskia at gcc dot gnu.org
2023-06-04 21:57 ` [Bug middle-end/110117] " pinskia at gcc dot gnu.org
@ 2023-06-04 22:01 ` pinskia at gcc dot gnu.org
2023-06-04 22:55 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-04 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Anyways imode should just be operand_mode really.
But that does not solve the issue either because extract_bit_field does not
know how to handle const_int :(.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (2 preceding siblings ...)
2023-06-04 22:01 ` pinskia at gcc dot gnu.org
@ 2023-06-04 22:55 ` pinskia at gcc dot gnu.org
2023-06-05 0:06 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-04 22:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was "fixed" by r14-1534-g908e5ab5c11c64 as we don't have a nonzero bits on
_5 in :
# RANGE [irange] int [-2147483647, +INF]
_4 = 0;
_5 = _4 & 1;
_39 = _5 != 0;
Since we don't have a non-zero bits we don't look back at the TER to see it was
&1 and we don't call into expand_single_bit_test .
I am still going to fix expand_single_bit_test to do the correct thing for
const_int but we no longer ICEs in the original testcase.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (3 preceding siblings ...)
2023-06-04 22:55 ` pinskia at gcc dot gnu.org
@ 2023-06-05 0:06 ` pinskia at gcc dot gnu.org
2023-06-05 2:39 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-05 0:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55255
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55255&action=edit
Patch which fixes this
I am going to split this patch into 2, one for the do_store_flag change and one
for the patch which fixes this part. The do_store_flag change is needed to hit
this bug again.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (4 preceding siblings ...)
2023-06-05 0:06 ` pinskia at gcc dot gnu.org
@ 2023-06-05 2:39 ` pinskia at gcc dot gnu.org
2023-06-05 6:04 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-05 2:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simplier testcase:
```
int f()
{
int t = 0;
return (t & 1) != 0;
}
```
Options are:
`-O1 -fno-tree-dominator-opts -fno-tree-vrp -fno-tree-ccp -fno-tree-forwprop
-fno-tree-fre -fno-tree-copy-prop` .
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (5 preceding siblings ...)
2023-06-05 2:39 ` pinskia at gcc dot gnu.org
@ 2023-06-05 6:04 ` pinskia at gcc dot gnu.org
2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-05 6:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2023-June/62
| |0618.html
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted here:
https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620618.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (6 preceding siblings ...)
2023-06-05 6:04 ` pinskia at gcc dot gnu.org
@ 2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-07 3:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:e60593f3881c72a96a3fa4844d73e8a2cd14f670
commit r14-1600-ge60593f3881c72a96a3fa4844d73e8a2cd14f670
Author: Andrew Pinski <apinski@marvell.com>
Date: Sun Jun 4 19:21:05 2023 -0700
Improve do_store_flag for single bit when there is no non-zero bits
In r14-1534-g908e5ab5c11c, I forgot you could turn off CCP or
turn off the bit tracking part of CCP so we would lose out
what TER was able to do before hand. This moves around the
TER code so that it is used instead of just the nonzerobits.
It also makes it easier to remove the TER part of the code
later on too.
OK? Bootstrapped and tested on x86_64-linux-gnu.
Note it reintroduces PR 110117 (which was accidently fixed after
r14-1534-g908e5ab5c11c). The next patch in series will fix that.
gcc/ChangeLog:
* expr.cc (do_store_flag): Rearrange the
TER code so that it overrides the nonzero bits
info if we had `a & POW2`.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (7 preceding siblings ...)
2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
@ 2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
2023-06-07 3:04 ` pinskia at gcc dot gnu.org
2023-06-15 19:11 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-07 3:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:3f085e45755643f13d4fa45a12a6ade45be98f95
commit r14-1601-g3f085e45755643f13d4fa45a12a6ade45be98f95
Author: Andrew Pinski <apinski@marvell.com>
Date: Sun Jun 4 19:42:08 2023 -0700
Handle const_int in expand_single_bit_test
After expanding directly to rtl instead of
creating a tree, we could end up with
a const_int which is not ready to be handled
by extract_bit_field.
So need to the constant folding here instead.
OK? bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR middle-end/110117
gcc/ChangeLog:
* expr.cc (expand_single_bit_test): Handle
const_int from expand_expr.
gcc/testsuite/ChangeLog:
* gcc.dg/pr110117-1.c: New test.
* gcc.dg/pr110117-2.c: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (8 preceding siblings ...)
2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
@ 2023-06-07 3:04 ` pinskia at gcc dot gnu.org
2023-06-15 19:11 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-07 3:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
` (9 preceding siblings ...)
2023-06-07 3:04 ` pinskia at gcc dot gnu.org
@ 2023-06-15 19:11 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-15 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110117
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |19373742 at buaa dot edu.cn
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 110272 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-06-15 19:11 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-04 21:27 [Bug tree-optimization/110117] New: ICE on valid code at -O1 with "": verify_ssa failed zhendong.su at inf dot ethz.ch
2023-06-04 21:47 ` [Bug tree-optimization/110117] [14 Regression] ICE on valid code at -O1 with "-ftree-vrp -fno-tree-ccp -fno-tree-forwprop": in as_a, at machmode.h:381 pinskia at gcc dot gnu.org
2023-06-04 21:57 ` [Bug middle-end/110117] " pinskia at gcc dot gnu.org
2023-06-04 22:01 ` pinskia at gcc dot gnu.org
2023-06-04 22:55 ` pinskia at gcc dot gnu.org
2023-06-05 0:06 ` pinskia at gcc dot gnu.org
2023-06-05 2:39 ` pinskia at gcc dot gnu.org
2023-06-05 6:04 ` pinskia at gcc dot gnu.org
2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
2023-06-07 3:03 ` cvs-commit at gcc dot gnu.org
2023-06-07 3:04 ` pinskia at gcc dot gnu.org
2023-06-15 19:11 ` pinskia 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).