After r225244 clang verifies that inline asm constraints for immediate operands are used with ICE. This breaks existing code like pixman and tomcrypt as well as makes it impossible to create optimal output if either fixed or variable arguments can be supported. The backend has to be able to deal with the constraint check anyway and for all given cases it does. Therefore, downgrade the diagnostic from a hard error to an error-default warning. Correct use involving __builtin_constant_p can be annotated accordingly.
Diff Detail
Event Timeline
I'm in favor of the diagnostic change, I wasn't aware of how bad it was.
Does anyone else mind this being a default error warning? I'd prefer a hard error. I don't understand your argument about this diagnostic making it impossible to get "optimal output". It is simply a matter of using a macro instead of an always_inline function.
I like the new diagnostic message. I think we should get that committed (and merged for the 3.6 release). However, Im not sure I agree with the downgrading of the error in the case of the failure to validate the constant though.
Using a macro requires code changes. That's more work when dealing with 3rd party code, so I do prefer non-intrusive changes.
Also, using functions gives better typing in terms of documentation, so it seems reasonable to continue to support that.
For optimality I meant things like:
unsigned char inb (unsigned short int __port) { unsigned char _v; if (__builtin_constant_p(__port) && __port < 256) __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"N" (__port)); else __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"d" (__port)); return _v; }