[lldb-dev] [Bug 33459] New: p static_cast<int16_t>(...) has inconsistent output

via lldb-dev lldb-dev at lists.llvm.org
Wed Jun 14 09:07:24 PDT 2017


            Bug ID: 33459
           Summary: p static_cast<int16_t>(...) has inconsistent output
           Product: lldb
           Version: 3.9
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: vince at nethacker.com
                CC: llvm-bugs at lists.llvm.org

(lldb) version
lldb version 3.9.0 ( revision )

(lldb) p r_sigma_float
(const float) $11 = 0.0500000007


(lldb) p (1.0f / (2 * r_sigma_float * r_sigma_float)) * (1<<kQ)
(float) $3 = 51199.9961


(lldb) p static_cast<int16_t>(51199.99f)
(int16_t) $1 = 32767

Technically, this is undefined but the output here matches what g++ does so I
think it's good.  Clang current returns inconsistent results.  Ideally, it
would be nice for lldb to print (undefined) or be consistent with whatever
compiler you are using.  I'm hoping to get clang's behavior changed:

(lldb) p static_cast<int16_t>((1.0f / (2 * r_sigma_float * r_sigma_float)) *
(int16_t) $2 = -14337

Again this is undefined but it is inconsistent with the previous behavior so I
would call it a bug.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170614/2202cbed/attachment.html>

More information about the lldb-dev mailing list