blob: 2e7024ab907f8cdd3218ec221fbfce0875ed86b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* { dg-do link } */
/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis" } */
#include <stddef.h>
struct astruct_s { _Bool a; _Bool b; _Bool c;};
__attribute__((externally_visible)) struct astruct_s astruct; // This should escape
struct bstruct_s { _Bool a; _Bool b; _Bool c;};
struct bstruct_s bstruct; // This should not escape
int main()
{
astruct.a = 0;
bstruct.b = 0;
}
/* { dg-final { scan-wpa-ipa-dump "collected,astruct_s" "type-escape-analysis" } } */
/* { dg-final { scan-wpa-ipa-dump "type astruct_s is escaping true" "type-escape-analysis" } } */
/* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "type-escape-analysis" } } */
/* { dg-final { scan-wpa-ipa-dump "type bstruct_s is escaping false" "type-escape-analysis" } } */
|