GCC 13.1 Released

https://gcc.gnu.org/pipermail/gcc-announce/2023/000175.html
https://gcc.gnu.org/gcc-13/changes.html

Ada specific changes:

  • Traceback support added in RTEMS for the PPC ELF and ARM architectures.
  • Support for versions older than VxWorks 7 has been removed.
  • General improvements to the contracts in the standard libraries.
  • Addition of GNAT.Binary_Search.
  • Further additions and fixes for the Ada 2022 specification.
  • The Pragma SPARK_Mode=>Auto is now accepted. Contract analysis has been further improved.
  • Documentation improvements
4 Likes

macOS release for gcc-13.1.0-x86_84-apple-darwin: NB, this is for Monterey or later, will also run on Apple silicon.

1 Like

The official ChangeLog is quite brief. I’d like to share my findings on what’s new in this version. Comparing the documentation with the previous version, I have found the following new features.

In the GNAT User’s Guide chapter Building Executable Programs with GNAT, new compiler options have been added:

In the chapter GNAT and Program Execution, it is mentioned that Position-Independent Executables (PIE) are now enabled by default, which means that addr2line no longer works out of the box. Instead, it is recommended to use gnatsymbolize --load and it is shown how to determine the current code load address.

The Reference Manual specifies a new restriction, No_Local_Tagged_Types. In the chapter The GNAT Library, new packages GNAT.Binary_Search and GNAT.Generic_Fast_Math_Functions (this should use SIMD when possible) have been added. The chapter Security Hardening Features has been clarified and supplemented with two sections, Hardened Booleans and Control Flow Redundancy.

Unfortunately, the new experimental language extensions have not been included in the documentation. String interpolation has been implemented and described on the AdaCore website. This probably also applies to Pragma Storage_Model and Simpler accessibility model, but I have not checked. The attribute 'Reduce no longer applies to implementation-defined extensions. Although the use of square brackets is allowed in Ada 2022 for array and container aggregates, it is listed in the documentation as a language extension (requires practical testing, probably just documentation bug).

Looking at the ChangeLog, a lot of changes have been made to support CUDA. For example, gnat_cuda.ads has been added.

Regarding the improvement of Ada 2022 support, I only found two cases. The 'Index attribute has been implemented for use in the preconditions and postconditions of input families. Containers have received versions of cursor operations where the first argument is the container object. These include Has_Element, Element, Next, and so on, i.e. we can write My_Set.Has_Element (Cursor).

If you find something interesting, please share!

6 Likes

The new String interpolation documentation from AdaCore has this simple code snippet.

procedure Test_Interpolation is
   X    : Integer := 12;
   Y    : Integer := 15;
   Name : String := "Leo";
begin
   Put_Line (f"The name is {Name} and the sum is {X + Y}.");
end Test_Interpolation;

I’m intrigued by the f"..." string inside the call to Put_Line. Can anybody please point me the documentation for these formatted strings?

Many thanks,
Leo

If you scroll to the end of section you will find the link to RFC:

Here is a link to the original RFC : ada-spark-rfcs/prototyped/rfc-string-interpolation.rst at d652f0fad28fdbc68bb9281f7fa9e996aa2658be · AdaCore/ada-spark-rfcs · GitHub

Hi Max,
Many thanks for the quick reply. That answers my question.
Cheers,
Leo

Hi Max, thank you for your comments.

I wrote the changelog by reading the Changelog files within the src tree of GCC, which lists all the changes that took place by the developers.

I did read the CUDA changes (actually, they have been taken place for a long while, including GCC 12). However, I was told that it was not in a working state (in GCC 12), so I did not want to mention it back then. There was no indication that it was working in GCC 13, that is why I also did not mention it.

What method did you use to detect the changes in GCC 13? Did you git log the documentation? I also read the mention of those changes, but I did not take a look at the actual text. My current method of reading for hours the Changelog messages is rather painful and innefficient. If you have a better way, I would like to know!

Once again, thank you for the extra bits!

2 Likes

@Irvise thank you for this work. I started with reading ChangeLog also and I agree that this is tedious and innefficient :frowning: So I decided, that if I find difference in the documentation then it could help. I cloned GCC git repository, copied ada/doc folder from GCC 12 and compare it with GCC 13. But the documentation doesn’t look precise. For instance PIE isn’t activated by default in my GCC 13 build.

I tried to run git log -S "Ada 2022" to look for Ada 2022 improvements, then make examples with found features to verify that GCC 12 doesn’t understand them.

Another direction is the custom GNAT extensions list. I looked through RFC repository and latest GNAT documentation snapshot to see what could be implemented. It appears that local-vars-without-block works in GCC 13 (and not in GCC 12). On the other side, Storage_Model worked in GCC 12 already.

Probably, we could compare standard Ada library unit specifications between GCC 12 and GCC 13. I got tired and left.

I’ve made a video of my findings on YouTube.

1 Like

If you want to use GCC 13.1 in the Linux Alire environment then you can try my custom Alire index. Just run:

git clone https://github.com/reznikmm/als-alire-index.git
alr index --reset-community
alr index --add file://$PWD/als-alire-index --name als
alr toolchain --select gnat_native=13.1.1

And you are done!

If you need it for Aarch64 (Linux) use this repository instead.

Or just

alr index --add git+https://github.com/reznikmm/als-alire-index --name als

without the need to clone by hand.

2 Likes