2021-07-13 08:23:01

by kernel test robot

[permalink] [raw]
Subject: lib/test_scanf.c:531:1: warning: the frame size of 2080 bytes is larger than 2048 bytes

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7fef2edf7cc753b51f7ccc74993971b0a9c81eca
commit: 50f530e176eac808e64416732e54c0686ce2c39b lib: test_scanf: Add tests for sscanf number conversion
date: 8 weeks ago
config: arm-randconfig-r001-20210713 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=50f530e176eac808e64416732e54c0686ce2c39b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 50f530e176eac808e64416732e54c0686ce2c39b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

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 | }
| ^


vim +531 lib/test_scanf.c

490
491 /*
492 * List of numbers separated by delim. Each field width specifier is the
493 * exact length of the corresponding value digits in the string being scanned.
494 */
495 static void __init numbers_list_field_width_val_width(const char *delim)
496 {
497 numbers_list_val_width(unsigned long long, "%llu", delim, "llu", check_ull);
498 numbers_list_val_width(long long, "%lld", delim, "lld", check_ll);
499 numbers_list_val_width(long long, "%lld", delim, "lli", check_ll);
500 numbers_list_val_width(unsigned long long, "%llx", delim, "llx", check_ull);
501 numbers_list_val_width(unsigned long long, "0x%llx", delim, "llx", check_ull);
502 numbers_list_val_width(long long, "0x%llx", delim, "lli", check_ll);
503
504 numbers_list_val_width(unsigned long, "%lu", delim, "lu", check_ulong);
505 numbers_list_val_width(long, "%ld", delim, "ld", check_long);
506 numbers_list_val_width(long, "%ld", delim, "li", check_long);
507 numbers_list_val_width(unsigned long, "%lx", delim, "lx", check_ulong);
508 numbers_list_val_width(unsigned long, "0x%lx", delim, "lx", check_ulong);
509 numbers_list_val_width(long, "0x%lx", delim, "li", check_long);
510
511 numbers_list_val_width(unsigned int, "%u", delim, "u", check_uint);
512 numbers_list_val_width(int, "%d", delim, "d", check_int);
513 numbers_list_val_width(int, "%d", delim, "i", check_int);
514 numbers_list_val_width(unsigned int, "%x", delim, "x", check_uint);
515 numbers_list_val_width(unsigned int, "0x%x", delim, "x", check_uint);
516 numbers_list_val_width(int, "0x%x", delim, "i", check_int);
517
518 numbers_list_val_width(unsigned short, "%hu", delim, "hu", check_ushort);
519 numbers_list_val_width(short, "%hd", delim, "hd", check_short);
520 numbers_list_val_width(short, "%hd", delim, "hi", check_short);
521 numbers_list_val_width(unsigned short, "%hx", delim, "hx", check_ushort);
522 numbers_list_val_width(unsigned short, "0x%hx", delim, "hx", check_ushort);
523 numbers_list_val_width(short, "0x%hx", delim, "hi", check_short);
524
525 numbers_list_val_width(unsigned char, "%hhu", delim, "hhu", check_uchar);
526 numbers_list_val_width(signed char, "%hhd", delim, "hhd", check_char);
527 numbers_list_val_width(signed char, "%hhd", delim, "hhi", check_char);
528 numbers_list_val_width(unsigned char, "%hhx", delim, "hhx", check_uchar);
529 numbers_list_val_width(unsigned char, "0x%hhx", delim, "hhx", check_uchar);
530 numbers_list_val_width(signed char, "0x%hhx", delim, "hhi", check_char);
> 531 }
532

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (4.67 kB)
.config.gz (38.44 kB)
Download all attachments

2021-07-23 16:16:55

by Richard Fitzgerald

[permalink] [raw]
Subject: Re: lib/test_scanf.c:531:1: warning: the frame size of 2080 bytes is larger than 2048 bytes

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

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

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=]

2021-07-27 09:03:11

by Chen, Rong A

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



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 -- [email protected]
> To unsubscribe send an email to [email protected]