<div dir="ltr">This is <a href="http://llvm.org/bugs/show_bug.cgi?id=18916">http://llvm.org/bugs/show_bug.cgi?id=18916</a></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 6, 2014 at 3:42 PM, Yuri <span dir="ltr"><<a href="mailto:yuri@rawbw.com" target="_blank">yuri@rawbw.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 08/06/2014 13:05, Reid Kleckner wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So, 1: is supposed to be a label? I suspect that is not going to work. Consider:<br>
<br>
$ cat t.cpp<br>
int main() {<br>
asm ("1: jmp 1");<br>
}<br>
<br>
$ clang -cc1 t.cpp -S -o - | grep -A10 main:<br>
_main:<br>
#APP<br>
Ltmp0:<br>
jmp 1 # Not right...<br>
#NO_APP<br>
movl $0, %eax<br>
retl<br>
<br>
</blockquote>
<br></div>
However, in my case the corresponding jump label is 1b, and generated assembly is right:<div class=""><br>
$ cat t.cpp<br>
int main() {<br></div>
asm ("1: jmp 1b");<div class=""><br>
}<br>
<br>
$ clang -cc1 t.cpp -S -o - | grep -A10 main:<br></div>
main:<br>
#APP<br>
.Ltmp0:<br>
jmp .Ltmp0<br>
#NO_APP<br>
movl $0, %eax<br>
retq<br>
.Ltmp1:<br>
.size main, .Ltmp1-main<br>
<br>
<br>
I limited the testcase to this small form.<br>
$ cat testcase.c<br>
void func(void *state) {<br>
__asm__ __volatile__<br>
(<br>
"\n" "1" ":" "jb 1b;"<br>
".att_syntax prefix;"<br>
:<br>
: "c" (state)<br>
: "memory", "cc", "%eax"<br>
);<br>
}<br>
<br>
<br>
void use() {<br>
func(0);<br>
}<br>
<br>
$ clang testcase.c<br>
testcase.c:5:15: error: invalid instruction mnemonic 'prefix'<br>
"\n" "1" ":" "jb 1b;"<br>
^<br>
<inline asm>:2:21: note: instantiated into assembly here<br>
1:jb 1b;.att_syntax prefix;<br>
^~~~~~~<br>
1 error generated.<br>
<br>
<br>
gcc-4.8.0 compiles it, and clang rev.214386 doesn't.<span class="HOEnZb"><font color="#888888"><br>
<br>
Yuri<br>
</font></span></blockquote></div><br></div>