This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
compiler optimization -O2 results in bad assembly #90703
Labels
You can continue the conversation there. Go to discussion →
Describe the bug
when i try to build the example
samples/bluetooth/peripheral_nus
for my newxiao_ble
board, the build fails with the error:Regression
Steps to reproduce
i try to build using
this fails, with the error mentioned in the previous section, see relevant output in the "log output" section.
the problem is the
-O2
flag in the failing command which overrides the previous-Os
flag, if i remove the-O2
flag and run this command again from the build directory it succeeds.Relevant log output
ninja: job failed: /usr/bin/arm-none-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DNRF52840_XXAA -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/user/z/zephyr/subsys/bluetooth/controller/. -I/home/user/z/zephyr/subsys/bluetooth/controller/include -I/home/user/z/zephyr/subsys/bluetooth/controller/../crypto -I/home/user/z/zephyr/subsys/bluetooth/controller/ll_sw/nordic -I/home/user/z/zephyr/subsys/bluetooth/controller/ll_sw/nordic/hci -I/home/user/z/zephyr/build/zephyr/include/generated/zephyr -I/home/user/z/zephyr/include -I/home/user/z/zephyr/build/zephyr/include/generated -I/home/user/z/zephyr/soc/nordic -I/home/user/z/zephyr/soc/nordic/nrf52/. -I/home/user/z/zephyr/soc/nordic/common/. -I/home/user/z/zephyr/subsys/usb/device -I/home/user/z/zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue -I/home/user/z/zephyr/subsys/bluetooth -I/home/user/z/zephyr/drivers/usb/common/nrf_usbd_common/. -I/home/user/z/modules/hal/cmsis/CMSIS/Core/Include -I/home/user/z/modules/hal/cmsis_6/CMSIS/Core/Include -I/home/user/z/zephyr/modules/cmsis_6/. -I/home/user/z/modules/hal/nordic/nrfx -I/home/user/z/modules/hal/nordic/nrfx/drivers/include -I/home/user/z/modules/hal/nordic/nrfx/mdk -I/home/user/z/zephyr/modules/hal_nordic/nrfx/. -isystem /home/user/z/zephyr/lib/libc/common/include -isystem /home/user/z/zephyr/build/modules/picolibc/picolibc/include -isystem /usr/lib/gcc/arm-none-eabi/15.1.0/include -Wshadow -fno-strict-aliasing -Os -imacros /home/user/z/zephyr/build/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/usr/arm-none-eabi -imacros /home/user/z/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/user/z/zephyr/samples/bluetooth/peripheral_nus=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/user/z/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/user/z=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -O2 -MD -MT zephyr/subsys/bluetooth/controller/CMakeFiles/subsys__bluetooth__controller.dir/util/mem.c.obj -MF zephyr/subsys/bluetooth/controller/CMakeFiles/subsys__bluetooth__controller.dir/util/mem.c.obj.d -o zephyr/subsys/bluetooth/controller/CMakeFiles/subsys__bluetooth__controller.dir/util/mem.c.obj -c /home/user/z/zephyr/subsys/bluetooth/controller/util/mem.c /tmp/ccoMjcik.s: Assembler messages: /tmp/ccoMjcik.s:494: Error: registers may not be the same -- `str r3,[r3,#-12]!'
Impact
Not sure
Environment
arm-none-eabi-gcc (Alpine Linux) 15.1.0, zephyr v4.1.0
Additional Context
No response
The text was updated successfully, but these errors were encountered: