Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Z3 ITE expressions #336

Merged
merged 3 commits into from
Apr 29, 2024
Merged

Handle Z3 ITE expressions #336

merged 3 commits into from
Apr 29, 2024

Conversation

frabert
Copy link
Collaborator

@frabert frabert commented Apr 29, 2024

This PR fixes issue #335

Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/8880667186

fizzbuzz.bc

typedefs_of_typedefs.bc

switch_loop.bc

func_cond_zero_arg.bc

fcmp.bc

conflicting_names.bc

struct.bc

issue_183_literal_structs.bc

zeroinit.bc

issue_127_uint128_t_lit.bc

struct_swap.bc

global_using_function_decl.bc

init_list.bc

ret0.bc

goto_loop.bc

trunc.bc

bitops.bc

cast.bc

nullptr.bc

nested_struct.bc

array_swap.bc

binops.bc

bitmask.bc

loop.bc

float.bc

reg_test_structure_fields.bc

vectors.bc

funcptr.bc

inttoptr.bc

short.bc

issue_4.bc

conflicting_global.bc

issue_123_uint128_t.bc

fizzbuzz_stateful.bc

issue_94_strncmp.bc

bool.bc

zext.bc

byval_struct.bc

nested_while.bc

func_cond_two_arg.bc

assert.bc

switch.bc

branch.bc

template_parameter_pack.bc

byval_tail_nogep.ll

byval_tail_gep.ll

issue_335_z3_ite.ll

@frabert frabert changed the title Fix #335 Fixes #335 Apr 29, 2024
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/8880782442

fizzbuzz.bc

typedefs_of_typedefs.bc

switch_loop.bc

func_cond_zero_arg.bc

fcmp.bc

conflicting_names.bc

struct.bc

issue_183_literal_structs.bc

zeroinit.bc

issue_127_uint128_t_lit.bc

struct_swap.bc

global_using_function_decl.bc

init_list.bc

ret0.bc

goto_loop.bc

trunc.bc

bitops.bc

cast.bc

nullptr.bc

nested_struct.bc

array_swap.bc

binops.bc

bitmask.bc

loop.bc

float.bc

reg_test_structure_fields.bc

vectors.bc

funcptr.bc

inttoptr.bc

short.bc

issue_4.bc

conflicting_global.bc

issue_123_uint128_t.bc

fizzbuzz_stateful.bc

issue_94_strncmp.bc

bool.bc

zext.bc

byval_struct.bc

nested_while.bc

--- /dev/fd/63	2024-04-29 15:04:39.443335087 +0000
+++ /dev/fd/62	2024-04-29 15:04:39.443335087 +0000
@@ -25,7 +25,7 @@
                 printf("loop2 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
+    if (((int)var1 >= 20 || (int)var1 <= 10) && (int)var1 >= 20) {
         return var0;
     }
 }

func_cond_two_arg.bc

assert.bc

switch.bc

branch.bc

template_parameter_pack.bc

byval_tail_nogep.ll

byval_tail_gep.ll

issue_335_z3_ite.ll

--- /dev/fd/63	2024-04-29 15:04:40.355333333 +0000
+++ /dev/fd/62	2024-04-29 15:04:40.359333326 +0000
@@ -0,0 +1,33 @@
+unsigned int ifWhile(void);
+int main(void);
+unsigned int ifWhile(void) {
+    unsigned int var0;
+    unsigned int var1;
+    var0 = 0U;
+    var1 = 3U;
+    if (var0 != 5U) {
+        while ((int)var0 < 5)
+            {
+                var1 = var1 * 2U;
+                var0 = var0 + 1U;
+            }
+    } else {
+        while (var1 == 2U)
+            {
+                var1 = var1 + 2U;
+            }
+    }
+    if (var0 == 5U && var1 != 2U) {
+        var1 = var1 + 25U;
+    }
+    if (!(var0 == 5U ? var1 == 2U : (int)var0 < 5)) {
+        return var1;
+    }
+}
+int main(void) {
+    unsigned int var0;
+    unsigned int call1;
+    var0 = 0U;
+    call1 = ifWhile();
+    return call1;
+}

@frabert frabert marked this pull request as ready for review April 29, 2024 15:11
@frabert frabert changed the title Fixes #335 Handle Z3 ITE expressions Apr 29, 2024
@frabert frabert requested a review from surovic April 29, 2024 15:20
@surovic surovic merged commit 0de1db1 into master Apr 29, 2024
6 checks passed
@surovic surovic deleted the frabert/fix-335 branch April 29, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants