Bug 98341 - [11 Regression] Ada bootstrap fails with erroneous memory access on m68k
Summary: [11 Regression] Ada bootstrap fails with erroneous memory access on m68k
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 11.0
: P4 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL: https://buildd.debian.org/status/fetc...
Keywords: build
Depends on:
Blocks:
 
Reported: 2020-12-17 08:31 UTC by John Paul Adrian Glaubitz
Modified: 2023-08-08 22:24 UTC (History)
9 users (show)

See Also:
Host:
Target: m68k-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-05-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Paul Adrian Glaubitz 2020-12-17 08:31:36 UTC
Bootstrapping Ada works fine with gcc-10, but is broken with gcc-11/trunk:

+===========================GNAT BUG DETECTED==============================+
| 11.0.0 20201214 (experimental) [master revision cf7efe2d36f:0bf15ad54b9:ab28eac607637a641fbec27c5f6bbe9b6197c80f] (m68k-linux-gnu) |
| Storage_Error stack overflow or erroneous memory access                  |
| No source file position information available                            |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

../../src/gcc/ada/gcc-interface/system.ads
../../src/gcc/ada/sem_aggr.adb
../../src/gcc/ada/sem_aggr.ads
../../src/gcc/ada/types.ads
../../src/gcc/ada/libgnat/unchconv.ads
../../src/gcc/ada/libgnat/unchdeal.ads
../../src/gcc/ada/aspects.ads
../../src/gcc/ada/namet.ads
../../src/gcc/ada/alloc.ads
../../src/gcc/ada/hostparm.ads
../../src/gcc/ada/table.ads
ada/snames.ads
../../src/gcc/ada/atree.ads
../../src/gcc/ada/sinfo.ads
../../src/gcc/ada/uintp.ads
../../src/gcc/ada/urealp.ads
../../src/gcc/ada/einfo.ads
../../src/gcc/ada/checks.ads
../../src/gcc/ada/errout.ads
../../src/gcc/ada/err_vars.ads
../../src/gcc/ada/erroutc.ads
../../src/gcc/ada/elists.ads
../../src/gcc/ada/expander.ads
../../src/gcc/ada/exp_ch6.ads
../../src/gcc/ada/exp_tss.ads
../../src/gcc/ada/exp_util.ads
../../src/gcc/ada/rtsfind.ads
../../src/gcc/ada/freeze.ads
../../src/gcc/ada/itypes.ads
../../src/gcc/ada/sem_util.ads
../../src/gcc/ada/opt.ads
../../src/gcc/ada/libgnat/s-string.ads
../../src/gcc/ada/libgnat/ada.ads
../../src/gcc/ada/libgnat/a-uncdea.ads
../../src/gcc/ada/libgnat/s-wchcon.ads
../../src/gcc/ada/lib.ads
../../src/gcc/ada/libgnat/gnat.ads
../../src/gcc/ada/libgnat/g-htable.ads
../../src/gcc/ada/libgnat/s-htable.ads
../../src/gcc/ada/lib-xref.ads
../../src/gcc/ada/spark_xrefs.ads
../../src/gcc/ada/namet-sp.ads
ada/nmake.ads
../../src/gcc/ada/nlists.ads
../../src/gcc/ada/restrict.ads
../../src/gcc/ada/rident.ads
../../src/gcc/ada/libgnat/s-rident.ads
../../src/gcc/ada/sem.ads
../../src/gcc/ada/sem_aux.ads
../../src/gcc/ada/sem_cat.ads
../../src/gcc/ada/sem_ch3.ads
../../src/gcc/ada/sem_ch5.ads
../../src/gcc/ada/sem_ch8.ads
../../src/gcc/ada/sem_ch13.ads
../../src/gcc/ada/sem_disp.ads
../../src/gcc/ada/sem_dim.ads
../../src/gcc/ada/sem_eval.ads
../../src/gcc/ada/sem_res.ads
../../src/gcc/ada/sem_type.ads
../../src/gcc/ada/sem_warn.ads
../../src/gcc/ada/stringt.ads
../../src/gcc/ada/stand.ads
../../src/gcc/ada/style.ads
../../src/gcc/ada/styleg.ads
../../src/gcc/ada/targparm.ads
../../src/gcc/ada/tbuild.ads
../../src/gcc/ada/ttypes.ads
../../src/gcc/ada/set_targ.ads
../../src/gcc/ada/libgnat/s-stalib.ads
../../src/gcc/ada/libgnat/a-unccon.ads
../../src/gcc/ada/libgnat/s-exctab.ads
../../src/gcc/ada/libgnat/s-unstyp.ads
../../src/gcc/ada/libgnat/s-conca2.ads
../../src/gcc/ada/libgnat/s-assert.ads
../../src/gcc/ada/libgnat/a-except.ads
../../src/gcc/ada/libgnat/s-parame.ads
../../src/gcc/ada/libgnat/s-traent.ads
../../src/gcc/ada/atree.adb
../../src/gcc/ada/debug.ads
../../src/gcc/ada/output.ads
../../src/gcc/ada/libgnat/s-os_lib.ads
../../src/gcc/ada/sinput.ads
../../src/gcc/ada/casing.ads
../../src/gcc/ada/libgnat/g-hesorg.ads

compilation abandoned
make[5]: *** [../../src/gcc/ada/gcc-interface/Make-lang.in:139: ada/sem_aggr.o] Error 1
make[5]: *** Waiting for unfinished jobs....
rm gpl.pod cpp.pod fsf-funding.pod gcc.pod gfdl.pod gcov-tool.pod lto-dump.pod gcov.pod gcov-dump.pod gdc.pod gfortran.pod
Comment 1 Mikael Pettersson 2020-12-18 08:00:00 UTC
I recently got a similar error which I'm currently trying to bisect. gcc-11-20201018 was Ok.

+===========================GNAT BUG DETECTED==============================+
| 11.0.0 20201206 (experimental) (m68k-unknown-linux-gnu) Storage_Error stack overflow or erroneous memory access|
| No source file position information available                            |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

/mnt/scratch/gcc-11-20201206/gcc/ada/gcc-interface/system.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-except.adb
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-except.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/ada.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-parame.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-stalib.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-unccon.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-traent.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-except.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-excdeb.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-soflin.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-secsta.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-stoele.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-stache.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-wchcon.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-wchstw.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-traceb.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-trasym.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-exctab.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-excach.adb
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-exexda.adb
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-exexpr.adb
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-uncdea.ads
ada/libgnat/s-excmac.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-exextr.adb
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-elchha.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-imgint.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-imagei.ads
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/a-exstat.adb
/mnt/scratch/gcc-11-20201206/gcc/ada/libgnat/s-stoele.adb

compilation abandoned
make[3]: *** [/mnt/scratch/gcc-11-20201206/gcc/ada/gcc-interface/Make-lang.in:1053: ada/libgnat/a-except.o] Error 1
make[3]: Leaving directory '/mnt/scratch/objdir11/gcc'
make[2]: *** [Makefile:4820: all-stage3-gcc] Error 2
make[2]: Leaving directory '/mnt/scratch/objdir11'
make[1]: *** [Makefile:20508: stage3-bubble] Error 2
make[1]: Leaving directory '/mnt/scratch/objdir11'
make: *** [Makefile:20572: bootstrap] Error 2
Comment 2 John Paul Adrian Glaubitz 2020-12-22 08:44:56 UTC
I have started to bisect this now. aa80d0650ce612d88a62d072b63c2523d547fca8 is still good while HEAD is broken.

It will take a while until I have a result as I have to perform this bisecting on qemu-user.
Comment 3 Marius Hillenbrand 2020-12-22 15:29:23 UTC
Potential duplicate: I have seen very similar errors on s390x while reproducing https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98228

There, bisecting lead back to d119f34c952f ("New modref/ipa_modref optimization passes"). In my tests, the first stage that is compiled with -flto then later fails with errors of that kind (e.g., stage3 with config bootstrap-lto-lean).


.../gcc/build-ada3/./prev-gcc/xgcc -B/.../gcc/build-ada3/./prev-gcc/  -fchecking=1 -c -g -O2 -fchecking=1 -flto=jobserver -frandom-seed=1  -gnatpg -gnata -W -Wall -nostdinc -I- -I. -Iada/generated -Iada -Iada/gcc-interface -I..
/../gcc/ada -I../../gcc/ada/gcc-interface -Iada/libgnat -I../../gcc/ada/libgnat ../../gcc/ada/libgnat/a-elchha.adb -o ada/libgnat/a-elchha.o
+===========================GNAT BUG DETECTED==============================+
| 11.0.0 20201218 (experimental) (s390x-linux-gnu) Storage_Error stack overflow or erroneous memory access|
| Error detected at a-elchha.adb:144:20                                    |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

../../gcc/ada/gcc-interface/system.ads
../../gcc/ada/libgnat/a-elchha.adb
../../gcc/ada/libgnat/a-elchha.ads
../../gcc/ada/libgnat/a-except.ads
../../gcc/ada/libgnat/ada.ads
../../gcc/ada/libgnat/s-parame.ads
../../gcc/ada/libgnat/s-stalib.ads
../../gcc/ada/libgnat/a-unccon.ads
../../gcc/ada/libgnat/s-traent.ads
../../gcc/ada/libgnat/s-soflin.ads
../../gcc/ada/libgnat/s-secsta.ads
../../gcc/ada/libgnat/s-stoele.ads
../../gcc/ada/libgnat/s-stache.ads


and
.../gcc/build-ada3/./prev-gcc/xgcc -B/.../gcc/build-ada3/./prev-gcc/  -fchecking=1 -c -g -O2 -fchecking=1 -flto=jobserver -frandom-seed=1  -gnatpg -gnata -W -Wall -g -O1 -fno-inline \
 -nostdinc -I- -I. -Iada/generated -Iada -Iada/gcc-interface -I../../gcc/ada -I../../gcc/ada/gcc-interface -Iada/libgnat -I../
../gcc/ada/libgnat ../../gcc/ada/libgnat/a-except.adb -o ada/libgnat/a-except.o
+===========================GNAT BUG DETECTED==============================+
| 11.0.0 20201218 (experimental) (s390x-linux-gnu) Storage_Error stack overflow or erroneous memory access|
| Error detected at a-exexda.adb:472:23                                    |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

../../gcc/ada/gcc-interface/system.ads
../../gcc/ada/libgnat/a-except.adb
../../gcc/ada/libgnat/a-except.ads
../../gcc/ada/libgnat/ada.ads
../../gcc/ada/libgnat/s-parame.ads
../../gcc/ada/libgnat/s-stalib.ads
../../gcc/ada/libgnat/a-unccon.ads
../../gcc/ada/libgnat/s-traent.ads
../../gcc/ada/libgnat/s-except.ads
../../gcc/ada/libgnat/s-excdeb.ads
../../gcc/ada/libgnat/s-soflin.ads
../../gcc/ada/libgnat/s-secsta.ads
../../gcc/ada/libgnat/s-stoele.ads
../../gcc/ada/libgnat/s-stache.ads
../../gcc/ada/libgnat/s-wchcon.ads
../../gcc/ada/libgnat/s-wchstw.ads
../../gcc/ada/libgnat/s-traceb.ads
../../gcc/ada/libgnat/s-trasym.ads
../../gcc/ada/libgnat/s-exctab.ads
../../gcc/ada/libgnat/a-excach.adb
../../gcc/ada/libgnat/a-exexda.adb
Comment 4 John Paul Adrian Glaubitz 2020-12-26 20:19:47 UTC
This regression was introduced by:

commit d7e20130650fb46d71e0403652e4e07bc14f9775 (refs/bisect/bad)
Author: Justin Squirek <squirek@adacore.com>
Date:   Mon Aug 10 12:05:07 2020 -0400

    [Ada] Reimplementation of accessibility checking
Comment 5 Mikael Pettersson 2021-02-04 10:50:49 UTC
(In reply to John Paul Adrian Glaubitz from comment #4)
> This regression was introduced by:
> 
> commit d7e20130650fb46d71e0403652e4e07bc14f9775 (refs/bisect/bad)
> Author: Justin Squirek <squirek@adacore.com>
> Date:   Mon Aug 10 12:05:07 2020 -0400
> 
>     [Ada] Reimplementation of accessibility checking

My git bisect landed on this commit too.
Comment 6 John Paul Adrian Glaubitz 2021-02-04 10:58:04 UTC
(In reply to Mikael Pettersson from comment #5)
> My git bisect landed on this commit too.

I just pinged Justin again. He unfortunately doesn't seem to have a Bugzilla account, so we can't add him in the CC list of this bug report.
Comment 7 Arnaud Charlet 2021-02-04 11:05:28 UTC
Well the change was a big change so it's hard to guess why it caused this issue but it's quite possible that this change is fine on its own and exposing a latent issue.

In other words, the bisect result isn't very useful here and I'd recommend investigating this change from scratch, getting a useful backtrace from gdb and understanding where this is crashing and then why.
Comment 8 John Paul Adrian Glaubitz 2021-02-07 11:30:36 UTC
(In reply to Arnaud Charlet from comment #7)
> In other words, the bisect result isn't very useful here and I'd recommend
> investigating this change from scratch, getting a useful backtrace from gdb
> and understanding where this is crashing and then why.

I can certainly generate a backtrace in GDB, but I'm not an Ada expert which is why I reported the issue and hoped that the author of the change would be able to understand what the problem is.

It could also be possible that the change makes some assumptions of the underlying ABI that may well be true for x86_64 but not m68k.
Comment 9 Arnaud Charlet 2021-02-07 12:01:12 UTC
The problem is somehow specific to m68k, for some unknown reason. There is nothing target specific in the change, no assumption is made on the underlying target.

What we need now is a debugging session from someone who has a setup to reproduce.
Comment 10 John Paul Adrian Glaubitz 2021-02-07 12:03:43 UTC
(In reply to Arnaud Charlet from comment #9)
> The problem is somehow specific to m68k, for some unknown reason. There is
> nothing target specific in the change, no assumption is made on the
> underlying target.
> 
> What we need now is a debugging session from someone who has a setup to
> reproduce.

See here on how to set up a qemu environment: https://wiki.debian.org/M68k/QemuSystemM68k
Comment 11 Jakub Jelinek 2021-04-27 11:39:55 UTC
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
Comment 12 Christoph Reiter 2021-05-02 09:02:40 UTC
Note sure if this is related, but the 32bit Windows build of 11.1.0 fails in a similar way:

gnat1.exe: warning: command-line option '-Wno-pedantic-ms-format' is valid for C/C++/ObjC/ObjC++ but not for Ada
make[3]: *** [../../gcc-11.1.0/gcc/ada/gcc-interface/Make-lang.in:1052: ada/libgnat/a-except.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm gcc.pod gfortran.pod
make[3]: Leaving directory '/C/_/mingw-w64-gcc/src/build-i686-w64-mingw32/gcc'
make[2]: *** [Makefile:4833: all-stage2-gcc] Error 2
make[2]: Leaving directory '/C/_/mingw-w64-gcc/src/build-i686-w64-mingw32'
make[1]: *** [Makefile:26006: stage2-bubble] Error 2
make[1]: Leaving directory '/C/_/mingw-w64-gcc/src/build-i686-w64-mingw32'
make: *** [Makefile:1013: all] Error 2
Comment 13 Eric Botcazou 2021-05-02 09:32:04 UTC
> Note sure if this is related, but the 32bit Windows build of 11.1.0 fails in
> a similar way:

Not all build failures are similar because they affect the Ada compiler!  Please open a separate TN for your problem, this one is for m68k.  Thanks in advance.
Comment 14 Eric Botcazou 2021-05-02 09:33:04 UTC
We need at least a backtrace.
Comment 15 Richard Biener 2021-07-28 07:05:33 UTC
GCC 11.2 is being released, retargeting bugs to GCC 11.3
Comment 16 John Paul Adrian Glaubitz 2022-02-23 10:06:33 UTC
Just as a heads-up: This has been fixed for me with gcc-12. I can successfully bootstrap Ada in gcc-12 with gnat-10.
Comment 17 Eric Botcazou 2022-02-23 10:18:10 UTC
> Just as a heads-up: This has been fixed for me with gcc-12. I can
> successfully bootstrap Ada in gcc-12 with gnat-10.

Great.  What about gcc-11?
Comment 18 John Paul Adrian Glaubitz 2022-02-23 10:33:33 UTC
(In reply to Eric Botcazou from comment #17)
> > Just as a heads-up: This has been fixed for me with gcc-12. I can
> > successfully bootstrap Ada in gcc-12 with gnat-10.
> 
> Great.  What about gcc-11?

The git snapshot 20220130 from the gcc-11 branch still fails. However, since Matthias just uploaded 20220222, I can try that as well and report back.
Comment 19 John Paul Adrian Glaubitz 2022-02-24 09:57:59 UTC
(In reply to John Paul Adrian Glaubitz from comment #18)
> The git snapshot 20220130 from the gcc-11 branch still fails. However, since
> Matthias just uploaded 20220222, I can try that as well and report back.

gcc-11 is still affected.
Comment 20 Richard Biener 2022-04-21 07:48:26 UTC
GCC 11.3 is being released, retargeting bugs to GCC 11.4.
Comment 21 John Paul Adrian Glaubitz 2022-04-28 15:02:26 UTC
This issue is fixed in 12 and presumably also in version 13. So the title is misleading.
Comment 22 Eric Gallager 2022-04-28 16:02:53 UTC
(In reply to John Paul Adrian Glaubitz from comment #21)
> This issue is fixed in 12 and presumably also in version 13. So the title is
> misleading.

It is? OK, I'll retitle then...
Comment 23 Jakub Jelinek 2023-05-29 10:03:41 UTC
GCC 11.4 is being released, retargeting bugs to GCC 11.5.