https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117795
Bug ID: 117795
Summary: fstack-limit is not working on arm
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: castet.matthieu at free dot fr
Target Milestone: ---
Created attachment 59712
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59712&action=edit
test case
Hi,
building the attach program with -fstack-limit-register or -fstack-limit-symbol
arm-none-eabi-gcc toto_s.c -mcpu=cortex-m4 -Os -S -o toto_gccm4-raw.s
arm-none-eabi-gcc toto_s.c -fstack-limit-register=r10 -mcpu=cortex-m4 -Os -S
-o toto_gccm4-limit-reg.s
arm-none-eabi-gcc toto_s.c -fstack-limit-symbol=mct -mcpu=cortex-m4 -Os -S -o
toto_gccm4-limit-symb.s
stack limit is not checked in every function. Static allocation are not
checked. Only vla allocation are checked.
No check in small_static_alloc and big_static_alloc
Only stack check in dyn_alloc.
Current behavior :
Doing some recursive call to xxx_static_alloc can run out the stack.
Expected behavior :
Check is done in every function and program abort is stack limit is reach.
PS : test done on version 13.3.1 but similar result on 14.2.0