[lldb-dev] [Bug 36692] New: "frame variable" reports incorrect values for structs with float fields

via lldb-dev lldb-dev at lists.llvm.org
Mon Mar 12 05:32:25 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36692

            Bug ID: 36692
           Summary: "frame variable" reports incorrect values for structs
                    with float fields
           Product: lldb
           Version: 5.0
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: eldar.abusalimov at jetbrains.com
                CC: llvm-bugs at lists.llvm.org

The issue is originally reported as
https://youtrack.jetbrains.com/issue/CPP-12328 by Daniel Thompson.

Turns out, there's no minimal code snippet to illustrate the issue, but it can
be reproduced by checking out a certain revision:

1. Clone https://github.com/danielthompson/polytope.git
2. Checkout commit 55b5229da1da58234de1a2b939a1caf346ae57a9
3. Set a breakpoint on Transform.cpp line 148.
4. Compare output of console with what's displayed in the Variables window for
variable `r`.

The function in question
(https://github.com/danielthompson/polytope/blob/55b5229da1da58234de1a2b939a1caf346ae57a9/src/structures/Transform.cpp#L139-L150):
```
   Ray Transform::Apply(const Ray &ray) const {
      Point p = (*this).Apply(ray.Origin);
      Vector v = (*this).Apply(ray.Direction);

      Ray r(p, v);

      std::cout << "o.x: " << r.Origin.x << ", o.y: " << r.Origin.y << ", o.z:
" << r.Origin.z << std::endl;
      std::cout << "d.x: " << r.Direction.x << ", d.y: " << r.Direction.y << ",
d.z: " << r.Direction.z << std::endl;

      return r;  // <- BREAKPOINT HERE

   }
```

`frame variable` output:
```
(const Polytope::Transform *) this = 0x00007fb2aee0023c
(const Polytope::Ray &) ray = 0x00007ffee0e73b20: {
  Origin = (x = 0, y = 0, z = 0)
  Direction = (x = -0.490027964, y = 0.367136955, z = -0.790621936)
  DirectionInverse = (x = 0.490027964, y = -0.367136955, z = 0.790621936)
  MinT = +Inf
  MaxT = +Inf
}
(Polytope::Point) p = (x = 0, y = 0, z = 0)
(Polytope::Vector) v = (x = -0.490027964, y = 0.367136955, z = -0.790621936)
(Polytope::Ray) r = {
  Origin = (x = -1.33297964E+20, y =
0.0000000000000000000000000000000000000000459149455, z = -0.490027964) //
doesn't match cout
  Direction = (x = 0.367136955, y = -0.790621936, z =
0.0000000000000000000000000000000000000000459149455) // doesn't match cout
  DirectionInverse = (x = 0, y = 0, z = 0)
  MinT = 0.00000000000000000000000000000000000000000000140129846
  MaxT = -0.490027964
}
```

The values displayed x, y, and z fields of r.Origin and r.Direction do not
match what's printed by std::cout:
```
o.x: 0, o.y: 0, o.z: 0
d.x: -0.490028, d.y: 0.367137, d.z: -0.790622
```

Compiler:
```
[~] => c++ --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```

-- 
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/20180312/4f9f41ee/attachment.html>


More information about the lldb-dev mailing list