[Bug target/82820] [arm32]ldm/stm instructions Bus error while running with 64bit kernel
zwzhangwen.zhang at huawei dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 3 03:49:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82820
--- Comment #2 from zwzhangwen.zhang at huawei dot com ---
Hi,
I have a testcase for example:
typedef struct structA{
int a;
int b;
int c;
}A;
typedef struct structB{
int iData;
A a;
}B;
int test(A aa)
{
aa.a = 123;
aa.b = 321;
aa.c = 213;
printf("\r\n line:%d func:%s [%d][%d][%d]\r\n", __LINE__, __FUNCTION__,
aa.a, aa.b, aa.c);
}
int main()
{
char buf[1024];
A aaa = {1,2,3};
B *pb = (B *)(buf + 1);
pb->a = aaa;
test(pb->a);
return 0;
}
compiling with the command "arm32-linux-gnueabi-gcc -O0 test.c "
Then objdump assemble is as follows:
...
85ac: e51b3008 ldr r3, [fp, #-8]
85b0: e2833004 add r3, r3, #4
85b4: e24b2e41 sub r2, fp, #1040 ; 0x410
85b8: e2422004 sub r2, r2, #4
85bc: e8920007 ldm r2, {r0, r1, r2}
85c0: e8830007 stm r3, {r0, r1, r2}
85c4: e51b3008 ldr r3, [fp, #-8]
85c8: e2833004 add r3, r3, #4
85cc: e8930007 ldm r3, {r0, r1, r2}
85d0: ebffffcd bl 850c <test>
...
pb->a is unaligned access but inst. is ldm/stm and this is a prolem.
The other problem is the elf has bus error on arm64 env,
So anybody help me?
Thank you.
More information about the Gcc-bugs
mailing list