https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105726
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Blocks| |56456 Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2022-05-25 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. At -O1 emitted by the warn_restrict pass on <bb 2> [local count: 1073741824]: _3 = &MEM[(const struct array *)aMessage_1(D) + 4B]._M_elems; strncpy (aBuffer_4(D), _3, 1); return; <addr_expr 0x7ffff5d83c00 type <pointer_type 0x7ffff5d86e70 type <array_type 0x7ffff5d86dc8 _Type type <integer_type 0x7ffff6544540 char> type_6 QI size <integer_cst 0x7ffff653a048 constant 8> unit-size <integer_cst 0x7ffff653a060 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff5d86d20 domain <integer_type 0x7ffff6542c78> pointer_to_this <pointer_type 0x7ffff5d86e70>> unsigned DI size <integer_cst 0x7ffff6517f48 constant 64> unit-size <integer_cst 0x7ffff6517f60 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff5d86f18> readonly arg:0 <component_ref 0x7ffff5d50bd0 type <array_type 0x7ffff5d862a0 type <integer_type 0x7ffff65383f0 char> readonly type_6 QI size <integer_cst 0x7ffff653a048 8> unit-size <integer_cst 0x7ffff653a060 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff5d862a0 domain <integer_type 0x7ffff6542c78>> readonly arg:0 <mem_ref 0x7ffff5d891e0 type <record_type 0x7ffff5d7f888 array> arg:0 <ssa_name 0x7ffff5cf84c8 type <reference_type 0x7ffff5d86888> visited var <parm_decl 0x7ffff5d85400 aMessage> def_stmt GIMPLE_NOP version:1 ptr-info 0x7ffff5d7b8e8> arg:1 <integer_cst 0x7ffff5d7b7c8 constant 4>> arg:1 <field_decl 0x7ffff5d7c720 _M_elems type <array_type 0x7ffff5d7ddc8 _Type> I think the pass mis-analyzes the reference. Let me have a look. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds