Debian Codegraph @

gcc/testsuite/gnat.dg/strub_attr.adb

raw
1 -- { dg-do compile }
2 -- { dg-options "-fstrub=strict -fdump-ipa-strubm -fdump-ipa-strub" }
3 -- { dg-require-effective-target strub }
4
5 package body Strub_Attr is
6 E : exception;
7
8 procedure P (X : Integer) is
9 begin
10 raise E;
11 end;
12
13 function F (X : Integer) return Integer is
14 begin
15 return X * X;
16 end;
17
18 function G return Integer is (F (X));
19 -- function G return Integer is (FP (X));
20 -- Calling G would likely raise an exception, because although FP
21 -- carries the strub at-calls attribute needed to call F, the
22 -- attribute is dropped from the type used for the call proper.
23 end Strub_Attr;
24
25 -- { dg-final { scan-ipa-dump-times "\[(\]strub \[(\]internal\[)\]\[)\]" 2 "strubm" } }
26 -- { dg-final { scan-ipa-dump-times "\[(\]strub \[(\]at-calls\[)\]\[)\]" 0 "strubm" } }
27 -- { dg-final { scan-ipa-dump-times "\[(\]strub\[)\]" 1 "strubm" } }
28
29 -- { dg-final { scan-ipa-dump-times "strub.watermark_ptr" 6 "strub" } }
30 -- We have 1 at-calls subprogram (F) and 2 wrapped (P and G).
31 -- For each of them, there's one match for the wrapped signature,
32 -- and one for the update call.
33
34 -- { dg-final { scan-ipa-dump-times "strub.watermark" 27 "strub" } }
35 -- The 6 matches above, plus:
36 -- 5*2: wm var decl, enter, call, leave and clobber for each wrapper;
37 -- 2*1: an extra leave and clobber for the exception paths in the wrappers.
38 -- 7*1: for the F call in G, including EH path.