<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - error: unexpected token at start of statement on GCC asm statements"
   href="https://bugs.llvm.org/show_bug.cgi?id=33909">33909</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>error: unexpected token at start of statement on GCC asm statements
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hjl.tools@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>GCC asm statements are used to get target properties with a cross compiler
without compiling and running a program:

[hjl@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@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@gnu-skl-1 asm-1]$ 

But this fails with clang:

[hjl@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@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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>