[cfe-dev] Some assembly fails in clang and succeeds in gcc

Yuri yuri at rawbw.com
Tue Aug 5 18:01:20 PDT 2014


I am looking at one project that doesn't compile with clang++.

Source in __asm__ __volatile__(...) after preprocessor looks like this:
<...skipped...>"mov [r8+((1024+7-(15))-((1024+7-(15))/(8))*(8))*4]" ", " 
"ecx" ";"

  "\n" "1" ":"
  "add rsi" ", " "4*16" ";"
<...skipped...>


This place breaks with this message:
sha.cpp:340:2: error: invalid instruction mnemonic 'prefix'
         ASL(1)
         ^
./cpu.h:224:17: note: expanded from macro 'ASL'
         #define ASL(x) GNU_ASL(x)
                        ^
./cpu.h:218:26: note: expanded from macro 'GNU_ASL'
         #define GNU_ASL(x) "\n" #x ":"
                                 ^
<scratch space>:24:2: note: expanded from here
"1"
  ^

However, there is the previous instance of the similar assembly that 
clang doesn't complain about:
  "movdqa xmm1" ", " "[rcx+1*16]" ";"
  "\n" "0" ":"
  "movdqa [r8+((1024+7-(0+3))-((1024+7-(0+3))/(8))*(8))*4]" ", " "xmm1" ";"

gcc compiles both places.

What is wrong with the first place?

Yuri



More information about the cfe-dev mailing list