https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101290
Bug ID: 101290 Summary: ICE with -O1 on valid code: in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:5976 Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: cnsun at uwaterloo dot ca Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/configure --enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch --prefix=/scratch/software/gcc-trunk --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210701 (experimental) [master revision :b1f5e3e73:a688c284dd3848b6c4ea553035f0f9769fb4fbc9] (GCC) $ cat mutant.c typedef *a; typedef struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { unsigned b, c, d, e } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, d, e, f } b, c, f } * g; int h; struct i k; struct i { a j } l(struct i *m) { *(volatile *)&((g)m->j)->f; } n() { k.j = &h; l(&k); } $ gcc-trunk -w -O1 mutant.c during GIMPLE pass: copyprop mutant.c: In function ānā: mutant.c:66:1: internal compiler error: in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:5976 66 | n() { | ^ 0x6def4a maybe_canonicalize_mem_ref_addr /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/gimple-fold.c:5976 0xc1f18a fold_stmt_1 /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/gimple-fold.c:6085 0x10db4c6 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*) /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/tree-ssa-propagate.c:853 0x194d647 dom_walker::walk(basic_block_def*) /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/domwalk.c:309 0x10da869 substitute_and_fold_engine::substitute_and_fold(basic_block_def*) /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/tree-ssa-propagate.c:987 0x104726a fini_copy_prop /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/tree-ssa-copy.c:566 0x104726a execute_copy_prop /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/tree-ssa-copy.c:619 0x104726a execute /tmp/tmp.66z1mEqhUB-gcc-builder/gcc/gcc/tree-ssa-copy.c:649 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.