[Lldb-commits] [PATCH] D49155: [IRInterpreter] Fix misevaluation of interpretation expressions with `urem`

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 11 17:36:13 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL336872: [IRInterpreter] Fix misevaluation of interpretation expressions with `urem`. (authored by davide, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49155?vs=154884&id=155096#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49155

Files:
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/TestScalarURem.py
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/main.c
  lldb/trunk/source/Core/Scalar.cpp


Index: lldb/trunk/source/Core/Scalar.cpp
===================================================================
--- lldb/trunk/source/Core/Scalar.cpp
+++ lldb/trunk/source/Core/Scalar.cpp
@@ -1184,38 +1184,38 @@
   case e_void:
     break;
   case e_sint:
+    m_type = e_uint;
     success = true;
     break;
   case e_uint:
-    m_type = e_uint;
     success = true;
     break;
   case e_slong:
+    m_type = e_ulong;
     success = true;
     break;
   case e_ulong:
-    m_type = e_ulong;
     success = true;
     break;
   case e_slonglong:
+    m_type = e_ulonglong;
     success = true;
     break;
   case e_ulonglong:
-    m_type = e_ulonglong;
     success = true;
     break;
   case e_sint128:
+    m_type = e_uint128;
     success = true;
     break;
   case e_uint128:
-    m_type = e_uint128;
     success = true;
     break;
   case e_sint256:
+    m_type = e_uint256;
     success = true;
     break;
   case e_uint256:
-    m_type = e_uint256;
     success = true;
     break;
   case e_float:
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/Makefile
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/main.c
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/main.c
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/main.c
@@ -0,0 +1,19 @@
+// Make sure we IR-interpret the expression correctly.
+
+typedef unsigned int uint32_t;
+struct S0 {
+  signed f2;
+};
+static g_463 = 0x1561983AL;
+void func_1(void)
+{
+  struct S0 l_19;
+  l_19.f2 = 419;
+  uint32_t l_4037 = 4294967295UL;
+  l_19.f2 = g_463; //%self.expect("expr ((l_4037 % (-(g_463))) | l_19.f2)", substrs=['(unsigned int) $0 = 358717883'])
+}
+int main()
+{
+  func_1();
+  return 0;
+}
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/TestScalarURem.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/TestScalarURem.py
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar42038760/TestScalarURem.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49155.155096.patch
Type: text/x-patch
Size: 2697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180712/647fe91c/attachment.bin>


More information about the lldb-commits mailing list