summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-ea-11-cast-to-void-ptr-0.c
blob: 2bd1b62e28432f9f8b224ffdcec481d241ba2a2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* { dg-do link } */
/* { dg-options  "-flto -fipa-hello-world -fdump-ipa-hello-world" } */

#include <stddef.h>

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

void casting_to_void (struct astruct_s *s)
{
  void *nullify_non_escape = s;
}

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 "type astruct_s\\\* is escaping true" "hello-world" } } */
/* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "hello-world" } } */
/* { dg-final { scan-wpa-ipa-dump "type bstruct_s is escaping false" "hello-world" } } */