[all-commits] [llvm/llvm-project] a0ccba: [llvm] Fix some test failures with EXPENSIVE_CHECK...

David Spickett via All-commits all-commits at lists.llvm.org
Thu Jul 28 01:53:50 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0ccba5e192b14341b66ad57bc646a3af7418409
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h

  Log Message:
  [llvm] Fix some test failures with EXPENSIVE_CHECKS and libstdc++

DebugLocEntry assumes that it either contains 1 item that has no fragment
or many items that all have fragments (see the assert in addValues).

When EXPENSIVE_CHECKS is enabled, _GLIBCXX_DEBUG is defined. On a few machines
I've checked, this causes std::sort to call the comparator even
if there is only 1 item to sort. Perhaps to check that it is implemented
properly ordering wise, I didn't find out exactly why.

operator< for a DbgValueLoc will crash if this happens because the
optional Fragment is empty.

Compiler/linker/optimisation level seems to make this happen
or not. So I've seen this happen on x86 Ubuntu but the buildbot
for release EXPENSIVE_CHECKS did not have this issue.

Add an explicit check whether we have 1 item.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D130156

More information about the All-commits mailing list