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

New 'PL_lc_numeric_mutex' warnings when building with clang

Thread Next
From:
James E Keenan
Date:
February 25, 2018 15:13
Subject:
New 'PL_lc_numeric_mutex' warnings when building with clang
Message ID:
e4da3242-7348-9159-676e-1d01335a7c51@pobox.com
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:

#####
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 Next


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