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

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

// Some ports do not yet support long long
#if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)

/* PR c/4308
   This testcase failed because 0x8000000000000000 >> 0
   was incorrectly folded into 0xffffffff00000000.  */

long long foo (void)
{
  long long C = 1ULL << 63, X;
  int Y = 32;
  X = C >> (Y & 31);
  return X;
}
#endif

void testTortureExecute (void)
{
#if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
  if (foo () != 1ULL << 63)
    ASSERT (0);
  return;
#endif
}