[Bug c++/14639] [3.4/3.5 Regression] [unit-at-a-time] Incorrect emission of unused compiler-generated destructor at -O2

mark at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 23 21:25:00 GMT 2004


------- Additional Comments From mark at codesourcery dot com  2004-03-23 21:25 -------
Subject: Re:  [3.4/3.5 Regression] [unit-at-a-time] Incorrect
 emission of unused compiler-generated destructor at -O2


>I am trying to look into it, but I am not able to figure out testcase
>where the patch above fails.  It should have function that is referenced
>by thunk.  Additionally the thunk needs to be output but the function
>itself does not (if there wasn't the reference from the thunk).  In that
>case I would expect us to fail to see the dependency in between thunk
>and function and not output it at all with the patch applied.
>
>Do you have idea how such testcase shall look like?  I am really not
>very faimiliar with these details of C++ implementation making it
>somewhat dificult to track this down resonably.
>  
>
There are three kinds of entities in play:

(1) Vtables

(2) Virtual functions

(3) Thunks

A vtable is an array, containing pointers to either virtual functions or 
thunks.  Thunks are little stubs that reference a virtual function.  A 
virtual function and its associated thunks are always emitted together.

Are you sure this is a problem with thunks and not with vtables?

In the test case, the object file should be empty.  There are no 
definitions of any functions except for the inline xyz::xyz method, and 
since it is inline it will not be emitted.

I expect that the bug is that cgraph is incorrectly deciding to emit a 
vtable.  Having decided that, you are emitting everything else because 
it is pointed to from the vtable.

The way to solve this problem is to figure out what thing you are 
deciding to output first.  Since the object file should be entirely 
empty, outputting anything at all is a bug.

I've retargeted this at 3.4.0, as not solving this will cause incredible 
amounts of code bloat for C++ applications.



-- 


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



More information about the Gcc-bugs mailing list