summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c
blob: 41618e06376aba7800af0108604902bc0547c9be (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
/* { dg-do run } */
/* { dg-options  "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */

#include <assert.h>
#include <stdio.h>
#include <stddef.h>
#include <stdio.h>

int
main ()
{
  struct astruct_s
  {
    _Bool a;
    _Bool b;
    _Bool c;
  };
  struct astruct_s a[2];
  struct astruct_s *a_0 = &(a[0]);
  struct astruct_s *a_1 = &(a[1]);
  struct astruct_s *a_1_from_a_0 = a_0 + 1;
  printf ("%d %d\n", a_0->a, a_0->c);
  //    old  new
  // 0   a    a
  // 1   b    c
  // 2   c    a
  // 3   a    c
  // 4   b    a
  // 5   c    c
  assert (a_1 == a_1_from_a_0);
}