[PATCH] D142317: [Support][LLD] Avoid using uninitialized threadIndex.

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 06:42:15 PST 2023


andrewng added a comment.

Perhaps I'm missing something here, but I thought that `thread_local` variables are zero initialized. Therefore, the `threadIndex` for the main thread should already be `0`. However, what is definitely of concern is that `parallelFor` could create contention between the main thread and thread pool thread "0" because they share the index `0`. I definitely missed this in the original review that introduced this change. I spotted the potential for the issue within LLD itself but completely forgot that the parallel support code also makes use of the main thread!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142317



More information about the llvm-commits mailing list