Bug 100519 - [11 Regression] ICE in insert_stmt_after, at tree-ssa-reassoc.c:1452
Summary: [11 Regression] ICE in insert_stmt_after, at tree-ssa-reassoc.c:1452
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P2 normal
Target Milestone: 11.2
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-11 12:39 UTC by Martin Liška
Modified: 2021-05-25 08:08 UTC (History)
0 users

See Also:
Host: x86_64-linux-gnu
Target: s390x-linux-gnu
Build:
Known to work: 11.1.1, 12.0
Known to fail: 11.1.0
Last reconfirmed: 2021-05-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2021-05-11 12:39:31 UTC
The following fails, likely a recent regression:

$ cat asmgoto.c
int foo_a1, foo_a2;

int foo() {
  int v0, x;
  asm goto("" : "=r"(x) : : : lab);
lab:
  v0 += x + x;
  return v0 + x + foo_a1 + foo_a2;
}

$ s390x-linux-gnu-gcc asmgoto.c -fwrapv --param=tree-reassoc-width=2 -O2
during GIMPLE pass: reassoc
asmgoto.c: In function ‘foo’:
asmgoto.c:4:5: internal compiler error: in insert_stmt_after, at tree-ssa-reassoc.c:1452
    4 | int foo() {
      |     ^~~
0x5c5300 insert_stmt_after
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:1452
0xc51ad4 build_and_add_sum
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:1517
0xc51e39 rewrite_expr_tree_parallel
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:5396
0xc621f7 reassociate_bb
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:6682
0xc5fde8 reassociate_bb
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:6743
0xc62b6c do_reassoc
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:6855
0xc62b6c execute_reassoc
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:6942
0xc62b6c execute
	/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/tree-ssa-reassoc.c:6981
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Richard Biener 2021-05-11 12:45:41 UTC
Hmm, my can_reassociate_p patch isn't enough to fend of asm goto defs...  Will have to look again for a suitable place to check this :/
Comment 2 GCC Commits 2021-05-12 11:13:02 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r12-745-gcd36bbb2281ada10b5e1df143ecf64b88cdb8119
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 14:59:59 2021 +0200

    tree-optimization/100519 - avoid reassociating asm goto defs
    
    This splits can_associate_p into checks for SSA defs and checks
    for the type so it can be called from is_reassociable_op to
    catch cases not catched by the earlier fix.
    
    2021-05-11  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/100519
            * tree-ssa-reassoc.c (can_associate_p): Split into...
            (can_associate_op_p): ... this
            (can_associate_type_p): ... and this.
            (is_reassociable_op): Call can_associate_op_p.
            (break_up_subtract_bb): Call the appropriate predicates.
            (reassociate_bb): Likewise.
    
            * gcc.dg/torture/pr100519.c: New testcase.
Comment 3 Richard Biener 2021-05-12 11:14:10 UTC
Fixed on trunk sofar.
Comment 4 GCC Commits 2021-05-25 08:07:29 UTC
The releases/gcc-11 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r11-8465-gedd7bbe0e96a0d45d6ae142c5809ef1cae6c0999
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 14:59:59 2021 +0200

    tree-optimization/100519 - avoid reassociating asm goto defs
    
    This splits can_associate_p into checks for SSA defs and checks
    for the type so it can be called from is_reassociable_op to
    catch cases not catched by the earlier fix.
    
    2021-05-11  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/100519
            * tree-ssa-reassoc.c (can_associate_p): Split into...
            (can_associate_op_p): ... this
            (can_associate_type_p): ... and this.
            (is_reassociable_op): Call can_associate_op_p.
            (break_up_subtract_bb): Call the appropriate predicates.
            (reassociate_bb): Likewise.
    
            * gcc.dg/torture/pr100519.c: New testcase.
    
    (cherry picked from commit cd36bbb2281ada10b5e1df143ecf64b88cdb8119)
Comment 5 Richard Biener 2021-05-25 08:08:23 UTC
Fixed.