https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100512
Bug ID: 100512 Summary: [12 Regression] ICE during GIMPLE pass: cddce in mark_operand_necessary, at tree-ssa-dce.c:173 (under -O2 to -Os) Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi all. $cat small.c #include <stdint.h> int a; void b() { int16_t *c; uint16_t d = 2; if (0 == d) { uint64_t e; uint64_t *f = &e; for (;;) { if (e += 0 >= 0) for (;;) ; g: for (; a;) { int16_t i = &d; *c = i && *f; } } } goto g; } $gcc -w -O2 during GIMPLE pass: cddce small.c: In function ‘b’: small.c:21:1: internal compiler error: in mark_operand_necessary, at tree-ssa-dce.c:173 21 | } | ^ 0x65b30e mark_operand_necessary ../../gcc/tree-ssa-dce.c:173 0xc86d76 propagate_necessity ../../gcc/tree-ssa-dce.c:852 0xc86d76 perform_tree_ssa_dce ../../gcc/tree-ssa-dce.c:1673 0xc887d5 tree_ssa_cd_dce ../../gcc/tree-ssa-dce.c:1717 0xc887d5 execute ../../gcc/tree-ssa-dce.c:1789 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. tuhaoxin@oscar-2020:~/dut-research/covsmith-test/20210502$ cat small.c #include <stdint.h> int a; void b() { int16_t *c; uint16_t d = 2; if (0 == d) { uint64_t e; uint64_t *f = &e; for (;;) { if (e += 0 >= 0) for (;;) ; g: for (; a;) { int16_t i = &d; *c = i && *f; } } } goto g; } $gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/tuhaoxin/compilers/gcc/build/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/home/tuhaoxin/compilers/gcc/build/ --enable-bootstrap --enable-checking=release --enable-languages=c,c++ -disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210510 (experimental) (GCC) This crash only exists in the current trunk version of GCC, and the released versions perform well. I also tested it on an earlier GCC trunk built on 20210425, it does not crash as well. So I think it's a regression issue in GCC-12. Thanks, Haoxin