[Lldb-commits] [PATCH] D67227: [lldb] Extend and document TestIRInterpreter.py

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 5 14:23:22 PDT 2019


shafik added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/test/commands/expression/ir-interpreter/TestIRInterpreter.py:54
+                # Shifting longer than size of a type also doesn't work.
+                if rhs.value <= 0 or rhs.value >= 7:
+                    return False
----------------
teemperor wrote:
> shafik wrote:
> > I may be missing something here but this looks like it should be `32` instead of `7` or rather `sizeof(int)*8`
> > 
> > When we say doesn't work do we mean undefined behavior?
> Good catch, originally that was supposed to be `> 7` so that we don't overflow any data type (assuming we ever extend the test to char). But I can change it to `>= 32` until we actually use any 8-bit type.
> 
> And 'doesn't work' means that it will literally cause the test to fail and this test stops working. The interpreter will do something else than the JIT in these cases which is a bug. We probably should detect UB when interpreting these expressions and throw an error, but that's a whole new story. This is more about adding testing to the existing code.
if I am not missing anything here in C++ and C the operands of expressions undergo the usual arithmetic conversions and for integral types they undergo integer promotions. This means that the smallest type should be `int` or `unsigned int`.

[More details](https://stackoverflow.com/a/24372323/1708801).


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67227/new/

https://reviews.llvm.org/D67227





More information about the lldb-commits mailing list