[cfe-dev] GCC's "Temporaries May Vanish Before You Expect"

Richard Smith richard at metafoo.co.uk
Wed Sep 12 16:59:13 PDT 2012


On Wed, Sep 12, 2012 at 4:55 PM, Jordan Rose <jordan_rose at apple.com> wrote:

>
> On Sep 12, 2012, at 16:50 , Richard Smith <richard at metafoo.co.uk> wrote:
>
> On Wed, Sep 12, 2012 at 4:32 PM, Jordan Rose <jordan_rose at apple.com>wrote:
>
>
>> >> The second way is if -fcatch-undefined-behavior could be augmented to
>> handle this case. I have no idea how to do this, though -- perhaps it
>> requires something ASan-ish to poison the temporary memory once its
>> lifetime ends.
>>  >>
>> >> Any chance of either of these happening on trunk?
>>
>
> We'd want to wait until the end of the storage duration rather than the
> end of the lifetime of the object, but yes, we could do that (for instance,
> we could emit llvm lifetime intrinsics for all local variables, and teach
> ASan to poison memory based on them).
>
>
> Well, I'm not entirely sure what you mean by this, but AFAICT the issue is
> that GCC thinks the storage duration ends sooner than we think it does.
>

The issue is that GCC is more aggressive about reusing storage than we are.
We're not miscomputing the storage duration somewhere, we just don't bother
to model it in the IR at all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120912/1b98ecd6/attachment.html>


More information about the cfe-dev mailing list