Bug 106031 - ICE on container map empty aggregate.
Summary: ICE on container map empty aggregate.
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 12.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: ice-on-invalid-code
Depends on:
Reported: 2022-06-19 17:59 UTC by Pascal Pignard
Modified: 2022-08-18 08:11 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2022-07-01 00:00:00

Full source code (394 bytes, text/plain)
2022-06-19 17:59 UTC, Pascal Pignard

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Pignard 2022-06-19 17:59:03 UTC
Created attachment 53166 [details]
Full source code

Following the example section of RM Ada 2022 ยง 4.3.5 Container Aggregate, I want to try map aggregates:
 4.    package Section_4_3_5_Paragraph_54 is
 5.       type Map_Type is private
 6.         with Aggregate =>  (Empty     => Empty_Map,
 7.                             Add_Named => Add_To_Map);
 9.       procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in String);
11.       Empty_Map : constant Map_Type;
13.       function Get (M : Map_Type; Key : in Integer) return String;
14.    private
15.       type Map_Type is array (1..10) of String (1..10);
16.       Empty_Map : constant Map_Type := [];
17.    end Section_4_3_5_Paragraph_54;

It is ok when checking but issues a bug box when compiling:
gprbuild -d -P/Users/me/Tests/tests.gpr -XBUILD_MODE=Debugging test_20220619_map_agg.adb
   [Ada]          test_20220619_map_agg.adb
+===========================GNAT BUG DETECTED==============================+
| 12.1.0 (x86_64-apple-darwin19.6.0) GCC error:                            |
| in gnat_to_gnu_entity, at ada/gcc-interface/decl.cc:472                  |
| Error detected at test_20220619_map_agg.adb:16:40                        |
| Compiling /Users/me/Tests/2022/test_20220619_map_agg.adb|
| 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).


test_20220619_map_agg.adb:23:28: warning: index for "Value" may assume lower bound of 1 [-gnatww]
test_20220619_map_agg.adb:23:28: warning: suggested replacement: "Value'First" [-gnatww]
test_20220619_map_agg.adb:23:31: warning: index for "Value" may assume lower bound of 1 [-gnatww]
test_20220619_map_agg.adb:23:31: warning: suggested replacement: "Value'First + 9" [-gnatww]
compilation abandoned
gprbuild: *** compilation phase failed
[2022-06-19 19:08:24] process exited with status 4, elapsed time: 00.69s
Comment 1 Eric Botcazou 2022-07-01 10:56:59 UTC
Confirmed, but probably illegal since you use Empty to declare itself.
Comment 2 David SAUVAGE - AdaLabs 2022-08-18 08:11:43 UTC
reproducer available on https://gitlab.com/adalabs/reproducers/-/tree/main/106031