[PATCH] D62805: [DebugInfo] Fix possible invalid dereference of non-engaged Optional.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 06:21:05 PDT 2019


courbet marked an inline comment as done.
courbet added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h:185
+   return AFI->OffsetInBits < BFI->OffsetInBits;
+  return AFI.hasValue() < BFI.hasValue();
 }
----------------
probinson wrote:
> courbet wrote:
> > probinson wrote:
> > > Can you point to a test where one or both values do not have a fragment?
> > I see that happening when there is a single value that does not have a fragment. My stdlib has:
> > 
> > `__glibcxx_requires_irreflexive(__first, __last);`
> > 
> > as a first statement in sort, which with `_GLIBCXX_DEBUG` expands to:
> > 
> > ```
> > _GLIBCXX_DEBUG_VERIFY(_First == _Last || !(*_First < *_First) ...
> > ```
> > 
> > The above calls `operator<`. I can reproduce with:
> > 
> > `./bin/llc < /usr/local/google/home/courbet/llvm/llvm-project/llvm/test/CodeGen/X86/fold-sext-trunc.ll -mtriple=x86_64--`
> > 
> Hmm is there a test that fails if you switch the condition to `AFI.hasValue() > BFI.hasValue()` ? I am just wondering about the sorting behavior in the absence of fragments.
No, nothing fails. I only saw this being triggered by the irreflexivity check I mentioned above, which works with both `<` and `>`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62805





More information about the llvm-commits mailing list