Debian Codegraph @

gcc/testsuite/c-c++-common/strub-strict2.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */
3 /* { dg-require-effective-target strub } */
4
5 static int __attribute__ ((__strub__)) var;
6
7 /* g becomes STRUB_INTERNAL because of the use of the strub variable, and gets
8 split into STRUB_WRAPPER and STRUB_WRAPPED. It's not STRUB_AT_CALLS_OPT
9 because force_output is set for static non-inline functions when not
10 optimizing, and that keeps only_called_directly_p from returning true, which
11 makes STRUB_AT_CALLS[_OPT] non-viable. */
12 static void
13 g() {
14 var--;
15 }
16
17 /* f becomes STRUB_INTERNAL because of the use of the strub variable, and gets
18 split into STRUB_WRAPPER and STRUB_WRAPPED. */
19 void
20 f() {
21 var++;
22 g(); /* { dg-error "calling non-.strub." } */
23 }
24
25 /* { dg-final { scan-ipa-dump-times "strub \[(\]" 2 "strubm" } } */
26 /* { dg-final { scan-ipa-dump-times "strub \[(\]internal\[)\]" 2 "strubm" } } */