[PATCH] D142026: Optimize OptTable::findNearest implementation and usage

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 13:20:31 PST 2023


nikic added a comment.

FYI I just noticed some i686 failures that look something like this:

  /builddir/build/BUILD/llvm-16.0.0.src/redhat-linux-build/unittests/Option/./OptionTests --gtest_filter=OptTableTest/0.FindNearest
  --
  /builddir/build/BUILD/llvm-16.0.0.src/unittests/Option/OptionParsingTest.cpp:314: Failure
  Expected equality of these values:
    1U
      Which is: 1
    T.findNearest("-blorb", Nearest)
      Which is: 4294967295
  /builddir/build/BUILD/llvm-16.0.0.src/unittests/Option/OptionParsingTest.cpp:315: Failure
  Expected equality of these values:
    Nearest
      Which is: ""
    "-blorp"

Plausibly caused by this change -- I'm thinking that `MaximumDistance` is initialized to `UINT_MAX - 1`, but then we cast that to a signed integer and compare that, so it wraps to a large negative number.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142026/new/

https://reviews.llvm.org/D142026



More information about the llvm-commits mailing list