[Bug target/114284] New: [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice)
acoplan at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 8 13:12:04 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114284
Bug ID: 114284
Summary: [14 Regression] arm: Load of volatile short gets
miscompiled (loaded twice)
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
The following is a wrong code regression in GCC 14:
volatile short x;
short foo() {
return x;
}
with -march=armv8-m.base -O2 on the trunk we get:
foo:
movw r3, #:lower16:.LANCHOR0
movt r3, #:upper16:.LANCHOR0
ldrh r2, [r3]
movs r0, #0
ldrsh r0, [r3, r0]
bx lr
i.e. x is loaded twice, but with GCC 13 we get:
foo:
movw r3, #:lower16:.LANCHOR0
movt r3, #:upper16:.LANCHOR0
ldrh r0, [r3]
sxth r0, r0
bx lr
I suppose ideally we would have just one ldrsh, but the GCC 13 code is OK.
More information about the Gcc-bugs
mailing list