ibm-s390-linux / s390-tools

Tools for use with the s390 Linux kernel and device drivers
MIT License
62 stars 58 forks source link

genprotimg fails to build with GCC 12 #130

Closed sharkcz closed 2 years ago

sharkcz commented 2 years ago

genprotimg failed to build during the recent mass-rebuild in Fedora. Seems GCC 12 reports a new issue and combined with -Werror in stops the build.

gcc -I ../../include -D_GNU_SOURCE -fno-pie -Os -g -I../..//zipl/boot -I../..//zipl/include -I../..//include -DENABLE_SCLP_ASCII=1 -DS390_TOOLS_RELEASE=2.19.0-3.fc36 -fno-builtin -ffreestanding -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -fexec-charset=IBM1047 -m64 -mpacked-stack -mstack-size=4096 -mstack-guard=128 -msoft-float -Wall -Wformat-security -Wextra -Werror -c stage3a.c -o stage3a.o
In file included from stage3a.c:14:
In function '__test_facility',
    inlined from 'test_facility' at ../../include/boot/s390.h:428:9,
    inlined from 'start' at stage3a.c:42:7:
../../include/boot/s390.h:418:17: error: array subscript 0 is outside array bounds of 'void[0]' [-Werror=array-bounds]
  418 |         return (*ptr & (0x80 >> (nr & 7))) != 0;
      |                 ^~~~
cc1: all warnings being treated as errors
make[2]: *** [../../common.mak:268: stage3a.o] Error 1

see https://koji.fedoraproject.org/koji/taskinfo?taskID=81640175 for all details

mhartmay commented 2 years ago

Hi Dan,

thanks for reporting! At first glance, it seems to be a false positive - but I am going to take a closer look tomorrow.

sharkcz commented 2 years ago

yeah, they are often false-positives. Please ping your toolchain guys too, sometimes those false positives are s390x specific.

mhartmay commented 2 years ago

Hi Dan,

seems like gcc-12 is too smart :) Currently, we simply cast address 0x0 to struct _lowcore (https://github.com/ibm-s390-linux/s390-tools/blob/master/include/boot/s390.h#L214) and this causes the problems. I'm working on a fix where the s390_lowcore is properly allocated.