ziqingluo-90 wrote:

> The build failure on linux is relevant:
> 
> ```
>  In file included from 
> /home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp:11:
>   In file included from 
> /home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/scudo/standalone/allocator_config.h:16:
>   
> /home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/scudo/standalone/primary32.h:306:33:
>  error: reading variable 'FreeListInfo' requires holding mutex 
> 'getSizeClassInfo(I).Mutex' [-Werror,-Wthread-safety-precise]
>     306 |     for (BatchGroupT &BG : Sci->FreeListInfo.BlockList) {
> ```
> 
> Again, it is a bug that was hided by the bug this PR is fixing. A small 
> reproducer will be like this:
> 
> ```
> void testEscapeInvalidationHappensRightAfterTheCtorCall(Foo* F) {
>   Foo* L = F;
>   MutexLock ScopeLock(&L->mu);
> 
>   struct {
>     int DataMember GUARDED_BY(F->mu);
>   } Data;
> 
>   Data.DataMember = 0;
> }
> ```
> 
> The fix will be that we need also call `updateLocalVarMapCtx(nullptr);` in 
> `VisitCXXConstructExpr`.

I realized that if we do this way, there are too many places need to call 
`updateLocalVarMapCtx(nullptr)`, which is not good.  I then realized that the 
fix can be simpler and better:  just call `updateLocalVarMapCtx(S)` after the 
visit of `S`.  
@melver @aaronpuchert  please take another look.

https://github.com/llvm/llvm-project/pull/178952
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to