Bug 106521 - [13 Regression] ICE at -O1 with "-floop-unroll-and-jam --param unroll-jam-min-percent=0": verify_ssa failed since r13-1450-gd2a898666609452e
Summary: [13 Regression] ICE at -O1 with "-floop-unroll-and-jam --param unroll-jam-min...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: 13.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-03 22:44 UTC by Zhendong Su
Modified: 2022-08-04 13:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-08-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2022-08-03 22:44:42 UTC
It appears to be a recent regression (and possibly related to PR106249).

Compiler Explorer: https://godbolt.org/z/Tanf9axav


[545] % 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/13.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 --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220803 (experimental) [master r13-1950-g9bb19e143cf] (GCC) 
[546] % 
[546] % gcctk -O1 -floop-unroll-and-jam --param unroll-jam-min-percent=0 small.c
small.c: In function ‘main’:
small.c:4:5: error: definition in block 30 does not dominate use in block 33
    4 | int main() {
      |     ^~~~
for SSA_NAME: b_lsm.15_82 in statement:
b_lsm.15_23 = PHI <b_lsm.15_8(22), b_lsm.15_82(33)>
PHI argument
b_lsm.15_82
for PHI node
b_lsm.15_23 = PHI <b_lsm.15_8(22), b_lsm.15_82(33)>
during GIMPLE pass: unrolljam
small.c:4:5: internal compiler error: verify_ssa failed
0x11356ef verify_ssa(bool, bool)
	../../gcc-trunk/gcc/tree-ssa.cc:1211
0x105fb5b rewrite_into_loop_closed_ssa_1
	../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:576
0x105fb5b rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int)
	../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:626
0x1c94c2d tree_loop_unroll_and_jam
	../../gcc-trunk/gcc/gimple-loop-jam.cc:612
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.
[547] % 
[547] % cat small.c
short a, b, e;
volatile long c;
long d;
int main() {
  for (; d; d++) {
    long g = a = 1;
    for (; a; a++) {
      g++;
      c;
    }
    g && (b = e);
  }
  return 0;
}
Comment 1 Martin Liška 2022-08-04 07:37:41 UTC
Started with r13-1450-gd2a898666609452e.
Comment 2 Richard Biener 2022-08-04 09:36:23 UTC
Mine.
Comment 3 GCC Commits 2022-08-04 13:01:54 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:d8552eaddc40b72461158e56b5db8709f2eb21ed

commit r13-1961-gd8552eaddc40b72461158e56b5db8709f2eb21ed
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Aug 4 11:55:15 2022 +0200

    tree-optimization/106521 - unroll-and-jam LC SSA rewrite
    
    The LC SSA rewrite performs SSA verification at start but the VN
    run performed on the unrolled-and-jammed body can leave us with
    invalid SSA form until CFG cleanup is run.  So make sure we do that
    before rewriting into LC SSA.
    
            PR tree-optimization/106521
            * gimple-loop-jam.cc (tree_loop_unroll_and_jam): Perform
            CFG cleanup manually before rewriting into LC SSA.
    
            * gcc.dg/torture/pr106521.c: New testcase.
Comment 4 Richard Biener 2022-08-04 13:02:22 UTC
Fixed.