[llvm-bugs] [Bug 33909] New: error: unexpected token at start of statement on GCC asm statements
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jul 24 09:19:13 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33909
Bug ID: 33909
Summary: error: unexpected token at start of statement on GCC
asm statements
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hjl.tools at gmail.com
CC: llvm-bugs at lists.llvm.org
GCC asm statements are used to get target properties with a cross compiler
without compiling and running a program:
[hjl at gnu-skl-1 asm-1]$ cat x.c
struct foo
{
int x;
};
void
foo (void)
{
__asm__ ("@@@name@@@SIZEO_OF_FOO@@@value@@@%0@@@end@@@" :: "i" (sizeof
(struct foo)));
}
[hjl at gnu-skl-1 asm-1]$ make
cc -S -o x.s x.c
sed -n
's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$/#define
\1 \2/p' x.s > x.h
cat x.h
#define SIZEO_OF_FOO 4
[hjl at gnu-skl-1 asm-1]$
But this fails with clang:
[hjl at gnu-skl-1 asm-1]$ make CC=clang
clang -S -o x.s x.c
x.c:9:12: error: unexpected token at start of statement
__asm__ ("@@@name@@@SIZEO_OF_FOO@@@value@@@%0@@@end@@@" :: "i" (sizeo...
^
<inline asm>:1:2: note: instantiated into assembly here
@@@name@@@SIZEO_OF_FOO@@@value@@@$4@@@end@@@
^
1 error generated.
make: *** [Makefile:16: x.s] Error 1
[hjl at gnu-skl-1 asm-1]$
Here the assembly output is never intended for assembler. It is odd for
clang to complain what is inside of GCC asm statements.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170724/83e45acc/attachment-0001.html>
More information about the llvm-bugs
mailing list