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

            Bug ID: 64146
           Summary: [5 Regression] ipa-icf breaks gold dynamic_test_2 test
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amodra at gmail dot com

gold/testsuite/dynamic_list_lib2.cc contains the following:

extern "C" const char*
foo()
{
  return "original";
}

const char*
test_foo()
{
  return foo();
}

extern "C" const char*
bar()
{
  return "original";
}

const char*
test_bar()
{
  return bar();
}

As you can see (and icf sees!) foo and bar are identical, and it seems test_foo
and test_bar are also identical but they are not.  Code emitted for foo is "jmp
bar".  This is fine.  Code emitted for _Z8test_foov is "jmp _Z8test_barv". 
This is *not* OK.  foo and/or bar may be overridden at runtime when this code
is compiled into a shared library, so the call to bar in test_bar might not go
to the local bar, and similarly for the call to foo in test_foo.

Reply via email to