GNAT 16.1.0-rc1 - Call for testing

Hi everyone,

I published a (pre)release candidate build of GNAT FSF 16.1.0 in the GNAT FSF builds repo. I also added a branch in my fork of the Alire index on GitHub, with the release candidate in it.

We invite you to test this release and tell us if there are any issues we can fix, before we release the actual 16.1.0 version.

There is currently no build for macOS on ARM, as the patched fork we use for that platform hasn’t released a 16.x version yet. But stay tuned!

10 Likes

Thanks for your call for testing, especially for macOS even if unfortunately there is not yet ARM version.
My configuration: macOS 13.7.8, x86_64, Xcode 14.3.1.
Early feedbacks:

  1. Link error:
    Link
    [link] test_uxstrings1.adb
    ld: library not found for -lSystem
    User workaround:

export LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib

  1. Link warning

ld: warning: object file (/users/me/gnat-x86_64-darwin-16.1.0-1/lib/gcc/x86_64-apple-darwin24.6.0/16.1.0/adalib/libgnat.a(a-assert.o)) was built for newer macOS version (15.0) than being linked (13.0)
User workaround:
export MACOSX_DEPLOYMENT_TARGET=15.0

  1. Finalization works better :slightly_smiling_face:

I keep on testing more.

With:

45.    type UXString is tagged private with
46.      Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate,
47.      Iterator_Element  => Unicode_Character,
48.      Aggregate => (Empty => Empty, Add_Unnamed => Append, New_Indexed => New_Vector, Assign_Indexed => Replace_Element),
49.      String_Literal    => From_Unicode;
182.    procedure Append (Source : in out UXString; New_Item : UXString);
184.    procedure Append (Source : in out UXString; New_Item : Unicode_Character);

I got:

uxstrings4.ads:48:51: error: "Append" must denote exactly one subprogram

It was not the case with previous versions.

Looks like this new version of GNAT has better checking for Ada RM 4.3.5 (7/5), which requires Add_Unnamed to denote exactly one procedure where in your case it denotes two.

1 Like
  1. Do you have the macOS command line tools installed?
  2. Unfortunately we cannot build for all existing macOS versions… For the time being we will try to support the latest version of macOS and version N-1. It’s a pity that homebrew doesn’t build a GNAT compiler, they have packages for each supported macos version.

There was a time when MacPorts had an Ada compiler that functioned (SIGH) I don’t use homebrew. Looking forward to arm64 MacOS, as working with the Rosetta emulation is slower than molasses in a Minnesota winter…

RBE

  1. It’s a pity that homebrew doesn’t build a GNAT compiler, they have packages for each.

nix-darwin has gnat included.

  1. No I’ve only Xcode.
  2. I remember that late Simon configured compiler spec for both Xcode and CLT in the script gcc.sh.
1 Like

With this code from Ada 2022 RM §4.2.1:

284.       subtype Roman_Character is Wide_Wide_Character with
285.         Static_Predicate => Roman_Character in 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M';
286. 
287.       Max_Roman_Number : constant := 3_999;  -- MMMCMXCIX
288. 
289.       type Roman_Number is range 1 .. Max_Roman_Number
290.         with String_Literal => To_Roman_Number;
291. 
292.       function To_Roman_Number (S : Wide_Wide_String) return Roman_Number
293.         with Pre => S'Length > 0 and then
294.         (for all Char of S => Char in Roman_Character);

I got the error:
aarm_202x_ch04.adb:290:32: error: nonoverridable aspect "String_Literal" of type "Roman_Number" requires "To_Roman_Number" declared at line 292 to be a primitive operation

It was not the case with previous versions.

That’s interesting. I’m unable to reproduce on x86-64 Linux. I copied the code from Ada 2022 RM 4.2.1 into this package, and I get no compilation errors:

package Example is

   type Roman_Digit is ('I', 'V', 'X', 'L', 'C', 'D', 'M');

   subtype Roman_Character is Wide_Wide_Character
   with
     Static_Predicate =>
       Roman_Character in 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M';

   Max_Roman_Number : constant := 3_999;  -- MMMCMXCIX

   type Roman_Number is range 1 .. Max_Roman_Number
   with String_Literal => To_Roman_Number;

   function To_Roman_Number (S : Wide_Wide_String) return Roman_Number
   with
     Pre =>
       S'Length > 0 and then (for all Char of S => Char in Roman_Character);

   function To_Roman_Number (S : Wide_Wide_String) return Roman_Number
   is (declare
         R : constant array (Integer range <>) of Roman_Number :=
           [for D in S'Range =>
              Roman_Digit'Enum_Rep
                (Roman_Digit'Wide_Wide_Value (''' & S (D) & '''))];
         --  See 3.5.2 and 13.4
       begin
         [for I in R'Range =>
            (if I < R'Last and then R (I) < R (I + 1) then -1 else 1) * R (I)]'
           Reduce ("+", 0));

   X : Roman_Number := "III" * "IV" * "XII"; -- 144 (that is, CXLIV)

end Example;

I double-checked I’m using the correct compiler version:

gcc (GNAT-FSF-builds) 16.1.0
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Perhaps there is something else in your package that’s interfering? Are you able to reproduce with the above snippet?

The error comes when code is in a procedure:

procedure Example_B is

   type Roman_Digit is ('I', 'V', 'X', 'L', 'C', 'D', 'M');

   subtype Roman_Character is Wide_Wide_Character
   with
     Static_Predicate =>
       Roman_Character in 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M';

   Max_Roman_Number : constant := 3_999;  -- MMMCMXCIX

   type Roman_Number is range 1 .. Max_Roman_Number
   with String_Literal => To_Roman_Number;

   function To_Roman_Number (S : Wide_Wide_String) return Roman_Number
   with
     Pre =>
       S'Length > 0 and then (for all Char of S => Char in Roman_Character);

   function To_Roman_Number (S : Wide_Wide_String) return Roman_Number
   is (declare
         R : constant array (Integer range <>) of Roman_Number :=
           [for D in S'Range =>
              Roman_Digit'Enum_Rep
                (Roman_Digit'Wide_Wide_Value (''' & S (D) & '''))];
         --  See 3.5.2 and 13.4
       begin
         [for I in R'Range =>
            (if I < R'Last and then R (I) < R (I + 1) then -1 else 1) * R (I)]'
           Reduce ("+", 0));

   X : Roman_Number := "III" * "IV" * "XII"; -- 144 (that is, CXLIV)

   begin
      null;
   end Example_B;

With this code from Ada 2022 RM §4.5.10:

procedure Section_4_5_10_Paragraph_36 is
      type Real is digits 8;

   function Factorial(N : Natural) return Natural is
        ([for J in 1..N => J]'Reduce("*", 1));

      -- Example of a reduction expression that computes the Sine of X using a Taylor expansion:

      function Sine (X : Float; Num_Terms : Positive := 5) return Float is
             ([for I in 1..Num_Terms => (-1.0)**(I-1) * X**(2*I-1)/Float(Factorial(2*I-1))]
                'Reduce("+", 0.0));

   begin
   null;
   end Section_4_5_10_Paragraph_36;

The compilation never ended with switch -gnatVa:
$ gcc -c -gnat2022 section_4_5_10_paragraph_36.adb -gnatVa

It was not the case with previous versions.

I don’t know if this is useful info or not, but when I try to declare tagged types with primitive operations directly in a procedure declarative region, it has always complained to me in older versions. I wonder if the error was intended from the get go and only just recently got fixed up? I’ve always had to put tagged types + primitive operations in a package inside the declarative region of a procedure to get it work. Something like:

procedure Example_B is
   package Some_Name is
      -- Types and primitive ops
   end Some_Name;

   use Some_Name;  -- so you don't have to work with the extra package name if you don't want to
begin

2 Likes

I’ve successfully build ALS on Linux with it.

2 Likes

iirc Xcode has changed the sdk location in the past, so I didn’t want to hardcode it and used the CLT instead. Will look into fixing that.