This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/37473] New: typedef results in wrong function call linkage


The following testcase compiled with -O -fPIC results in a non-PLT call to
A::check.  On x86_64 that means an R_X86_64_PC32 reloc, which the linker later
correctly complains about if we are building a shared library.  Curiously, if
either or both of the typedefs are removed, you get the code I'd expect.

typedef struct
{
  int check ();
} A;

typedef struct
{
  A a;
  int validate ();
private:
  int check ();
} B;

int
B::check ()
{
  return a.check ();
}

int
B::validate ()
{
  return check ();
}

int
doit ()
{
  B b;
  return b.validate ();
}


-- 
           Summary: typedef results in wrong function call linkage
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at bigpond dot net dot au
GCC target triplet: x86_64-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]