[patch] Fix pr22849

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Mar 10 19:42:17 PDT 2015


Reduced from the Linux kernel.
On Mar 10, 2015 9:49 PM, "Richard Smith" <richard at metafoo.co.uk> wrote:

> On Tue, Mar 10, 2015 at 6:20 PM, Reid Kleckner <rnk at google.com> wrote:
>
>> On Tue, Mar 10, 2015 at 6:02 PM, John McCall <rjmccall at apple.com> wrote:
>>
>>> > On Mar 9, 2015, at 3:05 PM, Rafael EspĂ­ndola <
>>> rafael.espindola at gmail.com> wrote:
>>> > If I remember correctly, clang's strategy for handling language
>>> linkage in C is to pretend that C has language linkage and say that
>>> everything has C language linkage.
>>> >
>>> > If that is the case, the attached patch is probably the correct fix.
>>>
>>> Hmm.  This is probably a crash/miscompile waiting to happen in a lot of
>>> different places.  You can produce it in potentially-evaluated code in C++,
>>> too, in an in-class initializer.
>>>
>>> We should probably push a local DeclContext when we enter a
>>> statement-expression outside of a local context.
>>>
>>
>> +1, my first reaction to the reduced test case was, "why are we in a
>> record declcontext when declaring variables in statement expressions?"
>> Finding a way to get out of that state seems like a better fix.
>>
>
> GCC is generally more aggressive at rejecting statement expressions not at
> block scope than we are; I'm surprised it accepts this case. Did this come
> up in some important code somewhere, or can we just reject this?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150310/28ba8d15/attachment.html>


More information about the cfe-commits mailing list