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



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to