Bug 58881 - GNAT crashes with bug box when trying to instantiate a generic package
Summary: GNAT crashes with bug box when trying to instantiate a generic package
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 18:26 UTC by Felix
Modified: 2015-12-06 15:51 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-12-06 00:00:00


Attachments
Concatenated sources to reproduce (unpack with gnatchop) (17.73 KB, text/x-vhdl)
2013-10-25 18:27 UTC, Felix
Details
Simplified code to reproduce the crash (extract with gnatchop) (247 bytes, text/plain)
2013-10-26 07:13 UTC, Felix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix 2013-10-25 18:26:43 UTC
When compiling attached code, I get the following bug box:

+===========================GNAT BUG DETECTED==============================+
| 4.8.1 (x86_64-apple-darwin12) Constraint_Error erroneous memory access   |
| Error detected at gl-objects-textures-with_1d_loader.ads:31:4 [gl-objects-textures-targets.ads:28:4]|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| 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 gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

Attached file consists of multiple source files, to compile it, you have to do

    gnatchop packed.adb
    gcc -c gl_test-framebuffers.adb

This will produce the bug box.

Unfortunately, I don't have a more recent of GNAT to do more testing. I do have GNAT GPL 2013 from AdaCore available, which includes GCC 4.7.4 and also runs into this bug.

I tried to reproduce the bug with less code, but wasn't successful. I did notice that removing the type Fillable_Target from the file gl-objects-textures-with_1d_loader.ads fixes the problem.

My GCC was compiled with:

Target: x86_64-apple-darwin12
Configured with:
../gcc-4.8.1/configure \
  --prefix=/opt/gcc-4.8.1 \
  --disable-multilib \
  --enable-languages=c,c++,ada,fortran,objc,obj-c++ \
  --target=x86_64-apple-darwin12 \
  --build=x86_64-apple-darwin12
Thread model: posix
Comment 1 Felix 2013-10-25 18:27:51 UTC
Created attachment 31089 [details]
Concatenated sources to reproduce (unpack with gnatchop)
Comment 2 Luke A. Guest 2013-10-26 00:13:52 UTC
$ gnatmake gl_test-framebuffers.adb
gcc -c gl_test-framebuffers.adb
+===========================GNAT BUG DETECTED==============================+
| 4.9.0 20130916 (experimental) (x86_64-unknown-linux-gnu) Assert_Failure einfo.adb:953|
| Error detected at gl-objects-textures-with_1d_loader.ads:31:4 [gl-objects-textures-targets.ads:28:4]|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| 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 gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

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).

gl_test-framebuffers.adb
gl.ads
gl-buffers.ads
gl-low_level.ads
gl-types.ads
gl-algebra.ads
gl-vectors.ads
gl-matrices.ads
gl-types-colors.ads
gl-immediate.ads
gl-fixed.ads
gl-fixed-matrix.ads
gl-enums.ads
gl-toggles.ads
gl-fixed-textures.ads
gl-objects.ads
gl-objects-textures.ads
gl-low_level-enums.ads
gl-pixel_data.ads
gl-enums-textures.ads
gl-objects-textures-targets.ads
gl-objects-textures-with_1d_loader.ads
gl-objects-textures-with_2d_loader.ads
gl-objects-textures-with_3d_loader.ads
gl-objects-renderbuffers.ads
gl-objects-framebuffers.ads
gl-window.ads
gl_test.ads
gl_test-display_backend.ads

compilation abandoned
gnatmake: "gl_test-framebuffers.adb" compilation error
Comment 3 Felix 2013-10-26 07:13:55 UTC
Created attachment 31091 [details]
Simplified code to reproduce the crash (extract with gnatchop)

I managed to create a minimal code example to reproduce the bug. The bug only occurs when:

 * Bug.Tagged_Type has a determinant.
 * Bug.Generic_Package.Derived2 is present.
 * Bug.Instances instantiates Bug.Generic_Package.
Comment 4 Felix 2013-10-26 07:16:24 UTC
Oh sorry, forgot to mention: Simplified code can be compiled with:

    gnatchop simplified.adb
    gnatmake bug-proc.adb
Comment 5 Eric Botcazou 2015-12-06 15:51:39 UTC
Still fails on mainline.