| 1 |
-- { dg-do compile } |
| 2 |
-- { dg-options "-fstrub=strict -fdump-ipa-strubm" } |
| 3 |
-- { dg-require-effective-target strub } |
| 4 |
|
| 5 |
-- This is essentially the same test as strub_attr.adb, |
| 6 |
-- but with an explicit conversion. |
| 7 |
|
| 8 |
package body Strub_Ind1 is |
| 9 |
E : exception; |
| 10 |
|
| 11 |
type Strub_Int is New Integer; |
| 12 |
pragma Machine_Attribute (Strub_Int, "strub"); |
| 13 |
|
| 14 |
function G return Integer; |
| 15 |
pragma Machine_Attribute (G, "strub", "disabled"); |
| 16 |
|
| 17 |
procedure P (X : Integer) is |
| 18 |
begin |
| 19 |
raise E; |
| 20 |
end; |
| 21 |
|
| 22 |
function G return Integer is (FP (X)); |
| 23 |
|
| 24 |
type GT is access function return Integer; |
| 25 |
pragma Machine_Attribute (GT, "strub", "disabled"); |
| 26 |
|
| 27 |
type GT_SC is access function return Integer; |
| 28 |
pragma Machine_Attribute (GT_SC, "strub", "callable"); |
| 29 |
|
| 30 |
GP : GT_SC := GT_SC (GT'(G'Access)); |
| 31 |
-- pragma Machine_Attribute (GP, "strub", "callable"); -- not needed. |
| 32 |
|
| 33 |
function F (X : Integer) return Integer is |
| 34 |
begin |
| 35 |
return X * GP.all; |
| 36 |
end; |
| 37 |
|
| 38 |
end Strub_Ind1; |
| 39 |
|
| 40 |
-- { dg-final { scan-ipa-dump-times "\[(\]strub \[(\]disabled\[)\]\[)\]" 1 "strubm" } } |
| 41 |
-- { dg-final { scan-ipa-dump-times "\[(\]strub \[(\]internal\[)\]\[)\]" 1 "strubm" } } |
| 42 |
-- { dg-final { scan-ipa-dump-times "\[(\]strub\[)\]" 1 "strubm" } } |