Dear SeaBIOS folks,
Using GCC 11.1 to build SeaBIOS I get the warnings below.
```
In file included from scripts/kconfig/zconf.tab.c:2534:
/dev/shm/coreboot/payloads/external/SeaBIOS/seabios/scripts/kconfig/confdata.c:
In function 'conf_write':
/dev/shm/coreboot/payloads/external/SeaBIOS/seabios/scripts/kconfig/confdata.c:774:20:
warning: '.tmpconfig.' directive writing 11 bytes into a region of size
between 1 and 4097 [-Wformat-overflow=]
774 | sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
| ^~~~~~~~~~~~~~~~~
/dev/shm/coreboot/payloads/external/SeaBIOS/seabios/scripts/kconfig/confdata.c:774:3:
note: 'sprintf' output between 13 and 4119 bytes into a destination of
size 4097
774 | sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
Compile checking out/src/post.o
src/post.c: In function 'reloc_preinit':
src/post.c:248:34: warning: array subscript 'u32 {aka unsigned int}[0]'
is partly outside array bounds of 'char[1]' [-Warray-bounds]
248 | *((u32*)(dest + *reloc)) += delta;
| ^~
In file included from src/biosvar.h:11,
from src/post.c:8:
src/post.c:278:26: note: while referencing 'code32flat_start'
278 | updateRelocs(VSYMBOL(code32flat_start),
VSYMBOL(_reloc_init_start)
| ^~~~~~~~~~~~~~~~
src/memmap.h:18:36: note: in definition of macro 'SYMBOL'
18 | #define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; })
| ^~~
src/post.c:278:18: note: in expansion of macro 'VSYMBOL'
278 | updateRelocs(VSYMBOL(code32flat_start),
VSYMBOL(_reloc_init_start)
| ^~~~~~~
src/post.c:248:34: warning: array subscript 'u32 {aka unsigned int}[0]'
is partly outside array bounds of 'char[1]' [-Warray-bounds]
248 | *((u32*)(dest + *reloc)) += delta;
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from src/biosvar.h:11,
from src/post.c:8:
src/post.c:278:26: note: while referencing 'code32flat_start'
278 | updateRelocs(VSYMBOL(code32flat_start),
VSYMBOL(_reloc_init_start)
| ^~~~~~~~~~~~~~~~
src/memmap.h:18:36: note: in definition of macro 'SYMBOL'
18 | #define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; })
| ^~~
src/post.c:278:18: note: in expansion of macro 'VSYMBOL'
278 | updateRelocs(VSYMBOL(code32flat_start),
VSYMBOL(_reloc_init_start)
| ^~~~~~~
```
```
Compile checking out/src/fw/smm.o
In file included from src/fw/smm.c:18:
In function 'smm_save_and_copy',
inlined from 'ich9_lpc_apmc_smm_setup' at src/fw/smm.c:216:5:
src/string.h:23:16: warning: '__builtin_memcpy' offset [0, 511] is out
of the bounds [0, 0] [-Warray-bounds]
23 | #define memcpy __builtin_memcpy
src/fw/smm.c:148:5: note: in expansion of macro 'memcpy'
148 | memcpy(&smm->cpu, &initsmm->cpu, sizeof(smm->cpu));
| ^~~~~~
In function 'smm_relocate_and_restore',
inlined from 'ich9_lpc_apmc_smm_setup' at src/fw/smm.c:227:5:
src/string.h:23:16: warning: '__builtin_memcpy' offset [0, 511] is out
of the bounds [0, 0] [-Warray-bounds]
23 | #define memcpy __builtin_memcpy
src/fw/smm.c:171:5: note: in expansion of macro 'memcpy'
171 | memcpy(&initsmm->cpu, &smm->cpu, sizeof(initsmm->cpu));
| ^~~~~~
```
```
Compiling whole program out/ccode32flat.o
In file included from out/ccode32flat.o.tmp.c:42:
./src/post.c: In function 'dopost':
./src/post.c:248:34: warning: array subscript 'u32 {aka unsigned
int}[0]' is partly outside array bounds of 'char[1]' [-Warray-bounds]
248 | *((u32*)(dest + *reloc)) += delta;
| ^~
In file included from ./src/biosvar.h:11,
from ./src/misc.c:8,
from out/ccode32flat.o.tmp.c:1:
./src/fw/shadow.c:190:29: note: while referencing 'code32flat_start'
190 | u32 cstart = SYMBOL(code32flat_start), cend =
SYMBOL(code32flat_end);
| ^~~~~~~~~~~~~~~~
./src/memmap.h:18:36: note: in definition of macro 'SYMBOL'
18 | #define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; })
| ^~~
In file included from out/ccode32flat.o.tmp.c:42:
./src/post.c:248:34: warning: array subscript 'u32 {aka unsigned
int}[0]' is partly outside array bounds of 'char[1]' [-Warray-bounds]
248 | *((u32*)(dest + *reloc)) += delta;
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from ./src/biosvar.h:11,
from ./src/misc.c:8,
from out/ccode32flat.o.tmp.c:1:
./src/fw/shadow.c:190:29: note: while referencing 'code32flat_start'
190 | u32 cstart = SYMBOL(code32flat_start), cend =
SYMBOL(code32flat_end);
| ^~~~~~~~~~~~~~~~
./src/memmap.h:18:36: note: in definition of macro 'SYMBOL'
18 | #define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; })
|
```
Kind regards,
Paul