summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c
blob: a2572b37b04a7a4cb4cd46872f751597f669bb55 (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
27
28
29
30
31
32
33
/* { dg-do run } */
/* { dg-options  "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */

#include <assert.h>
#include <stdio.h>
int
main ()
{
  struct inner_s
  {
    _Bool a;
    _Bool b;
    _Bool c;
    _Bool d;
  };
  struct astruct_s
  {
    struct inner_s a;
    struct inner_s b;
    struct inner_s c;
    struct inner_s d;
  };
  struct astruct_s astruct;
  // printf("%d %d %d\n", &astruct.a, &astruct.c, &astruct.d);
  struct inner_s *a_ptr = &(astruct.a);
  struct inner_s *c_ptr = &(astruct.c);
  struct inner_s *d_ptr = &(astruct.d);
  printf ("%d %d %d %d\n", a_ptr->a, a_ptr->b, a_ptr->c, a_ptr->d);
  struct inner_s *c_ptr_2 = a_ptr + 1;
  struct inner_s *a_ptr_2 = d_ptr - 2;
  assert (c_ptr_2 == c_ptr);
  assert (a_ptr == a_ptr_2);
}