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

            Bug ID: 113036
           Summary: GNAT BUG DETECTED ICE box triggered by a default value
                    that is a nested iterated aggregate
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: saulius.grazulis at bti dot vu.lt
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 56889
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56889&action=edit
A Minimal Working Example

When a discriminated record type has an 2D array a as a component, and a
default initialization value with nested iterated arrays is provided, a GNAT
BUG DETECTED box is triggered:

+ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/saulius/install/gcc/gcc-13.2.0-git-master-d1647917006/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure
--prefix=/home/saulius/install/gcc/gcc-13.2.0-git-master-d1647917006
--enable-languages=c,c++,ada,fortran --disable-multilib --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231214 (experimental) (GCC) 

+ uname -a
Linux tasmanijos-velnias 5.4.0-167-generic #184-Ubuntu SMP Tue Oct 31 09:21:49
UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

+ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 20.1
Release:        20.1
Codename:       ulyssa

+ gnatmake pm_type_default_not_ok.adb
gcc -c pm_type_default_not_ok.adb
+===========================GNAT BUG DETECTED==============================+
| 14.0.0 20231214 (experimental) (x86_64-pc-linux-gnu) Assert_Failure failed
precondition from sinfo-nodes.ads:3628|
| Error detected at pm_type_default_not_ok.adb:9:4                         |
| Compiling pm_type_default_not_ok.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).

pm_type_default_not_ok.adb

compilation abandoned
gnatmake: "pm_type_default_not_ok.adb" compilation error

$ cat pm_type_default_not_ok.adb 
pragma Ada_2022;

procedure PM_Type_Default_Not_OK is

   type One_Or_Zero is range 0 .. 1;

   type Permutation_Matrix_Array is array (Positive range <>, Positive range
<>) of One_Or_Zero;

   type Permutation_Matrix (N : Positive) is record
      A : Permutation_Matrix_Array (1 .. N, 1 .. N) :=
        (for I in 1 .. N => (for J in 1 .. N => 0));
   end record;

begin
   null;
end;

Not nesting the value, (e.g. having (others => 0)), or using the same iterated
expression in an assignment (as opposed to initialization) works OK.
  • [Bug ada/113036] New: GNAT ... saulius.grazulis at bti dot vu.lt via Gcc-bugs

Reply via email to