[all-commits] [llvm/llvm-project] 37aaff: [Thread Analysis] Fix a bug in context update in a...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri Feb 13 11:46:06 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 37aaff3fef7f0344299ddbf7b19a53c25e7ca951
      https://github.com/llvm/llvm-project/commit/37aaff3fef7f0344299ddbf7b19a53c25e7ca951
  Author: Ziqing Luo <ziqing_luo at apple.com>
  Date:   2026-02-13 (Fri, 13 Feb 2026)

  Changed paths:
    M clang/lib/Analysis/ThreadSafety.cpp
    M clang/test/SemaCXX/warn-thread-safety-analysis.cpp

  Log Message:
  -----------
  [Thread Analysis] Fix a bug in context update in alias-analysis (#178952)

[Thread Analysis] Fix a bug in context update in alias-analysis
    
Previously, in 'updateLocalVarMapCtx', context was updated to the one
immediately after the provided statement 'S'.  It is incorrect,
because 'S' hasn't been processed at that point.  This issue could
result in false positives.  For example,
    
```
    void f(Lock_t* F)
    {
        Lock_t* L = F; // 'L' aliases with 'F'
        L->Lock();     // 'L' holds the lock
        // Before the fix, the analyzer saw the definition of 'L' being cleared before 'L' was unlocked.
        unlock(&L);    // unlock (*L)
    }
```
This commit fixes the issue.
    
rdar://169236809



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list