Re: [kbuild-all] Re: lib/test_scanf.c:531:1: warning: the frame size of 2080 bytes is larger than 2048 bytes

From: Chen, Rong A
Date: Tue Jul 27 2021 - 05:01:29 EST




On 7/24/2021 12:15 AM, Richard Fitzgerald wrote:
On 13/07/2021 09:21, kernel test robot wrote:
All warnings (new ones prefixed by >>):

    lib/test_scanf.c: In function 'numbers_list_field_width_val_width':
lib/test_scanf.c:531:1: warning: the frame size of 2080 bytes is larger than 2048 bytes [-Wframe-larger-than=]
      531 | }
          | ^
    lib/test_scanf.c: In function 'numbers_list_field_width_typemax':
    lib/test_scanf.c:489:1: warning: the frame size of 2552 bytes is larger than 2048 bytes [-Wframe-larger-than=]
      489 | }
          | ^
    lib/test_scanf.c: In function 'numbers_list':
    lib/test_scanf.c:438:1: warning: the frame size of 2080 bytes is larger than 2048 bytes [-Wframe-larger-than=]
      438 | }
          | ^


I haven't been able to reproduce this. I've tried these compilers:

Linaro AArch32 GCC 10.2.1 20201103(-O2 or -Os optimization): stack frames < 200 bytes

Linaro ARM32 7.5-2019.12 -Os: maximum of 384 bytes

Debian 6.3.0-18+deb9u1, x86_64 -O2: frames < 200 bytes

Hi Richard,

I installed gcc-10-arm-linux-gnueabi on Debian and can't reproduce the warning too.


(The GCC fetched with the reproduction instructions from the krobot
report doesn't work on my Debian system.)

I have confirmed that the gcc compiler used by the bot can reproduce the warning, which problem on your Debian system? we can improve the reproduce tool if there's more information.

Best Regards,
Rong Chen


The sizes reported by the krobot are the total of all stack variable in
the function, but they all have limited scope. Obviously my GCC versions
are optimizing by effectively making a union of stack variable that are
used in different scope. So presumably the GCC version used by krobot is
missing this optimization. That feels to me more like a compiler bug if
it is allocating 12 times more stack than is actually necessary for the
function.

Output from my 10.2.1 compiler (-O2):

lib/test_scanf.c: In function 'numbers_list_field_width_val_width':
lib/test_scanf.c:530:1: warning: the frame size of 176 bytes is larger than 128 bytes [-Wframe-larger-than=]
  530 | }
      | ^
lib/test_scanf.c: In function 'numbers_list_field_width_typemax':
lib/test_scanf.c:488:1: warning: the frame size of 184 bytes is larger than 128 bytes [-Wframe-larger-than=]
  488 | }
      | ^
lib/test_scanf.c: In function 'numbers_list':
lib/test_scanf.c:437:1: warning: the frame size of 168 bytes is larger than 128 bytes [-Wframe-larger-than=]
_______________________________________________
kbuild-all mailing list -- kbuild-all@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-all-leave@xxxxxxxxxxxx