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

            Bug ID: 121057
           Summary: Assertion failure triggered by access-type dispatch in
                    Implementation Extension mode
           Product: gcc
           Version: 16.0
            Status: RESOLVED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dennis at przytarski dot com
                CC: dkm at gcc dot gnu.org, ebotcazou at gcc dot gnu.org
  Target Milestone: ---
            Status: RESOLVED
                CC: ebotcazou at gcc dot gnu.org
        Resolution: DUPLICATE

This code

pragma Extensions_Allowed (On); -- remove

procedure Example is

   package A is
      type A is tagged null record;
      type A_Ptr is access A;
      procedure Proc (This : in out A'Class; Some_Parameter : A_Ptr) is null;
      Obj : A_Ptr := new A'(null record);
   end A;

   package body A is
      --  this part is empty
   begin
      Obj.Proc (null); -- replace Obj by Obj.all
   end A;

begin
   null;
end Example;

fails with

gnatmake: "<source>" compilation error
+===========================GNAT BUG DETECTED==============================+
| 16.0.0 20250713 (experimental) (x86_64-linux-gnu) Assert_Failure failed
precondition from einfo-entities.ads:4348|
| Error detected at example.adb:15:10                                      |
| Compiling <source>                                               |

The GNAT bug disappears when either:
* the pragma is removed, or
* the access object (Obj) is dereferenced.

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
.

*** This bug has been marked as a duplicate of bug 121056 ***

Reply via email to