I believe I have found and fixed a bug in AUnit which comes as part of the GNAT compiler tools for Ada.
What is the best way to submit bugs to AdaCore for their community versions of the GNAT tools?
The following program silently aborts with the current version of the compiler GNAT Community 2020 (20200429-84)
with Ada.Text_IO;use Ada.Text_IO;
with AUnit.Test_Filters;
with AUnit.Tests;
procedure Message_Allocation is
package Filter_Package is
type Filter_Type is new AUnit.Test_Filters.Name_Filter with null record;
function Is_Active
(Filter : Filter_Type;
T : AUnit.Tests.Test'Class) return Boolean;
end Filter_Package;
package body Filter_Package is
function Is_Active
(Filter : Filter_Type;
T : AUnit.Tests.Test'Class) return Boolean is begin return true; end is_active;
end Filter_Package;
filter : Filter_Package.filter_type;
begin
Put_Line ("set 1st filter");
filter.set_name ("abc");
Put_Line ("set 2nd filter");
filter.set_name ("xyz");
Put_Line ("2nd filter set");
end Message_Allocation;
The bug is in the procedure Message_Free in the file aunit.adb. The following is the patched version. The change is the parameter to the call to AUnit.Memory.AUnit_Free.
procedure Message_Free (Msg : in out Message_String) is
begin
if Msg /= null then
AUnit.Memory.AUnit_Free (Msg.all'address - System.Address'size/8);
Msg := null;
end if;
end Message_Free;
A mail to: report (at) (the name of the company which makes GNAT) .com
You increase your chances with a meaningful title, and useful information to show the bug (typically a reproducer example) and your fix.