[Bug target/58259] ARM, PowerPC: Atomic flag test and set generates NULL pointer read and write
sebastian.huber@embedded-brains.de
gcc-bugzilla@gcc.gnu.org
Wed Aug 28 12:31:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58259
Sebastian Huber <sebastian.huber@embedded-brains.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|powerpc-eabi |powerpc-eabi, arm-eabi
Summary|PowerPC: Atomic flag test |ARM, PowerPC: Atomic flag
|and set generates NULL |test and set generates NULL
|pointer read and write |pointer read and write
--- Comment #1 from Sebastian Huber <sebastian.huber@embedded-brains.de> ---
Sorry, also the ARMv7 has the NULL pointer read and write problem:
arm-eabi-gcc -march=armv7-a -std=c11 -Wall -Wextra -O2 -S test.c && cat test.s
.arch armv7-a
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 2
.eabi_attribute 34, 1
.eabi_attribute 18, 4
.file "test.c"
.text
.align 2
.global test_and_set
.type test_and_set, %function
test_and_set:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
mov r3, #0
mov r1, #1
ldrb r2, [r3] @ zero_extendqisi2 <-- NULL POINTER READ
.L2:
ldrexb r3, [r0]
cmp r3, r2
bne .L3
strexb ip, r1, [r0]
cmp ip, #0
bne .L2
.L3:
mov r2, #0
dmb sy
moveq r0, #1
strb r3, [r2] <-- NULL POINTER WRITE
movne r0, r2
bx lr
.size test_and_set, .-test_and_set
.ident "GCC: (GNU) 4.9.0 20130828 (experimental) [master revision
022fc2d:bffd767:fd457cef14f3bc6673e90a2de80005feea743ab7]"
More information about the Gcc-bugs
mailing list