https://bugs.llvm.org/show_bug.cgi?id=50318
Bug ID: 50318
Summary: Inline asm clobber list reserved register warning
should point to the clobber list itself
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
(writing this prior to https://reviews.llvm.org/D102244 landing, so the exact
output may have changed by now)
This applies to all architectures, here's an Arm example.
Test file:
void bar(void)
{
__asm__ __volatile__ ( "nop" :
: : "sp");
}
Compile with:
./bin/clang --target=arm-arm-none-eabi -march=armv7-m -c bar.c -o bar.o
You get:
bar.c:3:28: warning: inline asm clobber list contains reserved registers: SP
[-Winline-asm]
__asm__ __volatile__ ( "nop" :
^
<inline asm>:1:1: note: instantiated into assembly here
nop
^
bar.c:3:28: note: Reserved registers on the clobber list may not be preserved
across the asm statement, and clobbering them may lead to undefined behaviour.
__asm__ __volatile__ ( "nop" : : : "sp");
^
<inline asm>:1:1: note: instantiated into assembly here
nop
^
1 warning generated.
Ideally the warning would point to the clobber list itself. This can be useful
if you use an alias for the reserved register.
E.g. "r13" instead of "sp" on arm. If the user goes to search their file for
"sp" they won't find it, but pointing to the clobber list gives a stronger
hint.
Currently, I think there is only one source location node for the whole inline
asm block and this is why we always mark the start of the block. The clobber
list is its own operand but I don't see a way to get a specific source location
for it.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs