summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c
blob: bf867b6cd432ff5fb415ff5bf62660bef6e50022 (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>

int
main ()
{
  struct astruct_s
  {
    _Bool a;
    _Bool b;
    _Bool c;
    _Bool d;
  };
  struct astruct_s a[2];
  struct bstruct_s
  {
    _Bool a;
    _Bool c;
    _Bool d;
  };

  struct astruct_s *a_1 = &(a[1]);
  struct astruct_s *a_0 = a_1 - 1;
  struct bstruct_s *b_1 = (struct bstruct_s *) a_1;
  struct bstruct_s *b_0 = b_1 - 1;
  assert ((struct bstruct_s *) a_0 != b_0);
}