[PATCH] D76099: [Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler crash

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 14:39:15 PDT 2020


aganea created this revision.
aganea added reviewers: rnk, hans, hubert.reinterpretcast, daltenty.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.

As reported here: https://reviews.llvm.org/D69825#1916865 and in PR45164, in case of a compiler crash, Clang now reports a second crash related to TimerGroups. The crash is caused by the TimerGroup's internal linked list which still points to already freed stack frames, which were unwind by `longjmp()` (or SEH on Windows) after the first compiler crash.

There's a second crash, not seen in PR45164, which happens when `llvm_shutdown` is called: the static `DefaultTimerGroup` object is destroyed which causes more iterating through the TimerGroups.

With this patch, we now 'steal' the `TimeGroup` instance from `DefaultTimerGroup` and prevent any further iteration of the timers after the initial crash.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76099

Files:
  clang/lib/Lex/Pragma.cpp
  clang/tools/driver/driver.cpp
  llvm/include/llvm/Support/ManagedStatic.h
  llvm/include/llvm/Support/Timer.h
  llvm/lib/Support/Timer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76099.250050.patch
Type: text/x-patch
Size: 4598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200312/a0a2fe05/attachment.bin>


More information about the llvm-commits mailing list