summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20051215-1.c
blob: 4d7b5c5538c99b3f24dff3396b0d4395c18121b1 (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
/*
   20051215-1.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* PR rtl-optimization/24899 */

int
foo (int x, int y, int *z)
{
  int a, b, c, d;

  a = b = 0;
  for (d = 0; d < y; d++)
    {
      if (z)
	b = d * *z;
      for (c = 0; c < x; c++)
	a += b;
    }

  return a;
}

void
testTortureExecute (void)
{
  if (foo (3, 2, 0) != 0)
    ASSERT (0);
  return;
}