public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67223] New: Address misaligned for ldrexd
@ 2015-08-14 21:02 soldier.kam at gmail dot com
2015-08-15 10:14 ` [Bug target/67223] " mikpelinux at gmail dot com
2015-08-15 23:41 ` soldier.kam at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: soldier.kam at gmail dot com @ 2015-08-14 21:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67223
Bug ID: 67223
Summary: Address misaligned for ldrexd
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: soldier.kam at gmail dot com
Target Milestone: ---
Hi!
I compiled wrk (https://github.com/wg/wrk) for odroid-c1. Binary runs but cause
bus error. I thought that it is caused by ldrexd that requires address to be
doubleword aligned but it is not - it is 0xb5c3103c. See below for details.
In dmesg I found:
"Alignment trap: wrk (19927) PC=0x00017494 Instr=0xe1b14f9f Address=0xb5c3212c
FSR 0x001"
GDBs "show registers":
r0 0x1e8481 2000001
r1 0xb5c3103c 3049459772
r2 0x1 1
r3 0x0 0
r4 0x16378 91000
r5 0xbefffa08 3204446728
r6 0x0 0
r7 0x152 338
r8 0xbefffa08 3204446728
r9 0x0 0
r10 0xb6ff94c0 3070203072
r11 0xb0f85cfc 2969066748
r12 0xb5c3000c 3049455628
sp 0xb0f85cd0 0xb0f85cd0
lr 0x15fcc 90060
pc 0x17494 0x17494 <stats_record+84>
cpsr 0x200b0010 537591824
Assembler for this function:
00017440 <stats_record>:
17440: e92d4830 push {r4, r5, fp, lr}
17444: e28db00c add fp, sp, #12
17448: e24dd020 sub sp, sp, #32
1744c: e50b0020 str r0, [fp, #-32] ; 0xffffffe0
17450: e14b22fc strd r2, [fp, #-44] ; 0xffffffd4
17454: e51b3020 ldr r3, [fp, #-32] ; 0xffffffe0
17458: e1c300d8 ldrd r0, [r3, #8]
1745c: e14b22dc ldrd r2, [fp, #-44] ; 0xffffffd4
17460: e1510003 cmp r1, r3
17464: 01500002 cmpeq r0, r2
17468: 8a000001 bhi 17474 <stats_record+0x34>
1746c: e3a03000 mov r3, #0
17470: ea000048 b 17598 <stats_record+0x158>
17474: e51b302c ldr r3, [fp, #-44] ; 0xffffffd4
17478: e2833004 add r3, r3, #4
1747c: e1a03183 lsl r3, r3, #3
17480: e51b2020 ldr r2, [fp, #-32] ; 0xffffffe0
17484: e0821003 add r1, r2, r3
17488: e3a02001 mov r2, #1
1748c: e3a03000 mov r3, #0
17490: f57ff05f dmb sy
17494: e1b14f9f ldrexd r4, [r1]
17498: e0944002 adds r4, r4, r2
1749c: e0a55003 adc r5, r5, r3
174a0: e1a10f94 strexd r0, r4, [r1]
174a4: e3500000 cmp r0, #0
174a8: 1afffff9 bne 17494 <stats_record+0x54>
174ac: f57ff05f dmb sy
174b0: e51b1020 ldr r1, [fp, #-32] ; 0xffffffe0
174b4: e3a02001 mov r2, #1
174b8: e3a03000 mov r3, #0
174bc: f57ff05f dmb sy
174c0: e1b14f9f ldrexd r4, [r1]
174c4: e0944002 adds r4, r4, r2
174c8: e0a55003 adc r5, r5, r3
174cc: e1a10f94 strexd r0, r4, [r1]
174d0: e3500000 cmp r0, #0
174d4: 1afffff9 bne 174c0 <stats_record+0x80>
...
Output "gcc -v":
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/lto-wrapper
Target: armv7l-unknown-linux-gnueabihf
Configured with: /build/gcc/src/gcc-5.2.0/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info
--with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues
--enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
--with-default-libstdcxx-abi=gcc4-compatible
--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf
--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
Thread model: posix
gcc version 5.2.0 (GCC)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/67223] Address misaligned for ldrexd
2015-08-14 21:02 [Bug c/67223] New: Address misaligned for ldrexd soldier.kam at gmail dot com
@ 2015-08-15 10:14 ` mikpelinux at gmail dot com
2015-08-15 23:41 ` soldier.kam at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: mikpelinux at gmail dot com @ 2015-08-15 10:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67223
--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
You didn't provide a self-contained test case. After extracting stats_record
and the stats declaration from the source to linked to and providing my own
stats_alloc (I'm not using your zcalloc), I cannot reproduce the SIGBUS.
(Tried it on a Cortex-A9 system.)
The alignment of a stats struct is 8. Verify that your allocator returns
correctly aligned objects. And do provide a self-contained test case -- one
that compiles, runs, and provokes the crash.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/67223] Address misaligned for ldrexd
2015-08-14 21:02 [Bug c/67223] New: Address misaligned for ldrexd soldier.kam at gmail dot com
2015-08-15 10:14 ` [Bug target/67223] " mikpelinux at gmail dot com
@ 2015-08-15 23:41 ` soldier.kam at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: soldier.kam at gmail dot com @ 2015-08-15 23:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67223
Marcin Kamionowski <soldier.kam at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Marcin Kamionowski <soldier.kam at gmail dot com> ---
Yes, you are correct about misaligned address returned from zmalloc. Now it
works without errors. Thank you for helping out. I was not aware of zmalloc
features.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-15 23:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14 21:02 [Bug c/67223] New: Address misaligned for ldrexd soldier.kam at gmail dot com
2015-08-15 10:14 ` [Bug target/67223] " mikpelinux at gmail dot com
2015-08-15 23:41 ` soldier.kam at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).