* src/SDCCcse.c (algebraicOpts): fixed bug 1579949
[fw/sdcc] / src / regression / sub2.c
index b2d74e29e4c8a0cedaac3d2e9acca2f15dc71d47..44b54d5e66aab72511161bac6baf09ac8090cd30 100644 (file)
@@ -1,17 +1,15 @@
-//#include "p16c84.h"
+#include "gpsim_assert.h"
 // Addition tests
 
 /* bit types are not ANSI - so provide a way of disabling bit types
  * if this file is used to test other compilers besides SDCC */
-#define SUPPORT_BIT_TYPES 1
+#define SUPPORT_BIT_TYPES 0
 
 /* Some compilers that support bit types do not support bit arithmetic 
  * (like bitx = bity + bitz;) */
 #define SUPPORT_BIT_ARITHMETIC 1
 
-unsigned char success=0;
 unsigned char failures=0;
-unsigned char dummy=0;
 
 #if SUPPORT_BIT_TYPES
 
@@ -37,11 +35,11 @@ char char1 = 0;
 char char2 = 0;
 
 
-void done()
+void
+done()
 {
-
-  dummy++;
-
+  ASSERT(MANGLE(failures) == 0);
+  PASSED();
 }
 
 void sub_int1(void)
@@ -121,6 +119,31 @@ void assign_char2int(void)
 
 }
 
+
+void sub_compound_char(void)
+{
+
+  char0 = char1 - 5;
+  if(char0 != 4)
+    failures++;
+
+  if((char1 - char0 - 5) != 0)
+    failures++;
+
+}
+
+void sub_compound_int(void)
+{
+
+  int0 = int1 - 5;
+  if(int0 != 4)
+    failures++;
+
+  if((int1 - int0 - 5) != 0)
+    failures++;
+
+}
+
 void main(void)
 {
 
@@ -139,6 +162,11 @@ void main(void)
   char1 = -5;
   assign_char2int();
 
-  success = failures;
+  char1 = 9;
+  sub_compound_char();
+  
+  int1 = 9;
+  sub_compound_int();
+
   done();
 }