https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63276

            Bug ID: 63276
           Summary: implicit access checking is inserted for not null
                    access type against pragma Suppress (Access_Check)
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: demoonlit at panathenaia dot halfmoon.jp

The compiler inserts implicit access checking for "not null" access types
against pragma Suppress (Access_Check).

example:

==== global.ads ====
package global is
   type ptr is access all Integer;
   pragma Suppress (Access_Check, ptr);
   var : aliased Integer := 0;
   ref : not null ptr := var'Access; -- this "not null" is the trigger
   pragma Suppress (Access_Check, ref);
end global;

==== main.ads ====
with global;
procedure main is
begin
   global.ref.all := 1;
end main;

Compile main.ads and use nm to look for inserted implicit checking

$ gcc -c -gnatB main.adb
$ nm main.o
0000000000000048 s EH_frame1
                 U ___gnat_rcheck_CE_Access_Check # unexpected access checking
is inserted!
0000000000000000 T __ada_main
                 U _global__ref

For confirmation that "not null" is the trigger, delete "not null" from
global.ads

   ref : ptr := var'Access;

And recompile main.adb, use nm

$ gcc -c -gnatB main.adb
$ nm build/main.o
0000000000000018 s EH_frame1
0000000000000000 T __ada_main
                 U _global__ref

The access checking is removed as intended, this time.

Reply via email to