Bug 1223169

Summary: gcc14 compilation fails
Product: [openSUSE] openSUSE Tumbleweed Reporter: Bernhard Wiedemann <bwiedemann>
Component: OtherAssignee: Richard Biener <rguenther>
Status: REOPENED --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: bwiedemann
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: All   
URL: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114895
See Also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114895
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Bernhard Wiedemann 2024-04-21 07:26:31 UTC
While working on reproducible builds for openSUSE, I found that
our gcc14 build fails - possibly because I am using -j1 for deterministic compilation order.

[31724s] /bin/sh ./libtool  --tag=CC   --mode=compile /home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/./gcc/xgcc -B/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/./gcc/ -B/usr/x86_64-suse-linux/bin/ -B/usr/x86_64-suse-linux/lib/ -isystem /usr/x86_64-suse-linux/include -isystem /usr/x86_64-suse-linux/sys-include    -DHAVE_CONFIG_H -I. -I../../../../libgfortran  -iquote../../../../libgfortran/io -I../../../../libgfortran/../gcc -I../../../../libgfortran/../gcc/config  -I../../.././gcc -I../../../../libgfortran/../libgcc -I../../libgcc -I../../../../libgfortran/../libbacktrace -I../../libbacktrace -I../libbacktrace  -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla -fcf-protection -mshstk -fcx-fortran-rules -ffunction-sections -fdata-sections   -g  -O2 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -m32 -MT unix.lo -MD -MP -MF .deps/unix.Tpo -c -o unix.lo `test -f 'io/unix.c' || echo '../../../../libgfortran/'`io/unix.c
[31724s] libtool: compile:  /home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/./gcc/xgcc -B/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/./gcc/ -B/usr/x86_64-suse-linux/bin/ -B/usr/x86_64-suse-linux/lib/ -isystem /usr/x86_64-suse-linux/include -isystem /usr/x86_64-suse-linux/sys-include -DHAVE_CONFIG_H -I. -I../../../../libgfortran -iquote../../../../libgfortran/io -I../../../../libgfortran/../gcc -I../../../../libgfortran/../gcc/config -I../../.././gcc -I../../../../libgfortran/../libgcc -I../../libgcc -I../../../../libgfortran/../libbacktrace -I../../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla -fcf-protection -mshstk -fcx-fortran-rules -ffunction-sections -fdata-sections -g -O2 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -m32 -MT unix.lo -MD -MP -MF .deps/unix.Tpo -c ../../../../libgfortran/io/unix.c  -fPIC -DPIC -o .libs/unix.o
[31724s] ../../../../libgfortran/io/unix.c: In function ‘find_file’:
[31724s] ../../../../libgfortran/io/unix.c:1704:26: error: ‘id’ undeclared (first use in this function)
[31724s]  1704 | # define FIND_FILE0_ARGS id, path
[31724s]       |                          ^~
[31724s] ../../../../libgfortran/io/unix.c:1778:30: note: in expansion of macro ‘FIND_FILE0_ARGS’
[31724s]  1778 |   u = find_file0 (unit_root, FIND_FILE0_ARGS);
[31724s]       |                              ^~~~~~~~~~~~~~~
[31724s] ../../../../libgfortran/io/unix.c:1704:26: note: each undeclared identifier is reported only once for each function it appears in
[31724s]  1704 | # define FIND_FILE0_ARGS id, path
[31724s]       |                          ^~
[31724s] ../../../../libgfortran/io/unix.c:1778:30: note: in expansion of macro ‘FIND_FILE0_ARGS’
[31724s]  1778 |   u = find_file0 (unit_root, FIND_FILE0_ARGS);
[31724s]       |                              ^~~~~~~~~~~~~~~
[31724s] make[6]: *** [Makefile:6863: unix.lo] Error 1
[31724s] make[6]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/x86_64-suse-linux/32/libgfortran'
[31724s] make[5]: *** [Makefile:1677: all] Error 2
[31724s] make[5]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/x86_64-suse-linux/32/libgfortran'
[31724s] make[4]: *** [Makefile:7877: multi-do] Error 1
[31724s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/x86_64-suse-linux/libgfortran'
[31724s] make[3]: *** [Makefile:7847: all-multi] Error 2
[31724s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/x86_64-suse-linux/libgfortran'
[31724s] make[2]: *** [Makefile:1677: all] Error 2
[31724s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-14.0.1+git9885/obj-x86_64-suse-linux/x86_64-suse-linux/libgfortran'
[31724s] make[1]: *** [Makefile:22460: all-target-libgfortran] Error 2
Comment 1 Bernhard Wiedemann 2024-04-21 07:30:10 UTC
Full build log:
http://rb.zq1.de/other/gcc14/gcc14-build-log.txt.xz
Comment 2 Richard Biener 2024-04-30 06:51:54 UTC
The odd thing is this is behind

#ifdef HAVE_WORKING_STAT
# define FIND_FILE0_DECL struct stat *st
# define FIND_FILE0_ARGS st
#else
# define FIND_FILE0_DECL uint64_t id, const char *path
# define FIND_FILE0_ARGS id, path

but yes, if !HAVE_WORKING_STAT the code is broken.  So the question would
be why !HAVE_WORKING_STAT - we're expecting this only for __MINGW32__.
Comment 3 Richard Biener 2024-04-30 06:56:20 UTC
Maybe since this is using -m32 and the test itself isn't built with LFS we fail stat because of a large inode number.
Comment 4 Richard Biener 2024-04-30 07:27:13 UTC
Is this failure reproducible?  Can you tell me how to reproduce in a local build?  I'm second-guessing --define='%do_profiling 0' and maybe -j 1 -t 1
on the osc command-line?
Comment 5 Bernhard Wiedemann 2024-04-30 10:04:19 UTC
Here is a reproducer:

osc co openSUSE:Factory/gcc14 && cd $_
osc build --noservice --clean -j1 --disable-debuginfo standard x86_64

failed after 111s on a fast machine.
It runs in a 1-core VM, so poorly defined dependencies can cause issues
that don't appear in our normal -j4 builds.
Comment 6 Bernhard Wiedemann 2024-04-30 10:33:56 UTC
I just noticed that the lack of --vm-type=kvm makes it run in podman mode
with maximum parallelism.
Comment 7 Richard Biener 2024-04-30 11:30:30 UTC
(In reply to Bernhard Wiedemann from comment #6)
> I just noticed that the lack of --vm-type=kvm makes it run in podman mode
> with maximum parallelism.

Yep.  I can't manage to make --vm-type=kvm work on a SLE15 host, but I edited
the spec file to not use -j on the toplevel make.  Let's see if that reproduces it.

It's the memory-constraints package and

%limit_build -m 900

that seems to make the number of jobs larger and not only smaller in some
cases.
Comment 8 Bernhard Wiedemann 2024-04-30 11:40:06 UTC
For KVM builds, you need to edit your
~/.config/osc/oscrc to set sufficiently high values (in MB) for
build-memory =
build-vmdisk-rootsize =
Comment 9 Bernhard Wiedemann 2024-04-30 16:22:00 UTC
Hmm. Now I cannot reproduce the issue on the other machine.

Maybe that one build machine creates random errors. Need to test some more...
Comment 10 Richard Biener 2024-05-02 07:02:27 UTC
If it ever reproduces can you please preserve the build environment?
Comment 11 Bernhard Wiedemann 2024-05-02 07:38:51 UTC
Found the correct reproducer now:
osc build --noservice --vm-type=kvm \
 --build-opt=--vm-custom-opt=-rtc\ base=2038-01-20T00:00:00 standard x86_64

while a 2037 build worked fine, so (surpisingly) it is a year-2038 issue.