BoomerangDecompiler / boomerang

Boomerang Decompiler - Fighting the code-rot :)
Other
374 stars 59 forks source link

Regressions when running regression test suite on 32 bit Linux #175

Open ceeac opened 5 years ago

ceeac commented 5 years ago

OS: Void Linux 32 bit Output of 'boomerang-cli --version': boomerang-cli v0.4.0-alpha-387-gb349b74ac

Steps to reproduce:

  1. Run regression test suite on 32 bit Linux

Expected/desired behaviour Regression test suite runs successfully.

Actual behaviour


Boomerang Regression Tester
===========================

Cleaning up old data ...
Testing for regressions 
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/elf32-ppc/fibo/fibo/fibo.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/elf32-ppc/fibo/fibo/fibo.c
@@ -5,15 +5,15 @@
 int main(int argc, char *argv[])
 {
     int g3;        // r3
-    __size32 g3_2;         // r3{8}
+    __size32 g3_2;         // r3{9}
     int local0;        // m[g1 - 24]

     printf("Input number: ");
     scanf("%d", &local0);
     if (local0 > 1) {
-        g3_2 = fib(local0 - 1);
-        g3 = fib(local0 - 2);
-        printf("fibonacci(%d) = %d\n", local0, g3_2 + g3);
+        g3 = fib(local0 - 1);
+        g3_2 = fib(local0 - 2);
+        printf("fibonacci(%d) = %d\n", local0, g3 + g3_2);
     }
     else {
         printf("fibonacci(%d) = %d\n", local0, local0);

r..................................................
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/pentium/asgngoto/asgngoto/asgngoto.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/pentium/asgngoto/asgngoto/asgngoto.c
@@ -1,37 +1,33 @@
 int main(int argc, char *argv[]);
-__size32 atexit(atexitfunc param1);
+void atexit(atexitfunc param1);
 void MAIN__(__size32 param1);

 /** address: 0x08048824 */
 int main(int argc, char *argv[])
 {
-    __size32 eax;      // r24
-    int ebp;       // r29
-    int ecx;       // r25
-    int edx;       // r26
-    int esp;       // r28
+    __size32 local0;       // m[esp - 40]

     f_setarg(argc, argv);
     f_setsig();
     f_init();
-    eax = atexit(0x8048584); /* Warning: also results in ecx, edx */
-    MAIN__(eax, ecx, edx, esp - 4, SUBFLAGS32((esp - 12), 16, esp - 28), esp == 28, (unsigned int)(esp - 12) < 16, argc, argv, ebp, argv, 0x8048584, pc);
+    atexit(0x8048584);
+    MAIN__(local0);
+    exit(0);
+    return;
 }

 /** address: 0x08048904 */
-__size32 atexit(atexitfunc param1)
+void atexit(atexitfunc param1)
 {
     void *eax;         // r24
-    int eax_1;         // r24
-    int ecx;       // r25
     int edx;       // r26

     eax = 0;
     if (edx != 0) {
         eax = *edx;
     }
-    eax_1 = __cxa_atexit(param1, 0, eax); /* Warning: also results in ecx, edx */
-    return eax_1; /* WARNING: Also returning: ecx := ecx, edx := edx */
+    __cxa_atexit(param1, 0, eax);
+    return;
 }

 /** address: 0x080486cc */
@@ -46,16 +42,33 @@
     do_lio(0x80489b0, 0x80489a8, &param1, 4);
     e_rsle();
     if (param1 != 2) {
-bb0x8048741:
-        if (param1 != 3) {
-bb0x804874e:
-            if (param1 != 4) {
-bb0x804875b:
-            }
-            goto bb0x804875b;
-        }
-        goto bb0x804874e;
     }
-    goto bb0x8048741;
+    if (param1 != 3) {
+    }
+    if (param1 != 4) {
+    }
+    switch(local4) {
+    case 0x8048760:
+        s_wsle();
+        do_lio(0x80489ac, 0x80489a8, 0x8048986, 18);
+        e_wsle();
+        break;
+    case 0x8048793:
+        s_wsle();
+        do_lio(0x80489ac, 0x80489a8, 0x8048998, 4);
+        e_wsle();
+        break;
+    case 0x80487c3:
+        s_wsle();
+        do_lio(0x80489ac, 0x80489a8, 0x804899c, 6);
+        e_wsle();
+        break;
+    case 0x80487f3:
+        s_wsle();
+        do_lio(0x80489ac, 0x80489a8, 0x80489a2, 5);
+        e_wsle();
+        break;
+    }
+    return;
 }

r..
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/pentium/bswap/bswap/bswap.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/pentium/bswap/bswap/bswap.c
@@ -14,6 +14,6 @@
 /** address: 0x08048370 */
 __size32 bswap(int param1)
 {
-    return (param1 & 0xff) << 24 | (param1 & 0xff00) << 8 | (unsigned int)(param1 & 0xff0000) >> 8 | (unsigned int)(param1 & ~0xffffff) >> 24;
+    return (param1 & 0xff) << 24 | (param1 & 0xff00) << 8 | (unsigned int)(param1 & 0xff0000) >> 8 | (unsigned int)(param1 & 0x7fffffff) >> 24;
 }

r..............................................
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/ppc/daysofxmas/daysofxmas/daysofxmas.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/ppc/daysofxmas/daysofxmas/daysofxmas.c
@@ -12,7 +12,7 @@
     int CR6;       // r70
     __size32 CR7;      // r71
     unsigned int g0;       // r0
-    unsigned int g0_1;         // r0{46}
+    unsigned int g0_1;         // r0{0}
     int g3;        // r3
     char * *g3_1;      // r3
     int g5;        // r5
@@ -22,13 +22,13 @@
         if (argc >= 0) {
             if (argc <= 0) {
                 local6 = 0;
-                g0_1 = *(unsigned char*)g5;
-                if ((ROTL(g0_1) & 0xff) == 47) {
+                g0 = *(unsigned char*)g5;
+                if ((ROTL(g0) & 0xff) == 47) {
 bb0x100006e8:
                     local6 = 1;
                 }
                 else {
-                    g3_1 = main(-61, ROTL(g0) & 0xff);
+                    g3_1 = main(-61, ROTL(g0_1) & 0xff);
                     g3 = main(0, g3_1);
                     if (g3 != 0) {
                         goto bb0x100006e8;

r...
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/ppc/fibo2/fibo2/fibo2.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/ppc/fibo2/fibo2/fibo2.c
@@ -29,7 +29,7 @@
 __size32 fib2(int param1)
 {
     int g3;        // r3
-    int g3_1;      // r3{5}
+    int g3_1;      // r3{6}
     __size32 g9;       // r9
     int local5;        // m[g1 - 20]

@@ -37,9 +37,9 @@
         local5 = param1;
     }
     else {
-        g3_1 = fib1();
-        g3 = fib1(); /* Warning: also results in g9 */
-        local5 = g3_1 + g3;
+        g3 = fib1();
+        g3_1 = fib1(); /* Warning: also results in g9 */
+        local5 = g3 + g3_1;
     }
     return local5; /* WARNING: Also returning: g9 := g9 */
 }

r...........
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/ppc/o4/fibo/fibo/fibo.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/ppc/o4/fibo/fibo/fibo.c
@@ -5,15 +5,15 @@
 int main(int argc, char *argv[])
 {
     int g3;        // r3
-    __size32 g3_2;         // r3{8}
+    __size32 g3_2;         // r3{9}
     int local0;        // m[g1 - 24]

     printf("Input number: ");
     scanf("%d", &local0);
     if (local0 > 1) {
-        g3_2 = fib(local0 - 1);
-        g3 = fib(local0 - 2);
-        printf("fibonacci(%d) = %d\n", local0, g3_2 + g3);
+        g3 = fib(local0 - 1);
+        g3_2 = fib(local0 - 2);
+        printf("fibonacci(%d) = %d\n", local0, g3 + g3_2);
     }
     else {
         printf("fibonacci(%d) = %d\n", local0, local0);

r...............................................................
--- /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/sparc/shared2/shared2/shared2.c
+++ /home/ceeac/Projects/code/boomerang/build/tests/regression-tests/expected-outputs/sparc/shared2/shared2/shared2.c
@@ -30,72 +30,72 @@
     __size32 local12;      // m[o6 + 52]
     __size32 local13;      // m[o6 + 56]
     __size32 local14;      // m[o6 + 60]
-    int local15;       // m[o6 + 4]{24}
-    int local16;       // m[o6 + 4]{27}
-    int local17;       // m[o6 + 4]{30}
-    int local18;       // m[o6 + 4]{35}
-    int local19;       // m[o6 + 8]{24}
+    int local15;       // m[o6 + 4]{40}
+    int local16;       // m[o6 + 4]{35}
+    int local17;       // m[o6 + 4]{27}
+    int local18;       // m[o6 + 4]{24}
+    int local19;       // m[o6 + 8]{40}
     __size32 local2;       // m[o6 + 12]
-    int local20;       // m[o6 + 8]{27}
-    int local21;       // m[o6 + 8]{30}
-    int local22;       // m[o6 + 8]{35}
-    int local23;       // m[o6 + 12]{24}
-    int local24;       // m[o6 + 12]{27}
-    int local25;       // m[o6 + 12]{30}
-    int local26;       // m[o6 + 12]{35}
-    int local27;       // m[o6 + 16]{24}
-    int local28;       // m[o6 + 16]{27}
-    int local29;       // m[o6 + 16]{30}
+    int local20;       // m[o6 + 8]{35}
+    int local21;       // m[o6 + 8]{27}
+    int local22;       // m[o6 + 8]{24}
+    int local23;       // m[o6 + 12]{40}
+    int local24;       // m[o6 + 12]{35}
+    int local25;       // m[o6 + 12]{27}
+    int local26;       // m[o6 + 12]{24}
+    int local27;       // m[o6 + 16]{40}
+    int local28;       // m[o6 + 16]{35}
+    int local29;       // m[o6 + 16]{27}
     __size32 local3;       // m[o6 + 16]
-    int local30;       // m[o6 + 16]{35}
-    int local31;       // m[o6 + 20]{24}
-    int local32;       // m[o6 + 20]{27}
-    int local33;       // m[o6 + 20]{30}
-    int local34;       // m[o6 + 20]{35}
-    int local35;       // m[o6 + 24]{24}
-    int local36;       // m[o6 + 24]{27}
-    int local37;       // m[o6 + 24]{30}
-    int local38;       // m[o6 + 24]{35}
-    int local39;       // m[o6 + 28]{24}
+    int local30;       // m[o6 + 16]{24}
+    int local31;       // m[o6 + 20]{40}
+    int local32;       // m[o6 + 20]{35}
+    int local33;       // m[o6 + 20]{27}
+    int local34;       // m[o6 + 20]{24}
+    int local35;       // m[o6 + 24]{40}
+    int local36;       // m[o6 + 24]{35}
+    int local37;       // m[o6 + 24]{27}
+    int local38;       // m[o6 + 24]{24}
+    int local39;       // m[o6 + 28]{40}
     __size32 local4;       // m[o6 + 20]
-    int local40;       // m[o6 + 28]{27}
-    int local41;       // m[o6 + 28]{30}
-    int local42;       // m[o6 + 28]{35}
-    int local43;       // m[o6 + 32]{24}
-    int local44;       // m[o6 + 32]{27}
-    int local45;       // m[o6 + 32]{30}
-    int local46;       // m[o6 + 32]{35}
-    int local47;       // m[o6 + 36]{24}
-    int local48;       // m[o6 + 36]{27}
-    int local49;       // m[o6 + 36]{30}
+    int local40;       // m[o6 + 28]{35}
+    int local41;       // m[o6 + 28]{27}
+    int local42;       // m[o6 + 28]{24}
+    int local43;       // m[o6 + 32]{40}
+    int local44;       // m[o6 + 32]{35}
+    int local45;       // m[o6 + 32]{27}
+    int local46;       // m[o6 + 32]{24}
+    int local47;       // m[o6 + 36]{40}
+    int local48;       // m[o6 + 36]{35}
+    int local49;       // m[o6 + 36]{27}
     __size32 local5;       // m[o6 + 24]
-    int local50;       // m[o6 + 36]{35}
-    int local51;       // m[o6 + 40]{24}
-    int local52;       // m[o6 + 40]{27}
-    int local53;       // m[o6 + 40]{30}
-    int local54;       // m[o6 + 40]{35}
-    int local55;       // m[o6 + 44]{24}
-    int local56;       // m[o6 + 44]{27}
-    int local57;       // m[o6 + 44]{30}
-    int local58;       // m[o6 + 44]{35}
-    int local59;       // m[o6 + 48]{24}
+    int local50;       // m[o6 + 36]{24}
+    int local51;       // m[o6 + 40]{40}
+    int local52;       // m[o6 + 40]{35}
+    int local53;       // m[o6 + 40]{27}
+    int local54;       // m[o6 + 40]{24}
+    int local55;       // m[o6 + 44]{40}
+    int local56;       // m[o6 + 44]{35}
+    int local57;       // m[o6 + 44]{27}
+    int local58;       // m[o6 + 44]{24}
+    int local59;       // m[o6 + 48]{40}
     __size32 local6;       // m[o6 + 28]
-    int local60;       // m[o6 + 48]{27}
-    int local61;       // m[o6 + 48]{30}
-    int local62;       // m[o6 + 48]{35}
-    int local63;       // m[o6 + 52]{24}
-    int local64;       // m[o6 + 52]{27}
-    int local65;       // m[o6 + 52]{30}
-    int local66;       // m[o6 + 52]{35}
-    int local67;       // m[o6 + 56]{24}
-    int local68;       // m[o6 + 56]{27}
-    int local69;       // m[o6 + 56]{30}
+    int local60;       // m[o6 + 48]{35}
+    int local61;       // m[o6 + 48]{27}
+    int local62;       // m[o6 + 48]{24}
+    int local63;       // m[o6 + 52]{40}
+    int local64;       // m[o6 + 52]{35}
+    int local65;       // m[o6 + 52]{27}
+    int local66;       // m[o6 + 52]{24}
+    int local67;       // m[o6 + 56]{40}
+    int local68;       // m[o6 + 56]{35}
+    int local69;       // m[o6 + 56]{27}
     __size32 local7;       // m[o6 + 32]
-    int local70;       // m[o6 + 56]{35}
-    int local71;       // m[o6 + 60]{24}
-    int local72;       // m[o6 + 60]{27}
-    int local73;       // m[o6 + 60]{30}
-    int local74;       // m[o6 + 60]{35}
+    int local70;       // m[o6 + 56]{24}
+    int local71;       // m[o6 + 60]{40}
+    int local72;       // m[o6 + 60]{35}
+    int local73;       // m[o6 + 60]{27}
+    int local74;       // m[o6 + 60]{24}
     __size32 local8;       // m[o6 + 36]
     __size32 local9;       // m[o6 + 40]
     int o0;        // r8
@@ -149,23 +149,23 @@
     o3 = _ZN1D3fooEv(o0_1, global_0x000217a8, 8, 0x217a4, 0x21740, global_0x0002174c, o7_1, o0_1, l1, o0_1 + 12, l3, l4, l5, l6, l7, 0, argv, o2_7, o3, o4, o5, o6, o7_4, l1, l2, l3, l4, l5, l6, l7, i0, i1, i2, i3, i4, i5, i6, i7); /* Warning: also results in o4, o5, o7, l0, l1, l2, l3, l4, l5, l6, l7, i0, i1, i2, i3, i4, i5, i6, i7 */
     o2 = *l0;
     o1 = *o2;
-    (*o1)(l0, o1, o2, o3, o4, o5, o7, l0, l2, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l1, l3, l4, l5, l6, l7, local15, local19, local23, local27, local31, local35, local39, local43, local47, local51, local55, local59, local63, local67, local71);
+    (*o1)(l0, o1, o2, o3, o4, o5, o7, l0, l2, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l1, l3, l4, l5, l6, l7, local18, local22, local26, local30, local34, local38, local42, local46, local50, local54, local58, local62, local66, local70, local74);
     o2 = *(l0 + 12);
     o1 = *o2;
-    (*o1)(l2, o1, o2, o3, o4, o5, o7, l0, l2, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l1, l3, l4, l5, l6, l7, local16, local20, local24, local28, local32, local36, local40, local44, local48, local52, local56, local60, local64, local68, local72);
+    (*o1)(l2, o1, o2, o3, o4, o5, o7, l0, l2, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l1, l3, l4, l5, l6, l7, local17, local21, local25, local29, local33, local37, local41, local45, local49, local53, local57, local61, local65, local69, local73);
     o0_1 = *l0;
     o1 = *(o0_1 - 12);
     o2 = *(l0 + o1);
     o3 = *o2;
-    (*o3)(l0 + o1, o1, o2, o3, o4, o5, o7, l0, l2, l0 + o1, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l1, l4, l5, l6, l7, local17, local21, local25, local29, local33, local37, local41, local45, local49, local53, local57, local61, local65, local69, local73);
+    (*o3)(l0 + o1, o1, o2, o3, o4, o5, o7, l0, l2, l0 + o1, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l1, l4, l5, l6, l7, local0, local1, local2, local3, local4, local5, local6, local7, local8, local9, local10, local11, local12, local13, local14);
     o0_1 = *(l0 + 12);
     l1 = *(o0_1 - 12);
     o1 = *(l2 + l1);
     o2 = *o1;
-    (*o2)(l2 + l1, o1, o2, o3, o4, o5, o7, l0, l1, l2, l2 + l1, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l4, l5, l6, l7, local18, local22, local26, local30, local34, local38, local42, local46, local50, local54, local58, local62, local66, local70, local74);
+    (*o2)(l2 + l1, o1, o2, o3, o4, o5, o7, l0, l1, l2, l2 + l1, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l4, l5, l6, l7, local16, local20, local24, local28, local32, local36, local40, local44, local48, local52, local56, local60, local64, local68, local72);
     o3 = *(l2 + l1);
     o1 = *o3;
-    (*o1)(l3, o1, o2, o3, o4, o5, o7, l0, l1, l2, l3, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l4, l5, l6, l7, local0, local1, local2, local3, local4, local5, local6, local7, local8, local9, local10, local11, local12, local13, local14);
+    (*o1)(l3, o1, o2, o3, o4, o5, o7, l0, l1, l2, l3, i0, i1, i2, i3, i4, i5, i6, i7, <all>, l4, l5, l6, l7, local15, local19, local23, local27, local31, local35, local39, local43, local47, local51, local55, local59, local63, local67, local71);
     return i0;
 }

r..............

Regressions:
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/elf32-ppc/fibo
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/pentium/asgngoto
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/pentium/bswap
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/ppc/daysofxmas
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/ppc/fibo2
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/ppc/o4/fibo
r /home/ceeac/Projects/code/boomerang/build/out/share/boomerang/samples/sparc/shared2

Additional comments: Might help with identifying and fixing sources of non-determinism and/or platform specific behaviour.