/* { dg-do link } */ /* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis" } */ /* { dg-require-effective-target lto } */ #include struct astruct_s { _Bool a; _Bool b; _Bool c;}; struct astruct_s astruct; // This should not escape struct bstruct_s { _Bool a; _Bool b; _Bool c;}; struct bstruct_s bstruct; // This should not escape __attribute__((externally_visible)) void escaping(struct astruct_s cstruct) {} void non_escaping(struct bstruct_s dstruct) {} int main() { astruct.a = 0; bstruct.b = 0; } /* { dg-final { scan-wpa-ipa-dump "collected,astruct_s" "hello-world" } } */ /* { dg-final { scan-wpa-ipa-dump "variable bstruct is escaping false" "hello-world" } } */ /* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "hello-world" } } */ /* { dg-final { scan-wpa-ipa-dump "parameter type astruct_s is escaping true" "hello-world" } } */ /* { dg-final { scan-wpa-ipa-dump "parameter type bstruct_s is escaping false" "hello-world" } } */