https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92765
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #12)
> The __builtin_strcmp(ptr->header.magic, "x") call in comment #0 is undefined
> because the two-element array ptr->header.magic is not a nul-terminated
> string. The warning was designed to point that out.
If so, the warning needs to be done early. And it shouldn't affect code
generation.
See e.g. tree-ssa-sccvn.c:
/* Probibit value-numbering zero offset components
of addresses the same before the pass folding
__builtin_object_size had a chance to run
(checking cfun->after_inlining does the
trick here). */
if (TREE_CODE (orig) != ADDR_EXPR
|| maybe_ne (off, 0)
|| cfun->after_inlining)
off.to_shwi (&temp.off);
I'm surprised non-zero offs can be handled this way even before objsz1 pass,
before that we really should consider the same only if the offset is the same
and FIELD_DECLs type has the same size, but we could have some cfun flag or
property set by objsz1 pass. That said, after that what COMPONENT_REFs are
used in ADDR_EXPR needs to be ignored.