summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-13-modify-size-four-0.c
blob: 911e9cba242fec97d6d2999aac2ca05e7ae8d9e9 (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
/* { dg-do run } */
/* { dg-options  "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis" } */

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

int
main ()
{
  struct astruct_s
  {
    _Bool a;
    _Bool b;
    _Bool c;
    _Bool d;
  };
  struct astruct_s astruct;
  _Bool *a = &(astruct.a);
  _Bool *c = &(astruct.c);
  _Bool *d = &(astruct.d);
  ptrdiff_t diff_1 = c - a;
  ptrdiff_t diff_2 = d - a;
  assert (diff_1 == 1);
  assert (diff_2 == 2);
}