This line in btQuantizedBvh.h confuses me: int getTriangleIndex() const { btAssert(isLeafNode()); unsigned int x=0; unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS); // Get only the lower bits where the triangle index is stored return (m_escapeIndexOrTriangleIndex&~(y)); }
Ostensibly the error is that ~0 is -1 (unsigned) and shifting an unsigned is undefined or unspecified (forget which). But I'm actually confused why this code is written this way. x=0, then x&0 == 0, even if x wasn't 0. Only after that do we get to the undefined behavior. I guess I could puzzle through it, but somebody else might just know :-) On Tue, Apr 24, 2012 at 7:30 PM, Jason Wilkins <jason.a.wilk...@gmail.com> wrote: > I'm working through them and fixing what Clang did not catch. > > I was going to say the same thing as Nicholas, code analysis is such a > wide open field with virtually infinite number of things you can check > for, that having more than one tool is a good idea. > > On Tue, Apr 24, 2012 at 6:30 PM, Nicholas Bishop > <nicholasbis...@gmail.com> wrote: >> Not necessarily; different static analyzers can detect different types >> of potential problems. The PVS analysis contains some interesting >> things like the "Misprint in a homogeneous code block" section that I >> don't think clang's analyzer does. >> >> On Tue, Apr 24, 2012 at 7:20 PM, Tom M <letter...@gmail.com> wrote: >>> We have a page with generated CLang static analysis, >>> >>> http://clang.blenderheads.org/trunk/ >>> >>> It probably shows the same bugs as PVS-Studio does. >>> >>> LetterRip >>> >>> On Tue, Apr 24, 2012 at 4:15 PM, Nicholas Bishop >>> <nicholasbis...@gmail.com> wrote: >>>> I think some of these have been fixed already in recent commits from >>>> Campbell. >>>> >>>> On Tue, Apr 24, 2012 at 7:11 PM, Jason Wilkins >>>> <jason.a.wilk...@gmail.com> wrote: >>>>> http://www.viva64.com/en/b/0145/#ID0EO3BK >>>>> >>>>> It appears that Andrey Karpov has done an analysis of Blender source >>>>> code using his PVS-Studio tool. He did this just yesterday, so I >>>>> assume the problems he found are still in the source. He offers free >>>>> licenses to open source project members (3500 euro software otherwise, >>>>> wow). >>>>> >>>>> I was thinking of investigating the problems he found and seeing if I >>>>> could fix them. >>>>> _______________________________________________ >>>>> Bf-committers mailing list >>>>> Bf-committers@blender.org >>>>> http://lists.blender.org/mailman/listinfo/bf-committers >>>> _______________________________________________ >>>> Bf-committers mailing list >>>> Bf-committers@blender.org >>>> http://lists.blender.org/mailman/listinfo/bf-committers >>> _______________________________________________ >>> Bf-committers mailing list >>> Bf-committers@blender.org >>> http://lists.blender.org/mailman/listinfo/bf-committers >> _______________________________________________ >> Bf-committers mailing list >> Bf-committers@blender.org >> http://lists.blender.org/mailman/listinfo/bf-committers _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers