Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnatpp crashes on delta aggregates with "null template" error #28

Open
andrewathalye opened this issue Aug 8, 2023 · 0 comments
Open

Comments

@andrewathalye
Copy link

andrewathalye commented Aug 8, 2023

procedure Test is
   type Transfer_Status_Type is (Can_Transfer, Item_Is_Equipped, Not_Available);
   type Item_Description is record
      Bucket_Location : Natural := 20;
      Transfer_Status : Transfer_Status_Type;
   end record;

   type Item_Array is array (Natural range <>) of Item_Description;

   type Character_Inventory_Type is record
      Equipped_Items : Item_Array (1 .. 100);
   end record;

   procedure Add (Inventory : out Character_Inventory_Type; Item : Item_Description) is null;

   procedure Equip
      (Inventory : out Character_Inventory_Type;
       Item      : Item_Description)
   is
   begin
      Add (Inventory, (Inventory.Equipped_Items (Item.Bucket_Location) with delta
         Transfer_Status => Can_Transfer));

      Inventory.Equipped_Items (Item.Bucket_Location) := (Item with delta
         Transfer_Status => Item_Is_Equipped);
   end Equip;

   Itm : Item_Description;
   Inv : Character_Inventory_Type;
begin
   Equip (Inv, Itm);
end Test;

The above sample is sufficient to cause a crash.

EDITED: The original sample contained some leftover references to the system it is from, so I cleared those in order to make it compile. It still triggers the crash:

Unhandled Exception raised
raised PROGRAM_ERROR : null template: <DeltaAggregate test.adb:21:20-22:39>
[/home/andrew/bin/gnatpp]
<stacktrace omitted: aslr is on and no symbols are installed>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant