]> granicus.if.org Git - llvm/commit
[DWARF] Fix bad comparator in sortGlobalExprs.
authorEli Friedman <efriedma@codeaurora.org>
Thu, 12 Oct 2017 20:54:08 +0000 (20:54 +0000)
committerEli Friedman <efriedma@codeaurora.org>
Thu, 12 Oct 2017 20:54:08 +0000 (20:54 +0000)
commit4d6b50c6a7ce75e1a7e888856b5ec1cc77feafd7
tree4071620b2f801d1856a53e71bf72560bda8a3a37
parentf392c19b4461cc41fca1dbb70ce976bd1e9465b9
[DWARF] Fix bad comparator in sortGlobalExprs.

The comparator passed to std::sort must provide a strict weak ordering;
otherwise, the behavior is undefined.

Fixes an assertion failure generating debug info for globals
split by GlobalOpt. I have a testcase, but not sure how to reduce it,
so not included here.  (Someone else came up with a testcase, but I
can't reproduce the crash with it, presumably because my version of LLVM
ends up sorting the array differently.)

This isn't really a complete fix (see the FIXME in the patch), but at
least it doesn't have undefined behavior.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315619 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfDebug.cpp