summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-26-array-cast-0.c
blob: 7ec3c82a9168d3bbacbe6ecac9aa6a3acc553db4 (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 -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */

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

int
main (int argc, char **argv)
{
  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_0 = &(a[0]);
  struct astruct_s *a_1 = a_0 + argc;
  struct bstruct_s *b_0 = (struct bstruct_s *) a_0;
  struct bstruct_s *b_1 = b_0 + argc;
  assert ((struct bstruct_s *) a_1 == b_1);
}