下面代码中的内联汇编给了我段错误,无法解释原因。
#include <stdio.h>
void printArray(const int a[], int n) {
for (int i = 0; i < n; i++)
printf("%d, ", a[i]);
putchar('\n');
}
void myfunc() {
int array[10] = {1,2,3,4,5,6,7,8,9,10};
printArray(array,10);
for (int i = 0; i < 10; i++) {
asm volatile ("mov eax, [ebx+4*esi];"
"lea eax, [eax+8*eax];"
"mov [ebx+4*esi], eax"
: : "b" (array), "S" (i) : "memory", "eax");
}
printArray(array,10);
}
int main() {
myfunc();
}
PS: