aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/20040627-1.c
blob: 2b4f09fefc7ed055706cec4789355b55e0652151 (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
/* { dg-do link } */
/* { dg-options "-O2" } */

extern void link_error (void);


void test(int x)
{
  if ((x & ~x) != 0)
    link_error ();
  if ((~x & x) != 0)
    link_error ();

  if ((x ^ ~x) != -1)
    link_error ();
  if ((~x ^ x) != -1)
    link_error ();

  if ((x | ~x) != -1)
    link_error ();
  if ((~x | x) != -1)
    link_error ();

  if (x && !x)
    link_error ();
  if (!x && x)
    link_error ();

  if (!(x || !x))
    link_error ();
  if (!(!x || x))
    link_error ();
}

int main()
{
  test (0);
  test (1);
  test (-1);
  return 0;
}