From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AD423858D32; Sat, 14 May 2022 20:20:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AD423858D32 From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/105604] New: [10/11/12 Regression] ICE: in tree_to_shwi, at tree.cc:6369 Date: Sat, 14 May 2022 20:20:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org 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: Sat, 14 May 2022 20:20:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105604 Bug ID: 105604 Summary: [10/11/12 Regression] ICE: in tree_to_shwi, at tree.cc:6369 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Originally reported by cpu in https://bugs.gentoo.org/844091. Here is my attempt at minimizing it: //$ cat main.c struct { long users; long size; char *data; } * main_trans; void *main___trans_tmp_1; int sprintf(char *, char *, ...); int main() { int users =3D 0; struct { long users; long size; char *data; int links[users]; char buf[]; } *trans =3D trans; trans->data =3D trans->buf; main___trans_tmp_1 =3D trans; main_trans =3D main___trans_tmp_1; sprintf(main_trans->data, "test"); } $ /tmp/gb/gcc/xgcc -B/tmp/gb/gcc -c -Wall -O2 -pipe -fomit-frame-pointer ma= in.c during GIMPLE pass: strlen main.c: In function =E2=80=98main=E2=80=99: main.c:8:5: internal compiler error: in tree_to_shwi, at tree.cc:6369 8 | int main() { | ^~~~ 0x1116ade tree_to_shwi(tree_node const*) gcc/tree.cc:6369 0x1116b36 int_byte_position(tree_node const*) gcc/tree.cc:3616 0x1cd1ce8 get_origin_and_offset_r gcc/gimple-ssa-sprintf.cc:2354 0x1cd1845 get_origin_and_offset_r gcc/gimple-ssa-sprintf.cc:2307 0x1cd1f29 get_origin_and_offset_r gcc/gimple-ssa-sprintf.cc:2370 0x1cd64ce get_origin_and_offset gcc/gimple-ssa-sprintf.cc:2427 0x1cd64ce handle_printf_call(gimple_stmt_iterator*, pointer_query&) gcc/gimple-ssa-sprintf.cc:4703 0x103ff10 strlen_pass::check_and_optimize_call(bool*) gcc/tree-ssa-strlen.cc:5461 0x103ffb3 strlen_pass::check_and_optimize_stmt(bool*) gcc/tree-ssa-strlen.cc:5665 0x1040326 strlen_pass::before_dom_children(basic_block_def*) gcc/tree-ssa-strlen.cc:5849 0x1c5d56b dom_walker::walk(basic_block_def*) gcc/domwalk.cc:309 0x10409cf printf_strlen_execute gcc/tree-ssa-strlen.cc:5908 0x1040c58 execute gcc/tree-ssa-strlen.cc:6007 I seem to be able to reproduce ICE on: 10.3.0, 11.3.0, 12.1.0. This does not ICE: 9.3.0 $ /tmp/gb/gcc/xgcc -B/tmp/gb/gcc -v Reading specs from /tmp/gb/gcc/specs COLLECT_GCC=3D/tmp/gb/gcc/xgcc COLLECT_LTO_WRAPPER=3D/tmp/gb/gcc/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib --disable-bootstrap --with-native-system-header-dir=3D/<>/glibc-2.34-115-dev/include --prefix=3D/tmp/gb/__td__ CFLAGS=3D'-O1 -ggdb3' CXXFLAGS=3D'-O1 -ggdb3' LDF= LAGS=3D'-O1 -ggdb3' Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20220514 (experimental) (GCC)=