summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/max-1.c
blob: 40f2145c038ffabf2774ec5a2505acb9f5c07de2 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* PR middle-end/18548 */
/* Test case reduced by Andrew Pinski <pinskia@physics.uc.edu> */
/* { dg-do run } */
/* { dg-options "-O1 " } */
/* Option -fno-tree-lrs removed By Andrew MacLeod since it is no longer 
   supported in the compiler beginning with GCC 4.3.  */
/* m32c has varying sized pointers */
/* { dg-skip-if "" { "m32c-*-*" } { "*" } { "-mcpu=m32c" "-mcpu=m32cm" } } */

/* Kludge to make it signed. */
#define unsigned signed
__extension__ typedef __SIZE_TYPE__ ssize_t;
#undef unsigned

extern void abort (void);

ssize_t fff[10];

void f(ssize_t a, ssize_t b)
{
  ssize_t crcc = b;
  ssize_t d = *((ssize_t*)(a+1));
  int i;

  a = d >= b? d:b;


  for(i=0;i<10;i++)
   fff[i] = a;
}

/* The variable a cannot be a local variable as we get better aliasing
   now and decide that the store to a is dead.  The better aliasing comes
   from better representation of pointer arithmetic. */
ssize_t a = 10;
int main(void)
{
  int i;
  f((ssize_t)(&a)-1,0);
  for(i = 0;i<10;i++)
   if (fff[i]!=10)
    abort ();
  return 0;
}