From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0935B385803D; Fri, 30 Apr 2021 08:26:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0935B385803D From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100349] New: [11/12 Regression] ICE Segmentation fault during GIMPLE pass: evrp (under -O2 to -Os) Date: Fri, 30 Apr 2021 08:26:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: 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 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: Fri, 30 Apr 2021 08:26:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100349 Bug ID: 100349 Summary: [11/12 Regression] ICE Segmentation fault during GIMPLE pass: evrp (under -O2 to -Os) Product: gcc Version: 12.0 Status: UNCONFIRMED 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 uint8_t a; b(int8_t c) { int d; e: uint32_t f; for (;;) for (c =3D 10; c; c++) if (0 > (a =3D c) ?: d) { f =3D a; goto e; } } $gcc -w -O2 small.c during GIMPLE pass: evrp small.c: In function =E2=80=98b=E2=80=99: small.c:13:1: internal compiler error: Segmentation fault 13 | } | ^ 0xb9ec1f crash_signal ../../gcc/toplev.c:327 0xe5a92b bounds_of_var_in_loop(tree_node**, tree_node**, range_query*, loop= *, gimple*, tree_node*) ../../gcc/vr-values.c:1658 0x146fa91 gimple_ranger::range_of_ssa_name_with_loop_info(irange&, tree_nod= e*, loop*, gphi*) ../../gcc/gimple-range.cc:1220 0x146fd83 gimple_ranger::range_of_phi(irange&, gphi*) ../../gcc/gimple-range.cc:568 0x147017d gimple_ranger::calc_stmt(irange&, gimple*, tree_node*) ../../gcc/gimple-range.cc:376 0x14704a1 gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*) ../../gcc/gimple-range.cc:1068 0x146c040 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*) ../../gcc/gimple-range.cc:960 0xe1a0e1 range_query::value_of_expr(tree_node*, gimple*) ../../gcc/value-query.cc:86 0x147a6f1 hybrid_folder::value_of_expr(tree_node*, gimple*) ../../gcc/gimple-ssa-evrp.c:235 0xcf836d substitute_and_fold_dom_walker::before_dom_children(basic_block_de= f*) ../../gcc/tree-ssa-propagate.c:1072 0x14482d7 dom_walker::walk(basic_block_def*) ../../gcc/domwalk.c:309 0xcf7a35 substitute_and_fold_engine::substitute_and_fold(basic_block_def*) ../../gcc/tree-ssa-propagate.c:1283 0x147a366 execute_early_vrp ../../gcc/gimple-ssa-evrp.c:349 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/tuhaoxin/compilers/gcc/build-20210425/libexec/g= cc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=3D/home/tuhaoxin/compilers/gcc/build-20210425/ --enable-bootstrap --enable-checking=3Drelease --enable-languages=3Dc,c++ --enable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210425 (experimental) (GCC)=20 This issue may start from one of the commits in GCC-11, and it's performed = well in released GCC-10.3.0 downwards versions. Another weird behavior is that this code is accepted under -O1 in GCC-11 and GCC-12 while rejected in other released GCC versions. I guess there might b= e a problem here? Reproduced in Godbolt: https://godbolt.org/z/E7K9Ghjcc Thanks Haoxin=