https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97448
Bug ID: 97448 Summary: Unneccessary stack frame when using stack protector Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: christophe.leroy at csgroup dot eu Target Milestone: --- While building Linux kernel for 32 bits powerpc with GCC 10.1 with stack frame protection, functions that don't use the stack at all get a pointless stack frame, while they don't when stackframe protection is not used: c0016af4 <get_order>: c0016af4: 38 63 ff ff addi r3,r3,-1 c0016af8: 94 21 ff f0 stwu r1,-16(r1) c0016afc: 54 63 a3 3e rlwinm r3,r3,20,12,31 c0016b00: 7c 63 00 34 cntlzw r3,r3 c0016b04: 20 63 00 20 subfic r3,r3,32 c0016b08: 38 21 00 10 addi r1,r1,16 c0016b0c: 4e 80 00 20 blr c000d1b8 <raw_copy_from_user>: c000d1b8: 94 21 ff f0 stwu r1,-16(r1) c000d1bc: 38 21 00 10 addi r1,r1,16 c000d1c0: 48 00 c5 44 b c0019704 <__copy_tofrom_user> Used GCC version: GCC version with the BUG: Using built-in specs. COLLECT_GCC=/opt/gcc-10.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc COLLECT_LTO_WRAPPER=/home/opt/gcc-10.1.0-nolibc/powerpc64-linux/bin/../libexec/gcc/powerpc64-linux/10.1.0/lto-wrapper Target: powerpc64-linux Configured with: /home/arnd/git/gcc/configure --target=powerpc64-linux --enable-targets=all --prefix=/home/arnd/cross/x86_64/gcc-10.1.0-nolibc/powerpc64-linux --enable-languages=c --without-headers --disable-bootstrap --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --disable-libquadmath --disable-libatomic --disable-libcc1 --disable-libmpx --enable-checking=release Thread model: single Supported LTO compression algorithms: zlib gcc version 10.1.0 (GCC) Build command: powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/.setup-common.o.d -nostdinc -isystem /home/opt/gcc-10.1.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/10.1.0/include -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mcpu=powerpc -mcpu=powerpc -m32 -msoft-float -pipe -ffixed-r2 -mmultiple -mno-readonly-in-sdata -mcpu=powerpc64 -mno-altivec -mno-vsx -fno-asynchronous-unwind-tables -mno-string -mbig-endian -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fomit-frame-pointer -fno-var-tracking-assignments -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -mstack-protector-guard-offset=552 -Werror -DKBUILD_MODFILE='"arch/powerpc/kernel/setup-common"' -DKBUILD_BASENAME='"setup_common"' -DKBUILD_MODNAME='"setup_common"' -c -o arch/powerpc/kernel/setup-common.o arch/powerpc/kernel/setup-common.c