Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-460444.c
blob739eadbf2f5a2c97896162bff8c385ab35046aa4
1 /* bug 460444
2 */
3 #include <testfwk.h>
5 void
6 testXOR(void)
8 volatile int p = 5;
10 if (p ^ 0x60) {
11 // Good.
13 else {
14 FAIL();
17 /* Test is to see if it compiles. */
18 ASSERT((p^0x60) == 0x65);
19 ASSERT((p&0x61) == 0x01);
20 ASSERT((p|0x60) == 0x65);
22 p = 0x1234;
23 if (p ^ 0x5678) {
24 // Good.
26 else {
27 FAIL();
30 if (p & 0x4324) {
31 // Good
33 else {
34 FAIL();
37 if (p | 0x1279) {
38 // Good
40 else {
41 FAIL();
45 void
46 testLeftRightXor(void)
48 volatile int left, right;
50 left = 0x123;
51 right = 0x8101;
53 if (left ^ right) {
54 // Good
56 else {
57 FAIL();
60 if (left & right) {
61 // Good
63 else {
64 FAIL();
67 if (left | right) {
68 // Good
70 else {
71 FAIL();