[PATCH] Set correct source location for deallocator calls

Richard Henderson rth@redhat.com
Wed Aug 8 15:57:00 GMT 2012


On 08/07/2012 06:25 AM, Richard Guenther wrote:
> (is re-setting _every_ stmt location really ok in all cases?)

I'm certain that it's not, though you can't tell that from C++.

Examine instead a Java test case using try-finally.  In Java the
contents of the finally would be incorrectly relocated from their
original source line to the new line Dehao has decided upon.

I can see the desire for wanting the call to ~t() to appear from 
the return statement.  And for C++ we'll get the correct lines for
the contents of ~t() post inlining (which happens after tree-eh).

But unless the C++ front end uses something like UNKNOWN_LOCATION
on the destructor call, I don't see how we can tell the Java and
C++ cases apart.  And if we can't, then I don't think we can make
this change at all.


r~



More information about the Gcc-patches mailing list