develooper Front page | perl.perl5.porters | Postings from February 2018

Re: New 'PL_lc_numeric_mutex' warnings when building with clang

Thread Previous | Thread Next
From:
Karl Williamson
Date:
February 25, 2018 17:14
Subject:
Re: New 'PL_lc_numeric_mutex' warnings when building with clang
Message ID:
592293a4-50cc-bf1e-cafb-7069f227fc67@khwilliamson.com
On 02/25/2018 08:12 AM, James E Keenan wrote:
> When building perl as I typically do on FreeBSD-11.0 (clang, threaded), 
> I have begun to experience a large number of 'make' warnings not 
> previously seen.  Gzipped build log attached, but here is a taste:

I had seen these and researched them, but in order to meet the deadline, 
I committed anyway, as they are harmless.  I'm sorry that I didn't 
communicate this issue, so that you spent time on it.  We need to find a 
way to silence these warnings, and I presume that there is.  I looked 
them up, and in some documentation about it somewhere, it admits that 
this is bogus; that their analysis routine that's generating these 
doesn't get this situation right.

> 
> #####
> dump.c:497:9: warning: mutex 'PL_lc_numeric_mutex' is not held on every 
> path through here [-Wthread-safety-analysis]
>          STORE_LC_NUMERIC_SET_STANDARD();
>          ^
> ./perl.h:5950:13: note: expanded from macro 'STORE_LC_NUMERIC_SET_STANDARD'
>              LC_NUMERIC_LOCK(_NOT_IN_NUMERIC_STANDARD);     \
>              ^
> ./perl.h:5593:9: note: expanded from macro 'LC_NUMERIC_LOCK'
>          STMT_START {     \
>          ^
> ./perl.h:530:29: note: expanded from macro 'STMT_START'
> #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
>                                ^
> dump.c:497:9: note: mutex acquired here
> ./perl.h:5950:13: note: expanded from macro 'STORE_LC_NUMERIC_SET_STANDARD'
>              LC_NUMERIC_LOCK(_NOT_IN_NUMERIC_STANDARD);     \
>              ^
> ./perl.h:5595:17: note: expanded from macro 'LC_NUMERIC_LOCK'
>                  MUTEX_LOCK(&PL_lc_numeric_mutex);     \
>                  ^
> ./thread.h:216:14: note: expanded from macro 'MUTEX_LOCK'
>          if ((_eC_ = perl_pthread_mutex_lock((m))))                      \
>                      ^
> ./thread.h:206:40: note: expanded from macro 'perl_pthread_mutex_lock'
> #    define perl_pthread_mutex_lock(m) perl_tsa_mutex_lock(m)
>                                         ^
> dump.c:499:9: warning: releasing mutex 'PL_lc_numeric_mutex' that was 
> not held [-Wthread-safety-analysis]
>          RESTORE_LC_NUMERIC();
>          ^
> ./perl.h:5923:13: note: expanded from macro 'RESTORE_LC_NUMERIC'
>              LC_NUMERIC_UNLOCK;     \
>              ^
> ./perl.h:5617:17: note: expanded from macro 'LC_NUMERIC_UNLOCK'
>                  MUTEX_UNLOCK(&PL_lc_numeric_mutex);     \
>                  ^
> ./thread.h:224:14: note: expanded from macro 'MUTEX_UNLOCK'
>          if ((_eC_ = perl_pthread_mutex_unlock((m))))                    \
>                      ^
> ./thread.h:207:42: note: expanded from macro 'perl_pthread_mutex_unlock'
> #    define perl_pthread_mutex_unlock(m) perl_tsa_mutex_unlock(m)
>                                           ^
> #####
> 
> The first smoke test where I logged these warnings was at this commit:
> 
> #####
> $ gitshowf 2a05854a1ad5472d00de22f8fcc284cdc8fd1503
> commit 2a05854a1ad5472d00de22f8fcc284cdc8fd1503
> Merge: 6de18f4 957ac25
> Author:     Father Chrysostomos <sprout@cpan.org>
> AuthorDate: Sun Feb 18 16:41:09 2018 -0800
> Commit:     Father Chrysostomos <sprout@cpan.org>
> CommitDate: Sun Feb 18 16:41:09 2018 -0800
> 
>      [Merge] ‘Nonelem’ scalars
> 
> #####
> 
> However, based on 'git blame perl.h', I suspect that the warnings were 
> first introduced here:
> 
> #####
> commit 49d7d366441813aa7301b1a437e302372f04f31a
> Author:     Karl Williamson <khw@cpan.org>
> AuthorDate: Tue Feb 13 13:12:50 2018 -0700
> Commit:     Karl Williamson <khw@cpan.org>
> CommitDate: Sun Feb 18 15:44:23 2018 -0700
> 
>      Latch LC_NUMERIC during critical sections
> #####
> 
> Karl, can you take a look?
> 
> Thank you very much.
> Jim Keenan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About