summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr69776-2.c
blob: e5bb28d7fb4875464230edff38dbcd9c49b83769 (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-additional-options "-fstrict-aliasing" } */

extern void *malloc (__SIZE_TYPE__);
extern void abort (void);

__attribute__((noinline,noclone))
void f(int *qi, double *qd)
{
  int i = *qi;
  *qd = 0;
  *qi = i;
}

int main()
{
  int *p = malloc(sizeof(double));

  *p = 1;
  f(p, (double *)p);
  if (*p != 1)
    abort();
  return 0;
}