summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20021120-3.c
blob: d62d29c1a77fa7e9d76134e3ab4badeb07c4cb9d (plain) (blame)
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
/*
   20021120-3.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

#include <stdio.h>

#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
unsigned int foo (char *c, unsigned int x, unsigned int y)
{
  register unsigned int z;

  sprintf (c, "%d", x / y);
  z = x + 1;
  return z / (y + 1);
}
#endif

void
testTortureExecute (void)
{
#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
  char c[16];

  if (foo (c, ~1U, 4) != (~0U / 5))
    ASSERT (0);
  return;
#endif
}