Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 845099 - app-emulation/xen-tools-4.16.0-r4 with gcc-12.1: arch/x86/include/bits/string.h:79:32: error: array subscript ‘union <anonymous>[0]’ is partly outside array bounds of ‘union <anonymous>[1]’ [-Werror=array-bounds]
Summary: app-emulation/xen-tools-4.16.0-r4 with gcc-12.1: arch/x86/include/bits/string...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tomáš Mózes
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: werror gcc-12
  Show dependency tree
 
Reported: 2022-05-16 23:07 UTC by Kobboi
Modified: 2022-07-04 11:00 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.gz (build.log.gz,56.84 KB, application/gzip)
2022-05-16 23:07 UTC, Kobboi
Details
emerge-info.txt (emerge-info.txt,7.80 KB, text/plain)
2022-05-16 23:07 UTC, Kobboi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kobboi 2022-05-16 23:07:11 UTC
Using gcc-12.1.1_pre20220514:

(...)

  [BUILD] bin/interface.o
In file included from include/string.h:23,
                 from include/ipxe/uaccess.h:25,
                 from core/acpi.c:28:
In function ‘__constant_memcpy’,
    inlined from ‘memcpy’ at arch/x86/include/bits/string.h:168:10,
    inlined from ‘trivial_memcpy_user’ at include/ipxe/uaccess.h:109:2,
    inlined from ‘memcpy_user’ at arch/x86/include/librm.h:155:2,
    inlined from ‘copy_from_user’ at include/ipxe/uaccess.h:338:2,
    inlined from ‘acpi_sx_zsdt’ at core/acpi.c:220:3:
arch/x86/include/bits/string.h:79:32: error: array subscript ‘union <anonymous>[0]’ is partly outside array bounds of ‘union <anonymous>[1]’ [-Werror=array-bounds]
   79 |                 dest_u->u32[0] = src_u->u32[0];
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
core/acpi.c: In function ‘acpi_sx_zsdt’:
core/acpi.c:194:11: note: object ‘buf’ of size 4
  194 |         } buf;
      |           ^~~
  [BUILD] bin/iobuf.o
  [BUILD] bin/iomap_virt.o
  [BUILD] bin/isqrt.o
  [BUILD] bin/job.o
  [BUILD] bin/linebuf.o
  [BUILD] bin/lineconsole.o
  [BUILD] bin/list.o
  [BUILD] bin/log.o
  [BUILD] bin/main.o
  [BUILD] bin/malloc.o
(...)



Reproducible: Always
Comment 1 Kobboi 2022-05-16 23:07:21 UTC
Created attachment 779282 [details]
build.log.gz
Comment 2 Kobboi 2022-05-16 23:07:23 UTC
Created attachment 779285 [details]
emerge-info.txt
Comment 3 Kobboi 2022-05-23 14:19:12 UTC
It seems Fedora is handling this by setting this warning as non-fatal:

https://src.fedoraproject.org/rpms/xen/blob/rawhide/f/xen.gcc12.fixes.patch

$(call cc-option-add,CFLAGS,CC,-Wno-error=array-bounds)
Comment 4 Kobboi 2022-05-23 14:33:22 UTC
Should have taken a closer look because that patch does not fix the error logged. Also, seems like we're maintaining a patchset out-of-tree so I can't really help there.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-10 10:25:56 UTC
ping
Comment 6 Florian Schmaus gentoo-dev 2022-06-10 20:41:08 UTC
The errors origin in ("bundled") ipxe. I am not sure what the best course of action is. I think that the current version of sys-firmware/ipxe 1.21.1 should be also affected by this, because it appears to be even older than the Xen version (1.21.1 is from 2020-12-31, the Xen version 3c040ad, is from 2021-06-11).

We could try to apply upstream commit 02ec659b73b0 ("[acpi] Generalise DSDT/SSDT data extraction logic"), that looks like it could at least fix one error.
Comment 7 Kobboi 2022-06-10 20:55:00 UTC
FYI, ipxe-1.21.1[*,-binary] compiles just fine with gcc-12.2.9999 (May 30th version)
Comment 8 Florian Schmaus gentoo-dev 2022-06-10 22:09:15 UTC
(In reply to Kobboi from comment #7)
> FYI, ipxe-1.21.1[*,-binary] compiles just fine with gcc-12.2.9999 (May 30th
> version)

Try removing the "export NO_WERROR=1" [1] in the ebuild's src_compile() phase. Then it will fail with the same errors.

1: https://github.com/gentoo/gentoo/blob/1c040cb550fa6ab596ec2297f47113d7a4fd90a4/sys-firmware/ipxe/ipxe-1.21.1.ebuild#L78
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-21 04:31:40 UTC
With some luck, GCC 12 will be unleashed in ~arch around Sunday. If a bug gets fixed upstream.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-25 05:06:26 UTC
(In reply to Sam James from comment #9)
> With some luck, GCC 12 will be unleashed in ~arch around Sunday. If a bug
> gets fixed upstream.

ping