Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 580298

Summary: sys-devel/gcc-5 bugs with -fdevirtualize
Product: Gentoo Linux Reporter: Tupone Alfredo <tupone>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED NEEDINFO    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Tupone Alfredo gentoo-dev 2016-04-17 08:35:25 UTC
See bug #571274

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2016-04-17 16:29:39 UTC
please a reduced description of the issue and the fix you deployed
Comment 2 Tupone Alfredo gentoo-dev 2016-04-17 18:11:09 UTC
Probably gcc is confused when getting a virtual method with a sort of inline.

What gcc does is in this case is not defining the body of the virtual function, but requiring the entry in the virtual table.

And during link it raise
undefined reference to non-virtual thunk to csImageMemory::GetImageData()

My fix is in this case defining the body of the method in a cpp file and not in the header.

e.g.

I changed 
virtual const void* GetImageData () { return GetImagePtr (); }
in the header with 
virtual const void* GetImageData ();
and add 
const void* csImageMemory::GetImageData ()
{
  return GetImagePtr ();
}
in the body.