This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66547] New: arm-none-eabi-gcc - stack misaligned when calling va_arg function
- From: "matt at hpamotorsport dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 15 Jun 2015 23:54:32 +0000
- Subject: [Bug c/66547] New: arm-none-eabi-gcc - stack misaligned when calling va_arg function
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66547
Bug ID: 66547
Summary: arm-none-eabi-gcc - stack misaligned when calling
va_arg function
Product: gcc
Version: 4.9.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: matt at hpamotorsport dot com
Target Milestone: ---
Created attachment 35785
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35785&action=edit
File from project
I'm working on a project that uses ChibiOS
(https://github.com/ChibiOS/ChibiOS/tree/stable_2.6.x) where I have a function
that calls a va_arg function but the stack is not aligned after the calling
function allocates it's local resources. This causes 64-bit variables (long
long as well as double) to be incorrectly placed.
The assembly generated shows that the stack pointer is moved by 116 where it
should be moved by 120 to keep the alignment to 8-bytes.
arm-none-eabi-gcc -c -mcpu=cortex-m3 -Os -ggdb -fsingle-precision-constant
-mno-unaligned-access -mabi=aapcs -mtune=cortex-m3 -save-temps
-ffunction-sections -fdata-sections -fno-common -Wall -Wextra
-Wstrict-prototypes -Wa,-alms=build/lst/performance.lst -DCORTEX_USE_FPU=FALSE
-DBOARD_HALDEX_STM32_P105_A1=1 -DOSC_HAS_64BIT -DOSC_HAS_FLOAT
-DOSC_HAS_HEARTBEAT -DSLP_HAS_USB -D__BUILD_NUMBER=`cat build-number.txt`
-DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF
.dep/performance.o.d -mthumb -DTHUMB -I.
-I../ChibiOS_2.6.7/os/ports/common/ARMCMx/CMSIS/include
-I../ChibiOS_2.6.7/os/ports/common/ARMCMx
-I../ChibiOS_2.6.7/os/ports/GCC/ARMCMx
-I../ChibiOS_2.6.7/os/ports/GCC/ARMCMx/STM32F1xx
-I../ChibiOS_2.6.7/os/kernel/include -I../ChibiOS_2.6.7/os/hal/include
-I../ChibiOS_2.6.7/os/hal/platforms/STM32F1xx
-I../ChibiOS_2.6.7/os/hal/platforms/STM32
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/GPIOv1
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/I2Cv1
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/RTCv1
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/SPIv1
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/TIMv1
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/USARTv1
-I../ChibiOS_2.6.7/os/hal/platforms/STM32/OTGv1 -I../HPA_Libraries/board
-I../ChibiOS_2.6.7/os/various -I../HPA_Libraries performance.c -o
build/obj/performance.o