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

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 06:15:24 PDT 2019


probinson added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h:185
+   return AFI->OffsetInBits < BFI->OffsetInBits;
+  return AFI.hasValue() < BFI.hasValue();
 }
----------------
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.


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