int配列
は4バイトずつ、char配列
は1バイトずつずらしながら値を代入している。
x86と同じでintは4バイト、charは1バイトということが分かった。
gcc -O0 -S test.c -o test.s
test.c
int main(){
int a[4];
a[0]=11;
a[1]=22;
a[2]=33;
a[3]=44;
char b[4];
b[0]=55;
b[1]=66;
b[2]=77;
b[3]=88;
return 0;
}
test.s
main:
push {r7}
sub sp, sp, #28
add r7, sp, #0
movs r3, #11
str r3, [r7, #8]
movs r3, #22
str r3, [r7, #12]
movs r3, #33
str r3, [r7, #16]
movs r3, #44
str r3, [r7, #20]
movs r3, #55
strb r3, [r7, #4]
movs r3, #66
strb r3, [r7, #5]
movs r3, #77
strb r3, [r7, #6]
movs r3, #88
strb r3, [r7, #7]
movs r3, #0
mov r0, r3
adds r7, r7, #28
mov sp, r7
ldr r7, [sp], #4
bx lr