[cfe-dev] clang-cc regression on inline asm?

Roberto Bagnara bagnara at cs.unipr.it
Tue May 19 11:51:05 PDT 2009


Daniel Dunbar wrote:
> I think he is asking if it is an intentional incompatibility, and I
> think, but am not sure, that Chris did intend to make this an error
> and expect users to change their code.

The problem is that there is code (lots of code) we cannot change.
What Enea was asking is a confirmation that this is a regression
from clang-cc SVN version 68830 (which is able to parse linux-2.4.37)
   to clang-cc SVN version 72105 (which is not).

     Roberto

> On Tue, May 19, 2009 at 11:01 AM, Mike Stump <mrs at apple.com> wrote:
>> On May 19, 2009, at 7:01 AM, Enea Zaffanella wrote:
>>> bug.c:11:9: error: unsupported inline asm: input with type 'int'
>>> matching output with type 'char'
>>> Is this a regression?
>> If you mean, does it work in gcc and not in clang yet, yes, it is a
>> regression from gcc to clang.  If you're asking if it is a bug, yes,
>> it is.  You can work around this by ensuring that the input and output
>> types are the same, something like:
>>
>> typedef struct {
>>   volatile unsigned int lock;
>> } spinlock_t;
>>
>> int spin_trylock(spinlock_t *lock)
>> {
>>   char oldval;
>>   __asm__ __volatile__(
>>                       "xchgb %b0,%1"
>>                       :"=q" (oldval), "=m" (lock->lock)
>>                       :"0" ((char)0) : "memory");
>>   return oldval > 0;
>> }
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 


-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the cfe-dev mailing list