summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-pr69097-2.c
blob: f4a7cb712866b82aca1e781a206b59d9cfa7346c (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
35
36
37
38
39
40
41
42
/*
   pr69097-2.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

#include <limits.h>

/* PR tree-optimization/69097 */

int
f1 (int x, int y)
{
  return x % y;
}

int
f2 (int x, int y)
{
  return x % -y;
}

int
f3 (int x, int y)
{
  int z = -y;
  return x % z;
}

void
testTortureExecute (void)
{
  if (f1 (-INT_MAX - 1, 1) != 0
      || f2 (-INT_MAX - 1, -1) != 0
      || f3 (-INT_MAX - 1, -1) != 0)
    ASSERT(0);
  return;
}