Issue 174867
Summary [LLDB] ValueObject::Cast does not correctly handle casts to Reference types.
Labels new issue
Assignees
Reporter cmtice
    If I have a plain integer variable, declared "int a;", if I try to use DIL to cast it to an 'int&', I get an error (from ValueObject::Cast) complaining that I'm trying to cast to a type that's larger than the original type (the original type was a 4-byte int, and the new type is an 8-byte address).

However, if I try to cast arr_1d, which is an array of 4 ints to an 'int &', it passes the size test (an array of 4 ints is 16 bytes long), but the casting code then ends up reading the first two bytes of the array and treating that as the address, rather than getting the actual address of the array. (Note the first value in the array is 1, and the second value in the array is 2. Adjusting for endianness, we end up with the "address" 0x0000000200000001 , which is completely wrong.  but which LLDB then tries to read from, resulting in a read error.

(See conversation/discussion in PR/170332 for more context.)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to