Bug 86916 - Constraint_Error erroneous memory access instead of error
Summary: Constraint_Error erroneous memory access instead of error
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 8.1.0
: P3 normal
Target Milestone: 10.2
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2018-08-11 07:46 UTC by Roger Mc Murtrie
Modified: 2021-06-01 09:43 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-09-12 00:00:00


Attachments
Requested files (12.04 KB, application/zip)
2018-08-11 07:46 UTC, Roger Mc Murtrie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roger Mc Murtrie 2018-08-11 07:46:50 UTC
Created attachment 44525 [details]
Requested files

Command (via GPS):
 gprbuild -d -P/Ada_Source/OglAda_Examples/ogl_dev/22_loading_test/loader_test.gpr -XMode=debug -XLibrary_Type=static -XAuto_Exceptions=enabled -XWindowing_System=quartz -XGLFW_Version=3 -s --config=/Ada_Source/default.cgpr

compilation abandoned
gprbuild: *** compilation phase failed
[2018-08-11 17:27:28] process exited with status 4, 93% (117/125), elapsed time: 28.32s


+===========================GNAT BUG DETECTED==============================+
| 8.1.0 (x86_64-apple-darwin15) Constraint_Error erroneous memory access   |
| Error detected at animation.adb:61:16                                    |
| 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.                                       |
+==========================================================================+

List of files

compilation abandoned
gprbuild: *** compilation phase failed
[2018-08-11 17:27:28] process exited with status 4, 93% (117/125), elapsed time: 28.32s
Comment 1 Roger Mc Murtrie 2018-08-11 12:15:59 UTC
I am also getting this problem with gcc 6.1.0
+===========================GNAT BUG DETECTED==============================+
| 6.1.0 (x86_64-apple-darwin15) GCC error:                                 |
| in gnat_to_gnu_entity, at ada/gcc-interface/decl.c:3011                  |
| Error detected at assimp_texture.ads:65:34   

As I have used gcc 6.1.0 with getting this error in the past I'm wondering if it has something to do with OSX.
Mac mini (Mid 2011)
OSX 10.13.6
Xcode 9.4.1
Comment 2 Roger Mc Murtrie 2018-08-11 12:21:40 UTC
Correction
"As I have used gcc 6.1.0 with getting this error"
should have been:
"As I have used gcc 6.1.0 WITHOUT getting this error"
Comment 3 Roger Mc Murtrie 2018-08-12 01:50:54 UTC
This problem doesn't occur for compile only.
It occurs when I Build All from GPS
Comment 4 Roger Mc Murtrie 2018-08-13 02:58:50 UTC
Simon Wright has determined the problem and notes that GNAT has 
failed to recognise the actual problem.
(https://groups.google.com/forum/#!topic/comp.lang.ada/MdywAlMPQms)

The problem is in the packages Morph.Mesh_Morph_Value_Pointers, 
Mesh_Morph_Weight_Pointers. 

You say 
   package Mesh_Morph_Value_Pointers is new Interfaces.C.Pointers 
     (Interfaces.C.unsigned, API_Morph_Value, API_Morph_Values_Array, 
      API_Morph_Value'(others => <>)); 
but 
   type API_Morph_Value is new Interfaces.C.unsigned; 
so others => <> isn't a legal expression for an API_Morph_Value; you 
should say 
      API_Morph_Value'(0)); 

There is still a bug, which ought to be fixed, but it's that GNAT has 
failed to recognise the actual problem and has got fatally confused.
Comment 5 Eric Botcazou 2018-09-12 08:18:06 UTC
Confirmed.  This gives an assertion failure on mainline:

+===========================GNAT BUG DETECTED==============================+
| 9.0.0 20180911 (experimental) [trunk revision 264202] (x86_64-suse-linux) |
| Assert_Failure elists.adb:220                                            |
| Error detected at animation.adb:61:16
Comment 6 Jakub Jelinek 2019-05-03 09:14:57 UTC
GCC 9.1 has been released.
Comment 7 Jakub Jelinek 2019-08-12 08:54:27 UTC
GCC 9.2 has been released.
Comment 8 Jakub Jelinek 2020-03-12 11:58:45 UTC
GCC 9.3.0 has been released, adjusting target milestone.
Comment 9 Richard Biener 2021-06-01 08:12:04 UTC
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
Comment 10 simon 2021-06-01 08:32:34 UTC
This was fixed in 10.1.0, and is still fixed in 11.1.0:

$ /opt/gcc-10.1.0/bin/gnatmake -c -u -f -gnatl *.adb
gcc -c -gnatl animation.adb
[...]
==============Error messages for source file: morph.ads
    22.       API_Morph_Value'(others => <>));
                              |
        >>> expected type "API_Morph_Value" defined at line 13
        >>> found a composite type

    30.       API_Morph_Weight'(others => <>));
                               |
        >>> expected type "API_Morph_Weight" defined at line 14
        >>> found a composite type

 288 lines: 4 errors
gnatmake: "animation.adb" compilation error
Comment 11 Arnaud Charlet 2021-06-01 09:43:03 UTC
Great, closing then.