[Bug c++/14639] New: Incorrect emission of unused compiler-generated destructor at -O2
Mark Mitchell
mark@codesourcery.com
Mon Mar 22 15:31:00 GMT 2004
> So when the function itself gets marked as necesary we automatically
> emit the thunk when the mark_used_thunk has been called, right?
Yes. Whenever a function is emittted, so are all of its associated thunks.
> I guess we need two thinks - we need to manage that once we discover
> thunk to be necesary we need to mark the function it is refering to and
> we need to emit thunks iff they are really reachable (not just used,
> right)?
Yes.
> It would be ideal if the thunk was behaving like ordinary function, but
> for some reason it is not. Is there way to recognize thunk in C++
> independent way?
No. But, you could always change things so that was possible, I
suppose. Thunks cannot be represented as ordinary functions until we
have multiple entry points, and we don't yet have that.
> I guess we will need kind of hooks - tell cgraph code that given decl is
> thunk and thunk is like function but not quite as it has no body and
> reffers to other function and it is not necesay to assemble it as it
> gets assembled magically with the function body.
Yes.
> Hmm, perhaps I am getting overzelaous here (hope so). I am not quite
> sure how emit_p works. When the emit_p is set? If it is at function
> expansion time, it is too late - we need to be finished this in advance.
emit_p is set from emit_associated_thunks, which is called for a
function's thunks right before the function itself is sent to
tree_rest_of_compilation.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
More information about the Gcc-bugs
mailing list