diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/strub-strict2.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/strub-strict2.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/strub-strict2.c b/gcc/testsuite/c-c++-common/strub-strict2.c new file mode 100644 index 0000000..b4f2888 --- /dev/null +++ b/gcc/testsuite/c-c++-common/strub-strict2.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */ + +static int __attribute__ ((__strub__)) var; + +/* g becomes STRUB_INTERNAL because of the use of the strub variable, and gets + split into STRUB_WRAPPER and STRUB_WRAPPED. It's not STRUB_AT_CALLS_OPT + because force_output is set for static non-inline functions when not + optimizing, and that keeps only_called_directly_p from returning true, which + makes STRUB_AT_CALLS[_OPT] non-viable. */ +static void +g() { + var--; +} + +/* f becomes STRUB_INTERNAL because of the use of the strub variable, and gets + split into STRUB_WRAPPER and STRUB_WRAPPED. */ +void +f() { + var++; + g(); /* { dg-error "calling non-.strub." } */ +} + +/* { dg-final { scan-ipa-dump-times "strub \[(\]" 2 "strubm" } } */ +/* { dg-final { scan-ipa-dump-times "strub \[(\]internal\[)\]" 2 "strubm" } } */ |