Debian Codegraph @

gcc/testsuite/gnat.dg/strub_access1.adb

raw
1 -- { dg-do compile }
2 -- { dg-options "-fstrub=relaxed" }
3 -- { dg-require-effective-target strub }
4
5 -- Check that we reject 'Access of a strub variable whose type does
6 -- not carry a strub modifier.
7
8 procedure Strub_Access1 is
9 X : aliased Integer := 0;
10 pragma Machine_Attribute (X, "strub");
11
12 function F (P : access Integer) return Integer is (P.all);
13
14 begin
15 X := F (X'Unchecked_access); -- OK.
16 X := F (X'Access); -- { dg-error "target access type drops .strub. mode" }
17 end Strub_Access1;