https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69538
Bug ID: 69538
Summary: gcc.dg/torture/stackalign/builtin-apply-4.c fails with
flto for aarch32 targets with single precision FPU
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: andre.simoesdiasvieira at arm dot com
Target Milestone: ---
I am getting an execution failure for:
gcc.dg/torture/stackalign/builtin-apply-4.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects
I have tried trunk, 5.2 and 4.9 all fail for various (cortex-m4/7 armv7-a)
AArch32 targets when running with: "-mfloat-abi=hard -mfpu=fpv{4,5}-sp-d16"
I inspected the RTL produced with the following command line:
$arm-none-eabi-gcc -fno-diagnostics-show-caret -fdiagnostics-color=never -O2
-fno-fat-lto-objects -fgnu89-inline -specs=rdimon.specs
-Wa,-mno-warn-deprecated -Wl,-Ttext-segment=0x21000000 builtin-apply-4.c -lm
-mthumb -march=armv7-a -mfloat-abi=hard -mfpu=fpv5-sp-d16 -o
builtin-apply-4_working.exe -save-temps -fdump-rtl-all
Which doesnt have flto and passes the execution test. It produces the following
RTL for the call to bar:
(call_insn/c/i:TI 8 7 38 2 (parallel [
(set (reg:DF 16 s0)
(call (mem:SI (symbol_ref:SI ("bar") [flags 0x3]
<function_decl 0xf74ada80 bar>) [0 bar S4 A32])
(const_int 0 [0])))
(use (const_int 0 [0]))
(clobber (reg:SI 14 lr))
]) builtin-apply-4.c:34 209 {*call_value_symbol}
Now the same command line with -flto fails the execution test and produces the
following RTL for the call to bar:
(call_insn/u/i:TI 8 7 39 2 (parallel [
(set (reg:DF 0 r0)
(call (mem:SI (symbol_ref:SI ("bar.constprop.0") [flags 0x3]
<function_decl 0x7f52af969e00 bar.constprop>) [0 bar.constprop S4 A32])
(const_int 0 [0])))
(use (const_int 0 [0]))
(clobber (reg:SI 14 lr))
]) builtin-apply-4.c:27 209 {*call_value_symbol}
Using the same float ABI the LTO expects the return of bar in r0-r1, even
though its a double and in hard float abi it should be passed in s0-s1 (d0) as
is the case with the no LTO version.