From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 49F413858411; Wed, 25 Aug 2021 08:29:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49F413858411 From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102057] New: ICE at -O2 in extract_constrain_insn, at recog.c:2670 Date: Wed, 25 Aug 2021 08:29:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: haoxintu at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2021 08:29:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102057 Bug ID: 102057 Summary: ICE at -O2 in extract_constrain_insn, at recog.c:2670 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi all. This program makes GCC ICE. I think this program is syntactically valid and= GCC should not emit any error. I found there are many fixed PRs that crash at t= he same point "recog.c:2670" and similar stack information. So, I am not sure = if this is a dup case, and please kindly close it if it is. $cat small.c #include extern n(int f); a, b, c, d, e, f, g, i; fn1(int64_t j, uint16_t k) { uint64_t *l =3D c; int8_t m; if (n(f)) if (*l) { int8_t o; uint16_t *p =3D &k; if (i) { int64_t q =3D e; if (q) for (; *p <=3D 5; k +=3D o) ; } } e =3D 8; while (e--) { a =3D 7; while (a) { a -=3D 5; if (i) if (5 << m) while (i) i +=3D 4; for (; b;) ; } } int32_t r; g =3D (d ? k : m) >> (r =3D 2) ?: 3; for (; *l; l +=3D f++) { int64_t *s; if (*s) for (; j;) if (0 / 0) for (;;) ; } } $gcc -O2 -w -fPIC small.c small.c: In function =E2=80=98fn1=E2=80=99: small.c:41:1: error: insn does not satisfy its constraints: 41 | } | ^ (insn 429 394 430 22 (parallel [ (set (reg:CCZ 17 flags) (compare:CCZ (ashiftrt:SI (reg:SI 0 ax [orig:90 _12 ] [90]) (const_int 2 [0x2])) (const_int 0 [0]))) (set (reg:SI 41 r13 [orig:137 k ] [137]) (ashiftrt:SI (reg:SI 0 ax [orig:90 _12 ] [90]) (const_int 2 [0x2]))) ]) "small.c":32:31 740 {*ashrsi3_cmp} (expr_list:REG_DEAD (reg:SI 0 ax [orig:90 _12 ] [90]) (nil))) during RTL pass: cprop_hardreg small.c:41:1: internal compiler error: in extract_constrain_insn, at recog.c:2670 0x681355 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) ../../gcc/rtl-error.c:108 0x68137b _fatal_insn_not_found(rtx_def const*, char const*, int, char const= *) ../../gcc/rtl-error.c:118 0x680484 extract_constrain_insn(rtx_insn*) ../../gcc/recog.c:2670 0xb738ce copyprop_hardreg_forward_1 ../../gcc/regcprop.c:825 0xb7481d execute ../../gcc/regcprop.c:1390 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. $gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/home/haoxin/haoxin-data/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=3D/home/haoxin/haoxin-data/compilers/gcc/build/ --enable-bootstrap --enable-checking=3Drelease --enable-languages=3Dc,c++ --enable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210825 (experimental) (GCC) Reproduced in Godbol: https://godbolt.org/z/EfMa7zrcj Thanks, Haoxin=