about summary refs log tree commit diff homepage
path: root/test/Concrete
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-02-28 20:31:11 +0100
committerJiri Slaby <jirislaby@gmail.com>2017-03-06 10:38:40 +0100
commitf69a8cd5c2181b020f756fedf1af348379ce54d2 (patch)
treea611e6c04d0e6ad96494c9bc203460007bee715c /test/Concrete
parente608c7a77733662e7b3e71b1e929899c718ce06c (diff)
downloadklee-f69a8cd5c2181b020f756fedf1af348379ce54d2.tar.gz
test: ConstantExpr, fix bogus test
There is a test that thinks this should hold:
((&gInt >> 8) << 8) != ((&gInt << 8) >> 8)

For example, if the address is 0x00123400, this means:
0x00123400 != 0x00123400
which is obviously not true. Kill the bogus assumption as it causes
occasional failures in the tests. This is done by ORing the address with
1 so that we can have:
0x00123400 != 0x00123401

Convert also the respective truncated 32bit pointers to 64bit.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'test/Concrete')
-rw-r--r--test/Concrete/ConstantExpr.ll13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/Concrete/ConstantExpr.ll b/test/Concrete/ConstantExpr.ll
index 351223e7..d00c59a6 100644
--- a/test/Concrete/ConstantExpr.ll
+++ b/test/Concrete/ConstantExpr.ll
@@ -45,13 +45,14 @@ define void @"test_logical_ops"() {
   call void @print_i32(i32 %t1)
   call void @print_i32(i32 %t2)
   call void @print_i32(i32 %t3)
+
+  ; or the address with 1 to ensure the addresses will differ in 'ne' below
+  %t4 = shl i64 lshr(i64 or(i64 ptrtoint(i32* @gInt to i64), i64 1), i64 8), 8
+  %t5 = shl i64 ashr(i64 or(i64 ptrtoint(i32* @gInt to i64), i64 1), i64 8), 8
+  %t6 = lshr i64 shl(i64 or(i64 ptrtoint(i32* @gInt to i64), i64 1), i64 8), 8
   
-  %t4 = shl i32 lshr(i32 ptrtoint(i32* @gInt to i32), i32 8), 8
-  %t5 = shl i32 ashr(i32 ptrtoint(i32* @gInt to i32), i32 8), 8
-  %t6 = lshr i32 shl(i32 ptrtoint(i32* @gInt to i32), i32 8), 8
-  
-  %t7 = icmp eq i32 %t4, %t5     
-  %t8 = icmp ne i32 %t4, %t6     
+  %t7 = icmp eq i64 %t4, %t5
+  %t8 = icmp ne i64 %t4, %t6
   
   %t9 = zext i1 %t7 to i8
   %t10 = zext i1 %t8 to i8