Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20030120-1.c

raw
1 /* On H8/300 port, NOTICE_UPDATE_CC had a bug that causes the final
2 pass to remove test insns that should be kept. */
3
4 void abort (void);
5 void exit (int);
6
7 unsigned short
8 test1 (unsigned short w)
9 {
10 if ((w & 0xff00) == 0)
11 {
12 if (w == 0)
13 w = 2;
14 }
15 return w;
16 }
17
18 unsigned long
19 test2 (unsigned long w)
20 {
21 if ((w & 0xffff0000) == 0)
22 {
23 if (w == 0)
24 w = 2;
25 }
26 return w;
27 }
28
29 int
30 test3 (unsigned short a)
31 {
32 if (a & 1)
33 return 1;
34 else if (a)
35 return 1;
36 else
37 return 0;
38 }
39
40 int
41 main ()
42 {
43 if (test1 (1) != 1)
44 abort ();
45
46 if (test2 (1) != 1)
47 abort ();
48
49 if (test3 (2) != 1)
50 abort ();
51
52 exit (0);
53 }