-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
While we shouldn't make it impossible to write non-volatile ASM (maybe the programmer wants to allow compiler optimizations), we should give a warning whenever it looks like the compiler might elide an asm block.
According to https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Extended-Asm.html, a non-volatile asm block might be elided by GCC if
- "all the output operands you specify are for th[e] purpose [of clobbering inputs] (and hence unused)"
- "the memory affected [by a clobber] is not listed in the inputs or outputs of the
asm, as the 'memory' clobber does not count as a side-effect of theasm"
One exception: "An asm instruction without any output operands will be treated identically to a volatile asm instruction." So no warning is needed in that case.
It's not clear to me right now how LLVM's rules for optimizing inline ASM compare to GCC's rules. I'll have to look into it before adding the lint.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request