http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51900

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |ktietz at gcc dot gnu.org

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 
15:01:28 UTC ---
Ugh.  I think this is a bug in the way i386_pe_binds_local_p implements
the binds_local target macro:

bool
i386_pe_binds_local_p (const_tree exp)
{
  /* PE does not do dynamic binding.  Indeed, the only kind of
     non-local reference comes from a dllimport'd symbol.  */
  if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
      && DECL_DLLIMPORT_P (exp))
    return false;

  /* Or a weak one, now that they are supported.  */
  if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
      && DECL_WEAK (exp))
    return false;

  return true;
}

It's completely bogus to return true at the end - you have to do

  return default_binds_local_p (exp);

to get even slightly correct/optimal handling.  Thus, confirmed as a target
issue.

Reply via email to