From e46108503bd57923b3ba7a0106d91c7f13ba1f7f Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Thu, 27 Aug 2020 14:01:35 +0200 Subject: [PATCH] add test case for handling pointers as operand of logical operators (when kept) --- tests/syntax/keep_logical_operators.i | 10 ++++++++++ .../oracle/keep_logical_operators.res.oracle | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/syntax/keep_logical_operators.i b/tests/syntax/keep_logical_operators.i index dd05ac45a1b..5f7901e2354 100644 --- a/tests/syntax/keep_logical_operators.i +++ b/tests/syntax/keep_logical_operators.i @@ -9,3 +9,13 @@ int test(int a, int b, int c) { return 2; } + +int test_ptr(int* a, int* b, int* c) { + if (a && (b || c)) { + return 1; + } + if (a) + if (b) + return 2; + return 3; +} diff --git a/tests/syntax/oracle/keep_logical_operators.res.oracle b/tests/syntax/oracle/keep_logical_operators.res.oracle index 99261e5e4c5..23aec588134 100644 --- a/tests/syntax/oracle/keep_logical_operators.res.oracle +++ b/tests/syntax/oracle/keep_logical_operators.res.oracle @@ -11,4 +11,20 @@ int test(int a, int b, int c) return_label: return __retres; } +int test_ptr(int *a, int *b, int *c) +{ + int __retres; + if ((int)a && ((int)b || (int)c)) { + __retres = 1; + goto return_label; + } + if (a) + if (b) { + __retres = 2; + goto return_label; + } + __retres = 3; + return_label: return __retres; +} + -- GitLab