<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/119659>119659</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            "error: macro 'KERNEL' is already defined" on inline assembly macro, unless `-O0`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          freifrauvonbleifrei
      </td>
    </tr>
</table>

<pre>
    I want to compile a file with inline assembly, say `example.cpp`:
```
void kernel()
{
        asm volatile(
         ".macro   KERNEL \n"
            "   nop        \n"
            ".endm \n"
        );
}

void function_to_call_kernel()
{
        kernel();
}
```
On compilation, I get this:
```
$ clang -c -o example.o -O3 example.cpp
example.cpp:4:6: error: macro 'KERNEL' is already defined
    4 |             ".macro     KERNEL \n"
      |             ^
<inline asm>:1:2: note: instantiated into assembly here
    1 |         .macro KERNEL 
      |         ^
1 error generated.
```
It compiles just fine with `-O0`, but shows this error for `-O1` through `-O3`.

This is on Fujitsu A64FX with clang 19.1.4 .
(I just noticed that `g++` fails similarly, but for `-O3` only.)

Am I missing something here?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVM9vqzgQ_mvMZRRkxoSEAweaNlK0q6202sPeKgMTcNfYkW3SzX-_MtC-tK97eAhh4_n1zTcfSO9Vb4gqtn1g28dETmGwrjo7Umcnp6s1jY5bUklju1t1gjdpAgQLrR0vShNIOMflTYUBlNHKEEjvaWz0jeEBvLwBKzj9K8eLprS9XFjBmagZr-NmuXl9taqDf8gZ0gz3DMto3z3EJy-lH-FqtQxKU7TOh8AQ01G2zjJe_vb05x9PvwPbHgxDXB0Aog8AGHuB9frOIyXTjZ8tEYCYq-8e55MF4HkybVDWvAT70kqtX_4P8afz-0R3LT-blUMZU0auTtBTgDAo_zNBDHNotTQ9bFrYWHgn1MLmWcA9vby-fxN1zkRdMFEDOWdd3MysAcPdQhvDHSgPUjuS3Q06OitDHeN15CcHtjvA_fXB-_z2E_Or09eg7VNsQhw-JDIy8cREnTFRYwRlbKC4KuODNEHJQB0oE-yHnGAgR2uF7FOFFc87lu9ALACyhQToyZCLFdIvNJ_Cu7A9vE4-QORiETcr-OZ5dsMDNFMAP9g3P49rzXq2bvHKWMEhDM5O_RonWMHTRUl_xQDlwRo4Tq8q-AnqIj_-vVRZZpyVaZbmMEfg_rRAMTaoljoIgwwxa8_wId4Fh7NU2oNXo9LSLR9eRPgBKJYHa_QtXYXK63qEE4zKe2V68HakMMTdzLE4Jl0lulKUMqEq2wlR7vZlXiRDRXvcNq1EakrZ7os9tSi6ljDbNrJtUSSqQo55hhnyPC95kVKOTdaVPGvOeb4rziznNEqlU62vY2pdnyjvJ6qyrCy2ZaJlQ9rP_yNEQ28wW6O2to-Jq2LQppl6z3KulQ_-R5qggqaKIf6i0BHjLL78u5bYSORkNHn_Y_zJ5HQ1hHCZv1I8Mjz2KgxTk7Z2ZHiMeNZlc3H2ldrA8Dh34Rke1zavFf4XAAD__wSKmgk">