public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of
@ 2022-02-23 8:12 pmenzel+gcc at molgen dot mpg.de
2022-02-23 8:17 ` [Bug tree-optimization/104655] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: pmenzel+gcc at molgen dot mpg.de @ 2022-02-23 8:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
Bug ID: 104655
Summary: [12 Regression] array subscript 0 is outside array
bounds of
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pmenzel+gcc at molgen dot mpg.de
Target Milestone: ---
Building SeaBIOS and coreboot with GCC 12 from Debian sid/unstable
gcc-12 (Debian 12-20220222-1) 12.0.1 20220222 (experimental) [master
r12-7325-g2f59f067610]
new warnings and errors are shown.
SeaBIOS (commit 829b0f1 (nvme: fix LBA format data structure)):
```
Compile checking out/src/optionroms.o
In function 'boot_irq_captured',
inlined from 'init_pcirom' at src/optionroms.c:344:28:
src/optionroms.c:314:25: warning: array subscript 0 is outside array bounds of
'struct segoff_s[0]' [-Warray-bounds]
314 | return GET_IVT(0x19).segoff != FUNC16(entry_19_official).segoff;
In function 'boot_irq_captured',
inlined from 'init_pcirom' at src/optionroms.c:348:9:
src/optionroms.c:314:25: warning: array subscript 0 is outside array bounds of
'struct segoff_s[0]' [-Warray-bounds]
314 | return GET_IVT(0x19).segoff != FUNC16(entry_19_official).segoff;
In file included from src/optionroms.c:10:
In function 'boot_irq_restore',
inlined from 'init_pcirom' at src/optionroms.c:354:9:
src/farptr.h:182:35: warning: array subscript 0 is outside array bounds of
'struct segoff_s[0]' [-Warray-bounds]
182 | do { GET_FARVAR((seg), (var)) = (val); } while (0)
| ^
src/biosvar.h:22:5: note: in expansion of macro 'SET_FARVAR'
22 | SET_FARVAR(SEG_IVT, ((struct rmode_IVT *)0)->ivec[vector], segoff)
| ^~~~~~~~~~
src/optionroms.c:322:5: note: in expansion of macro 'SET_IVT'
322 | SET_IVT(0x19, seabios);
| ^~~~~~~
src/farptr.h:182:35: warning: array subscript 1 is outside array bounds of
'struct segoff_s[0]' [-Warray-bounds]
182 | do { GET_FARVAR((seg), (var)) = (val); } while (0)
| ^
src/biosvar.h:22:5: note: in expansion of macro 'SET_FARVAR'
22 | SET_FARVAR(SEG_IVT, ((struct rmode_IVT *)0)->ivec[vector], segoff)
| ^~~~~~~~~~
src/optionroms.c:322:5: note: in expansion of macro 'SET_IVT'
322 | SET_IVT(0x19, seabios);
| ^~~~~~~
```
(There are more of similar kind.)
coreboot (commit 5bba93e0 (mb/google/brya: Enable eMMC HS400 mode for nissa)),
and editing `util/xcompile/xcompile` to use GCC 12, building Asus F2A85-M PRO:
```
CC
libagesa/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.o
x86_64-linux-gnu-gcc-12 -MMD -Isrc -Isrc/include -Isrc/commonlib/include
-Isrc/commonlib/bsd/include -Ibuild -I3rdparty/vboot/firmware/include -include
src/include/kconfig.h -include src/include/rules.h -include
src/commonlib/bsd/include/commonlib/bsd/compiler.h -I3rdparty
-D__BUILD_DIR__=\"build\" -Isrc/soc/amd/common/block/include/
-Isrc/arch/x86/include -Isrc/southbridge/amd/agesa/hudson
-Isrc/vendorcode/amd/include -Isrc/vendorcode/amd/agesa/f15tn
-Isrc/vendorcode/amd/agesa/f15tn/../common
-Isrc/vendorcode/amd/agesa/f15tn/Include
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Common
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Common
-D__ARCH_x86_32__ -pipe -g -nostdinc -std=gnu11 -nostdlib -Wall -Wundef
-Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls
-Wno-trigraphs -Wimplicit-fallthrough -Wshadow -Wdate-time -Wtype-limits -Wvla
-Wdangling-else -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
-fstrict-aliasing -ffunction-sections -fdata-sections -fno-pie
-Wno-packed-not-aligned -fconserve-stack -Wnull-dereference -Wreturn-type
-Wlogical-op -Wduplicated-cond -Wno-unused-but-set-variable -Werror -Os
-Wno-address-of-packed-member -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -m32
-fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none
-fno-delete-null-pointer-checks -Wlogical-op -march=i686 -mno-mmx
-march=k8-sse3 -mtune=k8-sse3 -fno-strict-aliasing -MT
build/libagesa/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.o
-D__LIBAGESA__ -fno-zero-initialized-in-bss -Isrc/vendorcode/amd/include
-Isrc/vendorcode/amd/agesa/f15tn -Isrc/vendorcode/amd/agesa/f15tn/../common
-Isrc/vendorcode/amd/agesa/f15tn/Include -Isrc/vendorcode/amd/agesa/f15tn/Proc
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Tech
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Tech/DDR3
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Ps
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Ps/TN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Ps/TN/FS1
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Ps/TN/FP2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Ps/TN/FM2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/NB
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/NB/TN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Main
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/TN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/TABLE
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/S3
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/PARTRN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/ODTHERMAL
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/MEMCLR
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/LVDDR3
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/INTLVRN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/IDENDIMM
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/EXCLUDIMM
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/ECC
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/DMI
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/CSINTLV
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/CRAT
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Feat/CHINTLV
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Mem/Ardk
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Perf
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Library
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Family/0x15
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Family/0x15/TN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Debug
-Isrc/vendorcode/amd/agesa/f15tn/Proc/IDS/Control
-Isrc/vendorcode/amd/agesa/f15tn/Proc/HT
-Isrc/vendorcode/amd/agesa/f15tn/Proc/HT/Fam15Mod1x
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbTable
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbSview
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbSbLib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbSbIommuLib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbSSocketLib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieTrainingV1
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieInitLibV4
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieInitLibV1
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieClkPm
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieAspm
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieAlibV1
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbNbInitLibV4
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbNbInitLibV1
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbMSocketLib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbIvrsLib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbIommuScratch
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbIommuIvrs
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbGfxInitLibV1
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbGfxConfig
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbFamTranslation
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbCommonLib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Library
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Library/GnbTimerLibWrap0
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Include
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Include/Library
-Isrc/vendorcode/amd/agesa/f15tn/Proc/GNB/Common
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Usb
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Usb/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Usb/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Spi
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Spi/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Spi/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Sd
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Sd/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Sd/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Sata
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Sata/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Sata/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcib
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Ir
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Interface
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Interface/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Interface/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Imc
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Imc/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Imc/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Ide
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Hwm
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Hwm/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Hwm/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/HwAcpi
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/HwAcpi/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/HwAcpi/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Gec
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Gec/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Gec/Family/Hudson2
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Common
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Fch/Azalia
-Isrc/vendorcode/amd/agesa/f15tn/Proc/Common
-Isrc/vendorcode/amd/agesa/f15tn/Proc/CPU
-Isrc/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature
-Isrc/vendorcode/amd/agesa/f15tn/Proc/CPU/Family
-Isrc/vendorcode/amd/agesa/f15tn/Proc/CPU/Family/0x15
-Isrc/vendorcode/amd/agesa/f15tn/Proc/CPU/Family/0x15/TN -c -o
build/libagesa/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.o
src/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.c
src/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatureLeveling.c: In
function 'FeatureLeveling':
src/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatureLeveling.c:149:3:
error: array subscript 0 is outside array bounds of 'UINT64[0]' {aka 'long long
unsigned int[]'} [-Werror=array-bounds]
149 | *FirstTime = TRUE;
| ^~~~~~~~~~
src/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatureLeveling.c:150:3:
error: array subscript 0 is outside array bounds of 'UINT64[0]' {aka 'long long
unsigned int[]'} [-Werror=array-bounds]
150 | *NeedLeveling = FALSE;
| ^~~~~~~~~~~~~
src/vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatureLeveling.c:171:7:
error: array subscript 0 is outside array bounds of 'UINT64[0]' {aka 'long long
unsigned int[]'} [-Werror=array-bounds]
171 | if (*NeedLeveling) {
| ^~~~~~~~~~~~~
```
QEMU i440fx fails too:
```
CC bootblock/cpu/x86/lapic/lapic.o
x86_64-linux-gnu-gcc-12 -MMD -Isrc -Isrc/include -Isrc/commonlib/include
-Isrc/commonlib/bsd/include -Ibuild -I3rdparty/vboot/firmware/include -include
src/include/kconfig.h -include src/include/rules.h -include
src/commonlib/bsd/include/commonlib/bsd/compiler.h -I3rdparty
-D__BUILD_DIR__=\"build\" -Isrc/arch/x86/include -D__ARCH_x86_32__ -pipe -g
-nostdinc -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes
-Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs
-Wimplicit-fallthrough -Wshadow -Wdate-time -Wtype-limits -Wvla -Wdangling-else
-fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -fstrict-aliasing
-ffunction-sections -fdata-sections -fno-pie -Wno-packed-not-aligned
-fconserve-stack -Wnull-dereference -Wreturn-type -Wlogical-op
-Wduplicated-cond -Wno-unused-but-set-variable -Werror -Os
-Wno-address-of-packed-member -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -m32
-fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none
-fno-delete-null-pointer-checks -Wlogical-op -march=i686 -mno-mmx -MT
build/bootblock/cpu/x86/lapic/lapic.o -D__BOOTBLOCK__ -c -o
build/bootblock/cpu/x86/lapic/lapic.o src/cpu/x86/lapic/lapic.c
In file included from src/include/cpu/x86/lapic.h:4,
from src/cpu/x86/lapic/lapic.c:5:
In function 'read32',
inlined from 'xapic_read' at src/include/cpu/x86/lapic.h:13:9,
inlined from 'lapic_read' at src/include/cpu/x86/lapic.h:80:10,
inlined from 'lapicid' at src/include/cpu/x86/lapic.h:138:21,
inlined from 'enable_lapic' at src/cpu/x86/lapic/lapic.c:41:3:
src/arch/x86/include/arch/mmio.h:20:16: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
20 | return *((volatile uint32_t *)(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'read32',
inlined from 'xapic_read' at src/include/cpu/x86/lapic.h:13:9,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:103:11,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:73:2:
src/arch/x86/include/arch/mmio.h:20:16: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
20 | return *((volatile uint32_t *)(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'write32',
inlined from 'xapic_write' at src/include/cpu/x86/lapic.h:18:2,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:106:3,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:73:2:
src/arch/x86/include/arch/mmio.h:40:40: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
40 | *((volatile uint32_t *)(addr)) = value;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In function 'read32',
inlined from 'xapic_read' at src/include/cpu/x86/lapic.h:13:9,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:103:11,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:77:2:
src/arch/x86/include/arch/mmio.h:20:16: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
20 | return *((volatile uint32_t *)(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'write32',
inlined from 'xapic_write' at src/include/cpu/x86/lapic.h:18:2,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:106:3,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:77:2:
src/arch/x86/include/arch/mmio.h:40:40: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
40 | *((volatile uint32_t *)(addr)) = value;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In function 'read32',
inlined from 'xapic_read' at src/include/cpu/x86/lapic.h:13:9,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:103:11,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:86:3:
src/arch/x86/include/arch/mmio.h:20:16: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
20 | return *((volatile uint32_t *)(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'write32',
inlined from 'xapic_write' at src/include/cpu/x86/lapic.h:18:2,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:106:3,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:86:3:
src/arch/x86/include/arch/mmio.h:40:40: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
40 | *((volatile uint32_t *)(addr)) = value;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In function 'read32',
inlined from 'xapic_read' at src/include/cpu/x86/lapic.h:13:9,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:103:11,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:84:3:
src/arch/x86/include/arch/mmio.h:20:16: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
20 | return *((volatile uint32_t *)(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'write32',
inlined from 'xapic_write' at src/include/cpu/x86/lapic.h:18:2,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:106:3,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:84:3:
src/arch/x86/include/arch/mmio.h:40:40: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
40 | *((volatile uint32_t *)(addr)) = value;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In function 'read32',
inlined from 'xapic_read' at src/include/cpu/x86/lapic.h:13:9,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:103:11,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:89:2:
src/arch/x86/include/arch/mmio.h:20:16: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
20 | return *((volatile uint32_t *)(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'write32',
inlined from 'xapic_write' at src/include/cpu/x86/lapic.h:18:2,
inlined from 'lapic_update32' at src/include/cpu/x86/lapic.h:106:3,
inlined from 'setup_lapic_interrupts' at src/cpu/x86/lapic/lapic.c:89:2:
src/arch/x86/include/arch/mmio.h:40:40: error: array subscript 0 is outside
array bounds of 'const volatile void[0]' [-Werror=array-bounds]
40 | *((volatile uint32_t *)(addr)) = value;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
```
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
@ 2022-02-23 8:17 ` pinskia at gcc dot gnu.org
2022-02-23 10:39 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-23 8:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide the preprocessed source in all cases?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
2022-02-23 8:17 ` [Bug tree-optimization/104655] " pinskia at gcc dot gnu.org
@ 2022-02-23 10:39 ` pinskia at gcc dot gnu.org
2022-02-23 10:42 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-23 10:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=99578
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am 90% sure this is just another dup of bug 99578.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
2022-02-23 8:17 ` [Bug tree-optimization/104655] " pinskia at gcc dot gnu.org
2022-02-23 10:39 ` pinskia at gcc dot gnu.org
@ 2022-02-23 10:42 ` rguenth at gcc dot gnu.org
2022-02-23 10:49 ` pmenzel+gcc at molgen dot mpg.de
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-23 10:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-02-23
Status|UNCONFIRMED |WAITING
Target Milestone|--- |12.0
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
` (2 preceding siblings ...)
2022-02-23 10:42 ` rguenth at gcc dot gnu.org
@ 2022-02-23 10:49 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 10:53 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pmenzel+gcc at molgen dot mpg.de @ 2022-02-23 10:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
--- Comment #3 from Paul Menzel <pmenzel+gcc at molgen dot mpg.de> ---
(In reply to Andrew Pinski from comment #2)
> I am 90% sure this is just another dup of bug 99578.
Are you sure, because the warnings/errors are not there with GCC 11.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
` (3 preceding siblings ...)
2022-02-23 10:49 ` pmenzel+gcc at molgen dot mpg.de
@ 2022-02-23 10:53 ` jakub at gcc dot gnu.org
2022-02-23 11:14 ` pmenzel+gcc at molgen dot mpg.de
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-23 10:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is still very likely.
But if you provide what you are asked for we could know for sure.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
` (4 preceding siblings ...)
2022-02-23 10:53 ` jakub at gcc dot gnu.org
@ 2022-02-23 11:14 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 12:04 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pmenzel+gcc at molgen dot mpg.de @ 2022-02-23 11:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
--- Comment #5 from Paul Menzel <pmenzel+gcc at molgen dot mpg.de> ---
Created attachment 52498
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52498&action=edit
Preprocessed file `build/bootblock/cpu/x86/lapic/lapic.i` with `-save-temps`
Sorry for not sharing the file in the first place. First for the coreboot case:
$ x86_64-linux-gnu-gcc-12 -save-temps -MMD -Isrc -Isrc/include
-Isrc/commonlib/include -Isrc/commonlib/bsd/include -Ibuild
-I3rdparty/vboot/firmware/include -include src/include/kconfig.h -include
src/include/rules.h -include src/commonlib/bsd/include/commonlib/bsd/compiler.h
-I3rdparty -D__BUILD_DIR__=\"build\" -Isrc/arch/x86/include -D__ARCH_x86_32__
-pipe -g -nostdinc -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes
-Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs
-Wimplicit-fallthrough -Wshadow -Wdate-time -Wtype-limits -Wvla -Wdangling-else
-fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -fstrict-aliasing
-ffunction-sections -fdata-sections -fno-pie -Wno-packed-not-aligned
-fconserve-stack -Wnull-dereference -Wreturn-type -Wlogical-op
-Wduplicated-cond -Wno-unused-but-set-variable -Werror -Os
-Wno-address-of-packed-member -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -m32
-fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none
-fno-delete-null-pointer-checks -Wlogical-op -march=i686 -mno-mmx -MT
build/bootblock/cpu/x86/lapic/lapic.o -D__BOOTBLOCK__ -c -o
build/bootblock/cpu/x86/lapic/lapic.o src/cpu/x86/lapic/lapic.c
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
` (5 preceding siblings ...)
2022-02-23 11:14 ` pmenzel+gcc at molgen dot mpg.de
@ 2022-02-23 12:04 ` pinskia at gcc dot gnu.org
2022-02-23 12:10 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 17:55 ` msebor at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-23 12:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Paul Menzel from comment #5)
> Created attachment 52498 [details]
> Preprocessed file `build/bootblock/cpu/x86/lapic/lapic.i` with `-save-temps`
>
> Sorry for not sharing the file in the first place. First for the coreboot
> case:
This case is a dup of bug 99578.
lapicid:
uint32_t lapicid = lapic_read(0x020);
static inline __attribute__((always_inline)) uint32_t lapic_read(unsigned int
reg)
{
if (is_x2apic_mode())
return x2apic_read(reg);
else
return xapic_read(reg);
}
static inline __attribute__((always_inline)) uint32_t xapic_read(unsigned int
reg)
{
return read32((volatile void *)(uintptr_t)(0xfee00000 + reg));
}
static inline __attribute__((always_inline)) uint32_t read32(const volatile
void *addr)
{
return *((volatile uint32_t *)(addr));
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
` (6 preceding siblings ...)
2022-02-23 12:04 ` pinskia at gcc dot gnu.org
@ 2022-02-23 12:10 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 17:55 ` msebor at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pmenzel+gcc at molgen dot mpg.de @ 2022-02-23 12:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
--- Comment #7 from Paul Menzel <pmenzel+gcc at molgen dot mpg.de> ---
Thank you for the analysis. Excuse my ignorance, but the referenced bug
(possible dup) says it’s a regression in GCC 11, but it does not show up here
with GCC 11. Are more issues tracked in bug 99578?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/104655] [12 Regression] array subscript 0 is outside array bounds of
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
` (7 preceding siblings ...)
2022-02-23 12:10 ` pmenzel+gcc at molgen dot mpg.de
@ 2022-02-23 17:55 ` msebor at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-02-23 17:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104655
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
CC| |msebor at gcc dot gnu.org
Status|WAITING |RESOLVED
--- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning in the test case in comment #6 is intentional: it triggers because
the hardcoded address (0xfee00000) doesn't refer to a known object, same as in
the test case in bug 99578 comment 0. The bug is still open because there's a
lack of consensus as to whether or how GCC should be enhanced to accept such
code without a warning. -Warray-bounds and -Wstringop-overflow/-overread
depend on optimizations some of which tend to expose new instances of warnings
as optimizers improve from one release to another.
*** This bug has been marked as a duplicate of bug 99578 ***
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-02-23 17:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 8:12 [Bug tree-optimization/104655] New: [12 Regression] array subscript 0 is outside array bounds of pmenzel+gcc at molgen dot mpg.de
2022-02-23 8:17 ` [Bug tree-optimization/104655] " pinskia at gcc dot gnu.org
2022-02-23 10:39 ` pinskia at gcc dot gnu.org
2022-02-23 10:42 ` rguenth at gcc dot gnu.org
2022-02-23 10:49 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 10:53 ` jakub at gcc dot gnu.org
2022-02-23 11:14 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 12:04 ` pinskia at gcc dot gnu.org
2022-02-23 12:10 ` pmenzel+gcc at molgen dot mpg.de
2022-02-23 17:55 ` msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).