r179756 - Reject asm output constraints that consist of modifiers only.

Benjamin Kramer benny.kra at gmail.com
Thu Apr 18 15:52:13 PDT 2013


On 19.04.2013, at 00:36, Eric Christopher <echristo at gmail.com> wrote:

> Clever way of fixing it :)
> 
> Can you add a comment describing this cleverness please?

r179806.

- Ben

> 
> Thanks!
> 
> -eric
> 
> On Thu, Apr 18, 2013 at 6:23 AM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Thu Apr 18 08:23:23 2013
>> New Revision: 179756
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=179756&view=rev
>> Log:
>> Reject asm output constraints that consist of modifiers only.
>> 
>> Fixes PR15759.
>> 
>> Modified:
>>    cfe/trunk/lib/Basic/TargetInfo.cpp
>>    cfe/trunk/test/Sema/asm.c
>> 
>> Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=179756&r1=179755&r2=179756&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
>> +++ cfe/trunk/lib/Basic/TargetInfo.cpp Thu Apr 18 08:23:23 2013
>> @@ -373,7 +373,7 @@ bool TargetInfo::validateOutputConstrain
>>     Name++;
>>   }
>> 
>> -  return true;
>> +  return Info.allowsMemory() || Info.allowsRegister();
>> }
>> 
>> bool TargetInfo::resolveSymbolicName(const char *&Name,
>> 
>> Modified: cfe/trunk/test/Sema/asm.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=179756&r1=179755&r2=179756&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Sema/asm.c (original)
>> +++ cfe/trunk/test/Sema/asm.c Thu Apr 18 08:23:23 2013
>> @@ -130,3 +130,19 @@ void test14(struct S *s) {
>>   __asm("": : "a"(*s)); // expected-error {{dereference of pointer to incomplete type 'struct S'}}
>>   __asm("": "=a" (*s) :); // expected-error {{dereference of pointer to incomplete type 'struct S'}}
>> }
>> +
>> +// PR15759.
>> +double test15() {
>> +  double ret = 0;
>> +  __asm("0.0":"="(ret)); // expected-error {{invalid output constraint '=' in asm}}
>> +  __asm("0.0":"=&"(ret)); // expected-error {{invalid output constraint '=&' in asm}}
>> +  __asm("0.0":"+?"(ret)); // expected-error {{invalid output constraint '+?' in asm}}
>> +  __asm("0.0":"+!"(ret)); // expected-error {{invalid output constraint '+!' in asm}}
>> +  __asm("0.0":"+#"(ret)); // expected-error {{invalid output constraint '+#' in asm}}
>> +  __asm("0.0":"+*"(ret)); // expected-error {{invalid output constraint '+*' in asm}}
>> +  __asm("0.0":"=%"(ret)); // expected-error {{invalid output constraint '=%' in asm}}
>> +  __asm("0.0":"=,="(ret)); // expected-error {{invalid output constraint '=,=' in asm}}
>> +  __asm("0.0":"=,g"(ret)); // no-error
>> +  __asm("0.0":"=g"(ret)); // no-error
>> +  return ret;
>> +}
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list