GNAT 6 experience report (very short)

John Marino has packaged GNAT 6 from FSF for FreeBSD and DragonFly.

I’ve installed FreeBSD with GNAT 6, and tried to see if there were any obvious differences to the older versions (I use GNAT 4.9 and 5 on Debian).

So far the result is that it is more picky about anonymous access types. (Maybe even too picky. I’m trying to figure that out.)

Here is an example:

GNAT 6.0.0 20151129 (snapshot) -=> GNAT AUX [FreeBSD64]
Copyright 1992-2015, Free Software Foundation, Inc.

Compiling: /usr/home/sparre/org.opentoken-6.0b/opentoken-production-parser-lalr-parser_lists.adb
Source file time stamp: 2015-12-10 10:32:39
Compiled at: 2015-12-24 13:56:17

   487.       return (Element => Position.Item'Access);
                                 |
        >>> access discriminant in return aggregate would be a dangling reference

 746 lines: 1 error
gnatmake: "/usr/home/sparre/org.opentoken-6.0b/opentoken-production-parser-lalr-parser_lists.adb" compilation error

The subroutine which causes the problem is:

   480     function Constant_Reference
   481       (Container : aliased in List'Class;
   482        Position  : in Parser_Node_Access)
   483       return Constant_Reference_Type
   484     is
   485        pragma Unreferenced (Container);
   486     begin
   487        return (Element => Position.Item'Access);
   488     end Constant_Reference;

Switching to 'Unrestricted_Access makes the compiler accept the function, but is it safe?

(Debian/experimental also has GNAT-6.)

Leave a Reply