public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
@ 2022-02-26 14:18 zhendong.su at inf dot ethz.ch
  2022-02-26 14:19 ` [Bug tree-optimization/104700] " zhendong.su at inf dot ethz.ch
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-02-26 14:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

            Bug ID: 104700
           Summary: ICE on valid code at -O2 and -O3 with -fno-tree-ccp
                    -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in
                    find_or_generate_expression, at tree-ssa-pre.cc:2795
           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.

[627] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220226 (experimental) [master r12-7395-gafeaaf4b352] (GCC)
[628] %
[628] % gcctk -O2 -fno-tree-ccp -fno-tree-dce -fno-tree-vrp small.c
during GIMPLE pass: pre
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in find_or_generate_expression, at
tree-ssa-pre.cc:2795
    2 | int main() {
      |     ^~~~
0x1005c10 find_or_generate_expression
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2795
0x1005132 create_expression_by_pieces
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2951
0x10095b1 insert_into_preds_of_block
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3159
0x100b134 do_pre_regular_insertion
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3416
0x100b134 insert
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3809
0x100b134 execute
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:4433
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.
[629] %
[629] % cat small.c
int a, b;
int main() {
  int c = 2, d, e = 0;
  if (a)
    e = 2;
  int f, g = -(1L | (e && f && f & e));
  if (g)
  L:
    g = c;
  c = 0;
  d = e * g;
  if (d)
    goto L;
  while (e) {
    int i = (a && b) * i;
  }
  return 0;
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
@ 2022-02-26 14:19 ` zhendong.su at inf dot ethz.ch
  2022-02-26 14:27 ` [Bug tree-optimization/104700] [12 Regression] " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-02-26 14:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
>From Compiler Explorer: https://godbolt.org/z/PKfrMK489

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
  2022-02-26 14:19 ` [Bug tree-optimization/104700] " zhendong.su at inf dot ethz.ch
@ 2022-02-26 14:27 ` jakub at gcc dot gnu.org
  2022-02-26 19:38 ` zhendong.su at inf dot ethz.ch
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-26 14:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|ICE on valid code at -O2    |[12 Regression] ICE on
                   |and -O3 with -fno-tree-ccp  |valid code at -O2 and -O3
                   |-fno-tree-dce -fno-tree-vrp |with -fno-tree-ccp
                   |on x86_64-linux-gnu: in     |-fno-tree-dce -fno-tree-vrp
                   |find_or_generate_expression |on x86_64-linux-gnu: in
                   |, at tree-ssa-pre.cc:2795   |find_or_generate_expression
                   |                            |, at tree-ssa-pre.cc:2795
   Last reconfirmed|                            |2022-02-26
     Ever confirmed|0                           |1
            Version|unknown                     |12.0
   Target Milestone|---                         |12.0
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
           Priority|P3                          |P1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r12-7389-ge25dce501334053239dcc433e4c46ecbddbcb13e

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
  2022-02-26 14:19 ` [Bug tree-optimization/104700] " zhendong.su at inf dot ethz.ch
  2022-02-26 14:27 ` [Bug tree-optimization/104700] [12 Regression] " jakub at gcc dot gnu.org
@ 2022-02-26 19:38 ` zhendong.su at inf dot ethz.ch
  2022-02-28  7:09 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-02-26 19:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #3 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another test without using "-fno-tree-ccp -fno-tree-dce -fno-tree-vrp":

[700] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220226 (experimental) [master r12-7395-gafeaaf4b352] (GCC)
[701] %
[701] % gcctk -O2 small.c
during GIMPLE pass: pre
small.c: In function ‘o’:
small.c:3:6: internal compiler error: in find_or_generate_expression, at
tree-ssa-pre.cc:2795
    3 | void o() {
      |      ^
0x1005c10 find_or_generate_expression
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2795
0x1005132 create_expression_by_pieces
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2951
0x10095b1 insert_into_preds_of_block
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3159
0x100b134 do_pre_regular_insertion
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3416
0x100b134 insert
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:3809
0x100b134 execute
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:4433
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.
[702] %
[702] % cat small.c
int printf(const char *, ...);
int a, b, c = 2, d, e, *f, g;
void o() {
  unsigned h = 1;
  int j = -1, k, l = 1, m = 2, i;
  while (c < 2)
    ;
L1:
  k = h;
  h = -1;
  if (k < 2 && !c) {
    printf("%d", k);
    goto L1;
  }
  if (!j)
    l = printf("0");
  if (g)
    k = 0;
  if (a && k)
    goto L2;
  while (f) {
    m = a;
    d = i;
    i = e;
    f = &j;
  L2:
    if (d == l && !m)
      l = b;
  }
  unsigned *n[1] = {&h};
}
int main() {
  o();
  return 0;
}


------


>From Compiler Explorer: https://godbolt.org/z/b9z9e71oh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2022-02-26 19:38 ` zhendong.su at inf dot ethz.ch
@ 2022-02-28  7:09 ` rguenth at gcc dot gnu.org
  2022-02-28  7:20 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-28  7:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

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 #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thanks for the testcases.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2022-02-28  7:09 ` rguenth at gcc dot gnu.org
@ 2022-02-28  7:20 ` marxin at gcc dot gnu.org
  2022-02-28  7:51 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-28  7:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. I see the same ICE on libreoffice.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2022-02-28  7:20 ` marxin at gcc dot gnu.org
@ 2022-02-28  7:51 ` rguenth at gcc dot gnu.org
  2022-02-28  9:34 ` cvs-commit at gcc dot gnu.org
  2022-02-28  9:39 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-28  7:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fix in testing.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2022-02-28  7:51 ` rguenth at gcc dot gnu.org
@ 2022-02-28  9:34 ` cvs-commit at gcc dot gnu.org
  2022-02-28  9:39 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-28  9:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #7 from CVS 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:37b583b9d7719f663656ce65ac822c11471fb540

commit r12-7408-g37b583b9d7719f663656ce65ac822c11471fb540
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Feb 28 08:36:25 2022 +0100

    tree-optimization/104700 - adjust constant handling in PRE

    The following refactors find_or_generate_expression to more properly
    handle constant valued SSA names thereby simplifying the code and
    avoiding ICEing after the last change to NARY processing.

    2022-02-28  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/104700
            * tree-ssa-pre.cc (get_or_alloc_expr_for): Remove and inline
            into ...
            (find_or_generate_expression): ... here, simplifying code.

            * gcc.dg/pr104700-2.c: New testcase.
            * gcc.dg/torture/pr104700-1.c: Likewise.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795
  2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
                   ` (6 preceding siblings ...)
  2022-02-28  9:34 ` cvs-commit at gcc dot gnu.org
@ 2022-02-28  9:39 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-28  9:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-02-28  9:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-26 14:18 [Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795 zhendong.su at inf dot ethz.ch
2022-02-26 14:19 ` [Bug tree-optimization/104700] " zhendong.su at inf dot ethz.ch
2022-02-26 14:27 ` [Bug tree-optimization/104700] [12 Regression] " jakub at gcc dot gnu.org
2022-02-26 19:38 ` zhendong.su at inf dot ethz.ch
2022-02-28  7:09 ` rguenth at gcc dot gnu.org
2022-02-28  7:20 ` marxin at gcc dot gnu.org
2022-02-28  7:51 ` rguenth at gcc dot gnu.org
2022-02-28  9:34 ` cvs-commit at gcc dot gnu.org
2022-02-28  9:39 ` 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).