https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106031

            Bug ID: 106031
           Summary: ICE on container map empty aggregate.
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p.p11 at orange dot fr
  Target Milestone: ---

Created attachment 53166
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53166&action=edit
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);
 8. 
 9.       procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value :
in String);
10. 
11.       Empty_Map : constant Map_Type;
12. 
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
Compile
   [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).

/Users/me/Tests/2022/test_20220619_map_agg.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

Reply via email to