https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121936

--- Comment #21 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The issue occurs because of return value range propagation (i.e. in
the direction from callees to callers, which happens without cloning).

The code (in ipa_return_value_range) already correctly queries the
availability (in this case of check_arg_1_value).  However (assuming
this is indeed a bug), it gets wrong availability information from
ultimate_alias_target.

The incorrect availability is determined in
cgraph_node::get_availability which I believe has two problems:

First, it uses externally_visible flag before it is actually computed.

Second, the following optimism about inline functions seems to be
wrong:

  /* Inline functions are safe to be analyzed even if their symbol can
     be overwritten at runtime.  It is not meaningful to enforce any sane
     behavior on replacing inline function by different body.  */
  else if (DECL_DECLARED_INLINE_P (decl))
    avail = AVAIL_AVAILABLE;


(As an experiment, commenting out the first issue and changing the
latter to be pessimistic instead makes the issue go away.)

Reply via email to