r276232 - [Sema] Fix PR28623.

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 16:06:37 PDT 2016


r276489. Thanks!

On Fri, Jul 22, 2016 at 3:17 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> On Fri, Jul 22, 2016 at 3:15 PM, George Burgess IV <
> george.burgess.iv at gmail.com> wrote:
>
>> (Assuming "yes" :) )
>>
>> Richard, are you okay with this being merged into 3.9?
>>
>
> Yes, LGTM for 3.9.
>
>
>> On Fri, Jul 22, 2016 at 9:54 AM, George Burgess IV <
>> george.burgess.iv at gmail.com> wrote:
>>
>>> Error message says r272936 had the error, so it looks like it would,
>>> yeah. :)
>>>
>>> Would you like me to merge it to the 3.9 branch?
>>>
>>> On Fri, Jul 22, 2016 at 6:51 AM, Hans Wennborg <hans at chromium.org>
>>> wrote:
>>>
>>>> Does this apply to 3.9?
>>>>
>>>> On Wed, Jul 20, 2016 at 11:28 PM, George Burgess IV via cfe-commits
>>>> <cfe-commits at lists.llvm.org> wrote:
>>>> > Author: gbiv
>>>> > Date: Wed Jul 20 22:28:13 2016
>>>> > New Revision: 276232
>>>> >
>>>> > URL: http://llvm.org/viewvc/llvm-project?rev=276232&view=rev
>>>> > Log:
>>>> > [Sema] Fix PR28623.
>>>> >
>>>> > In atomic builtins, we assumed that the LValue conversion on the first
>>>> > argument would succeed. So, we would crash given code like:
>>>> >
>>>> > ```
>>>> > void ovl(char);
>>>> > void ovl(int);
>>>> > __atomic_store_n(ovl, 0, 0);
>>>> > ```
>>>> >
>>>> > This patch makes us not assume that said conversion is successful. :)
>>>> >
>>>> > Added:
>>>> >     cfe/trunk/test/SemaCXX/atomic-ops.cpp
>>>> > Modified:
>>>> >     cfe/trunk/lib/Sema/SemaChecking.cpp
>>>> >
>>>> > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>>>> > URL:
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276232&r1=276231&r2=276232&view=diff
>>>> >
>>>> ==============================================================================
>>>> > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>>>> > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 20 22:28:13 2016
>>>> > @@ -2398,7 +2398,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded
>>>> >
>>>> >    // Inspect the first argument of the atomic operation.
>>>> >    Expr *Ptr = TheCall->getArg(0);
>>>> > -  Ptr = DefaultFunctionArrayLvalueConversion(Ptr).get();
>>>> > +  ExprResult ConvertedPtr =
>>>> DefaultFunctionArrayLvalueConversion(Ptr);
>>>> > +  if (ConvertedPtr.isInvalid())
>>>> > +    return ExprError();
>>>> > +
>>>> > +  Ptr = ConvertedPtr.get();
>>>> >    const PointerType *pointerType =
>>>> Ptr->getType()->getAs<PointerType>();
>>>> >    if (!pointerType) {
>>>> >      Diag(DRE->getLocStart(),
>>>> diag::err_atomic_builtin_must_be_pointer)
>>>> >
>>>> > Added: cfe/trunk/test/SemaCXX/atomic-ops.cpp
>>>> > URL:
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/atomic-ops.cpp?rev=276232&view=auto
>>>> >
>>>> ==============================================================================
>>>> > --- cfe/trunk/test/SemaCXX/atomic-ops.cpp (added)
>>>> > +++ cfe/trunk/test/SemaCXX/atomic-ops.cpp Wed Jul 20 22:28:13 2016
>>>> > @@ -0,0 +1,9 @@
>>>> > +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu
>>>> -std=c++11
>>>> > +
>>>> > +// We crashed when we couldn't properly convert the first arg of
>>>> __atomic_* to
>>>> > +// an lvalue.
>>>> > +void PR28623() {
>>>> > +  void helper(int); // expected-note{{target}}
>>>> > +  void helper(char); // expected-note{{target}}
>>>> > +  __atomic_store_n(helper, 0, 0); // expected-error{{reference to
>>>> overloaded function could not be resolved}}
>>>> > +}
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > cfe-commits mailing list
>>>> > cfe-commits at lists.llvm.org
>>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160722/236e429f/attachment.html>


More information about the cfe-commits mailing list