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

Enea Zaffanella zaffanella at cs.unipr.it
Tue May 19 07:01:45 PDT 2009


Hello.

Both clang-cc SVN version 68830 and gcc 4.3.2 accept the following chunk 
of code (which was extracted from linux-2.4.37):

=========================================================
typedef struct {
	volatile unsigned int lock;
} spinlock_t;

static inline int spin_trylock(spinlock_t *lock)
{
	char oldval;
	__asm__ __volatile__(
		"xchgb %b0,%1"
		:"=q" (oldval), "=m" (lock->lock)
		:"0" (0) : "memory");
	return oldval > 0;
}
=========================================================


In contrast, clang-cc SVN version 72105 rejects it as follows:

bug.c:11:9: error: unsupported inline asm: input with type 'int' 
matching output
       with type 'char'
                 :"0" (0) : "memory");
                       ^
1 diagnostic generated.


Is this a regression?

Cheers,
Enea Zaffanella.




More information about the cfe-dev mailing list