[PATCH] D84715: [FIX] Add check for empty body function

Wei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 17:15:41 PDT 2020


weiwang added a comment.

To reproduce:

1. create test file main.cpp

  int bar() {
    return 2;
  }
  
  int foo() {
    return 1;
  }
  
  int main() {
    foo();
    return 0;
  }

2. compile with clang: clang `-fuse-ld=lld -O3 -flto=full -Wl,--opt-remarks-with-hotness -o test main.cpp`

If clang has assertion enabled, it would hit the following assertion at `ilist_iterator.h:138`:

  Assertion `!NodePtr->isKnownSentinel()' failed

otherwise, the behavior is undefined.

The issue exists in both monoLTO and thinLTO. It is triggered at the point where ORE is created to emit dead functions LTO.cpp:801 <https://github.com/llvm/llvm-project/blob/master/llvm/lib/LTO/LTO.cpp#L801>.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84715





More information about the llvm-commits mailing list