summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-18-field-writes-deref-0.c
blob: f395f721ba8924bbd8287368e83db04672f299cd (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 run } */
/* { dg-options  "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis" } */

#include <assert.h>

int
main ()
{
  struct astruct_s
  {
    _Bool a;
    _Bool b;
    _Bool c;
    _Bool d;
  };
  struct astruct_s astruct;
  _Bool *c_ptr = &astruct.c;
  *c_ptr = 1;
  _Bool *a_ptr = &astruct.a;
  _Bool *d_ptr = &astruct.d;
  a_ptr++;
  d_ptr--;
  assert(*a_ptr == 1);
  assert(*d_ptr == 1);
  return 0;
}