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

            Bug ID: 118208
           Summary: sem_ch8 Program_Error.
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 00120260a at gmail dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

I can't provide more than the code and bug report.

gcc -c -gnatX0 -gnatE -gnatd.n main2.adb
/home/drm/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adainclude/system.ads
main2.adb
main2.ads
+===========================GNAT BUG DETECTED==============================+
| 14.2.0 (x86_64-pc-linux-gnu) Program_Error sem_ch8.adb:5920 explicit raise|
| Error detected at main2.adb:10:22                                        |
| Compiling main2.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.                                       |
+==========================================================================+

package main2 is
 type Item (Degree : Natural := 0) is record
   Value: Float;
 end record;
 type ItemArray is array (Positive range 1..<>) of Item;
 type Poly is private;
 function Construct (N: ItemArray) return Poly;
private
 type ItemLink;
 type ItemAccess is access all ItemLink;
 type ItemLink is record
   Next: ItemAccess;
   I: Item;
 end record;
 type Poly is record
   MaxDegree: Natural := 0;
   Sentinel: aliased ItemLink;
 end record;
end main2;
_________________

package body main2 is
 function Construct (N: ItemArray) return Poly is
 begin
   return P: Poly do
     declare
       Current: not null ItemAccess := P.Sentinel'Unrestricted_Access;
     begin
       for A of N loop
         Current.Next := new ItemLink'(null, A);
         Current := @.Next;
       end loop;
     end;
   end return;
 end Construct;
end main2;

Reply via email to