Created attachment 50802 [details] auto-reduced testcase (from OpenTTD sources) Compiler output: $ x86_64-pc-linux-gnu-gcc -O3 -ftracer -fno-tree-dominator-opts -fno-tree-fre testcase.C during GIMPLE pass: strlen testcase.C: In function 'void ReadTrackChunk()': testcase.C:43:6: internal compiler error: in size_remaining, at builtins.c:413 43 | void ReadTrackChunk() { | ^~~~~~~~~~~~~~ 0x714a5d access_ref::size_remaining(generic_wide_int<fixed_wide_int_storage<128> >*) const /repo/gcc-trunk/gcc/builtins.c:413 0xe2f36a access_ref::add_offset(generic_wide_int<fixed_wide_int_storage<128> > const&, generic_wide_int<fixed_wide_int_storage<128> > const&) /repo/gcc-trunk/gcc/builtins.c:517 0xe30211 handle_mem_ref /repo/gcc-trunk/gcc/builtins.c:5407 0xe30211 compute_objsize_r /repo/gcc-trunk/gcc/builtins.c:5549 0xe335d2 compute_objsize(tree_node*, int, access_ref*, pointer_query*) /repo/gcc-trunk/gcc/builtins.c:5816 0x1514411 maybe_warn_overflow /repo/gcc-trunk/gcc/tree-ssa-strlen.c:1952 0x151cbe1 maybe_warn_overflow /repo/gcc-trunk/gcc/tree-ssa-strlen.c:2096 0x151cbe1 handle_store /repo/gcc-trunk/gcc/tree-ssa-strlen.c:4788 0x151f4a6 check_and_optimize_stmt /repo/gcc-trunk/gcc/tree-ssa-strlen.c:5426 0x151f4a6 strlen_dom_walker::before_dom_children(basic_block_def*) /repo/gcc-trunk/gcc/tree-ssa-strlen.c:5622 0x1dcfc57 dom_walker::walk(basic_block_def*) /repo/gcc-trunk/gcc/domwalk.c:309 0x1514f1e printf_strlen_execute /repo/gcc-trunk/gcc/tree-ssa-strlen.c:5688 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.
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570236.html
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>: https://gcc.gnu.org/g:5380e3c137b2bb63acd789cd09d01a4edc0a01c3 commit r12-784-g5380e3c137b2bb63acd789cd09d01a4edc0a01c3 Author: Martin Sebor <msebor@redhat.com> Date: Thu May 13 16:20:45 2021 -0600 PR middle-end/100574 - ICE in size_remaining, at builtins.c gcc/ChangeLog: PR middle-end/100574 * builtins.c (access_ref::get_ref): Improve detection of PHIs with all null arguments.
Fixed on trunk.
The releases/gcc-11 branch has been updated by Martin Sebor <msebor@gcc.gnu.org>: https://gcc.gnu.org/g:11133f8f113e4591a2a5c9e61d810b9e5931043e commit r11-8601-g11133f8f113e4591a2a5c9e61d810b9e5931043e Author: Martin Sebor <msebor@redhat.com> Date: Thu Jun 17 10:32:00 2021 -0600 Bacported from trunk: PR middle-end/100574 - ICE in size_remaining, at builtins.c gcc/ChangeLog: PR middle-end/100574 * builtins.c (access_ref::get_ref): Improve detection of PHIs with all null arguments. gcc/testsuite/ChangeLog: PR middle-end/100574 * g++.dg/pr100574.C: New test.
Backported to GCC 11.2.