<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54835>54835</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
\() in assembler macros not properly treated
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jbeulich
</td>
</tr>
</table>
<pre>
While \() alone is handled like gas does, gas further allows text to occur inside the parentheses. This notation permits text to be passed on unaltered. The following example works fine with gcc/gas, but doesn't compile with clang. The first line in the macro body is intentionally triggering an assembler diagnostic as well, to show that \\() alone works as expected.
asm(".macro m arg\n"
"n\\()op (\\arg)\n"
"\\(nop) \\arg\n"
".endm");
void foo(void*data)
{
asm volatile("m %0" :: "r" (data));
}
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUstu4zAM_Br7QqzhyvHGPvjQB_oFC-yZklhbrSwZkty0f7-UvN0EiwZBQknD4QxJ6fXn9HsxlqDqHysxVGIEtN4RmAgLOm1JgzVvBDNG0J5iJR5L_LKHtFBgtPWXCIk-EiQPXqk9gHHRaAIGwIaBHAeRYgO_FqZ1PmEy3sFGYTXpmiszOkauyI-7Q5sokM5ZBC8-1zFuBvrAdWPBFx_eWIZhrReTFpiVqsQzS8sK5Z6KWleJcwLl1y17LDhl0c1_SU2Iie1lu66oXVEFFsJtyQ0wLrF2lsomPyEFM88UsgZ0kIWu0nIHtMHZ-ZiM4ku4kLVZAfuJi78wK6bS3P_6e8jnBPrYSCX2WbVPVXt__GJcC1o0h6IVMMxMwX7EgQD-8MHdUvsNclBuMl6M36X8y3B-y3qu-G_ADTm95kvm6h5uJb57o3ksnolyWIl7jQkz7gCdH65EbAfeveWxWzp8rUzetxxA1d3zN9cK5SiGL57bkuenI6j11OmxG7FOJlmarm01tzMpXSurBlvwvGhlfoTc53oPdlpS2mKuLJ7z0vBe7LLhNeGDte9ffz8495WHw0cT456X_7k_DV1fLxP97PVIPepRdC0NJCWe5NApfZaqVxpri5JsZIEPVf9Um0m0QrSnu7YdxNgOjUAtx7tWq0G8dGLsqlNLKxrb5MKND3MdpqJB7nPkR2tiitdHtmpmR_TFj3tafJheJe3WqKUueqci9g9GyDdB">