Skip Menu |
 

This queue is for tickets about the threads-shared CPAN distribution.

Report information
The Basics
Id: 119529
Status: resolved
Priority: 0/
Queue: threads-shared

People
Owner: jdhedden [...] cpan.org
Requestors: jkeenan [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.52
Fixed in: (no value)



Subject: shared.xs: warning generated when compiling with clang
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Message-ID: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 886
Download (untitled) / with headers
text/plain 886b
Jerry, I have set up VMs which I use mainly for smoke-testing Perl 5 blead on FreeBSD versions 10.3 and 11. When I do a smoke test run on FreeBSD 11, the compiler is Clang 3.8.0. In this build I get a number of compiler warnings, one of which is from threads-shared: ##### shared.xs:659:13: warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] ##### See, e.g., http://perl5.test-smoke.org/report/52709 More complete version of the warning: ##### Making header files for XS... shared.xs:659:13: warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] switch (pthread_cond_timedwait(cond, mut, &ts)) { ^ 1 warning generated. ##### threads-shared has $VERSION 1.52. Do you think this can be cleared up? Thank you very much. Jim Keenan
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1482933467-32724-2"
Message-ID: <rt-4.0.18-32724-1482933467-673.119529-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 399
Download (untitled) / with headers
text/plain 399b
On 2016-12-27 22:09:01, JKEENAN wrote: Show quoted text
> shared.xs:659:13: warning: calling function 'pthread_cond_timedwait' > requires holding mutex 'mut' exclusively [-Wthread-safety-analysis]
Jim, This warning can be ignored. The mutex in question comes in locked, and so the call to pthread_cond_timedwait is performed correctly. Would you please try the attached patch to see if it suppresses the warning?
MIME-Version: 1.0
Subject: shared_xs.patch
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/octet-stream; name="shared_xs.patch"
Content-Disposition: inline; filename="shared_xs.patch"
Content-Transfer-Encoding: base64
Content-Length: 633
Download shared_xs.patch
text/x-diff 633b
diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs index a019732..e5799ae 100644 --- a/dist/threads-shared/shared.xs +++ b/dist/threads-shared/shared.xs @@ -656,7 +656,13 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs) abs -= (NV)ts.tv_sec; ts.tv_nsec = (long)(abs * 1000000000.0); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wthread-safety-analysis" + switch (pthread_cond_timedwait(cond, mut, &ts)) { + +#pragma clang diagnostic pop + case 0: got_it = 1; break; case ETIMEDOUT: break; #ifdef OEMVS
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-32724-1482933467-673.119529-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org> <rt-4.0.18-32724-1482933467-673.119529-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1482934200-19661-2"
Message-ID: <rt-4.0.18-19661-1482934200-356.119529-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 255
Download (untitled) / with headers
text/plain 255b
On 2016-12-28 08:57:47, JDHEDDEN wrote: Show quoted text
> Would you please try the attached patch to see if it suppresses the > warning?
I found a similar clang suppression in threads.xs, and have adapted it to shared.xs. Please try the attached patch instead. Thanks.
MIME-Version: 1.0
Subject: shared_xs.patch
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/octet-stream; name="shared_xs.patch"
Content-Disposition: inline; filename="shared_xs.patch"
Content-Transfer-Encoding: base64
Content-Length: 755
Download shared_xs.patch
text/x-diff 755b
diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs index a019732..2f3dd91 100644 --- a/dist/threads-shared/shared.xs +++ b/dist/threads-shared/shared.xs @@ -656,7 +656,15 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs) abs -= (NV)ts.tv_sec; ts.tv_nsec = (long)(abs * 1000000000.0); + CLANG_DIAG_IGNORE(-Wthread-safety); + /* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */ + switch (pthread_cond_timedwait(cond, mut, &ts)) { + +#if defined(__clang__) || defined(__clang) +CLANG_DIAG_RESTORE; +#endif + case 0: got_it = 1; break; case ETIMEDOUT: break; #ifdef OEMVS
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-19661-1482934200-356.119529-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org> <rt-4.0.18-32724-1482933467-673.119529-0-0 [...] rt.cpan.org> <rt-4.0.18-19661-1482934200-356.119529-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-31185-1482948570-1611.119529-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 625
Download (untitled) / with headers
text/plain 625b
On Wed Dec 28 09:10:00 2016, JDHEDDEN wrote: Show quoted text
> On 2016-12-28 08:57:47, JDHEDDEN wrote:
> > Would you please try the attached patch to see if it suppresses the > > warning?
> > I found a similar clang suppression in threads.xs, and have adapted it > to shared.xs. Please try the attached patch instead. Thanks.
I took your 2nd patch and created this branch in core distro: smoke-me/jkeenan/cpan-119529-threads-shared Looks good so far on FreeBSD-11. See: http://perl5.test-smoke.org/report/52716 As a precaution, I'm smoking this branch with clang on linux. Will provide update later. Thank you very much. Jim Keenan
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-31185-1482948570-1611.119529-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org> <rt-4.0.18-32724-1482933467-673.119529-0-0 [...] rt.cpan.org> <rt-4.0.18-19661-1482934200-356.119529-0-0 [...] rt.cpan.org> <rt-4.0.18-31185-1482948570-1611.119529-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-13655-1482973107-1557.119529-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1040
On Wed Dec 28 13:09:30 2016, JKEENAN wrote: Show quoted text
> On Wed Dec 28 09:10:00 2016, JDHEDDEN wrote:
> > On 2016-12-28 08:57:47, JDHEDDEN wrote:
> > > Would you please try the attached patch to see if it suppresses the > > > warning?
> > > > I found a similar clang suppression in threads.xs, and have adapted > > it > > to shared.xs. Please try the attached patch instead. Thanks.
> > I took your 2nd patch and created this branch in core distro: > > smoke-me/jkeenan/cpan-119529-threads-shared > > Looks good so far on FreeBSD-11. See: http://perl5.test- > smoke.org/report/52716 > > As a precaution, I'm smoking this branch with clang on linux. Will > provide update later. > > Thank you very much. > Jim Keenan
We're good on Linux as well: http://perl5.test-smoke.org/report/52720 So, either you could issue a new CPAN release and then inform p5p of the new version's availability, or I could merge my branch into blead and let you pick it up from there. Let me know which works for you. Thanks for your speedy response. Jim Keenan
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-13655-1482973107-1557.119529-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-21554-1482894541-1958.0-0-0 [...] rt.cpan.org> <rt-4.0.18-32724-1482933467-673.119529-0-0 [...] rt.cpan.org> <rt-4.0.18-19661-1482934200-356.119529-0-0 [...] rt.cpan.org> <rt-4.0.18-31185-1482948570-1611.119529-0-0 [...] rt.cpan.org> <rt-4.0.18-13655-1482973107-1557.119529-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-29361-1483023680-1273.119529-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 352
Download (untitled) / with headers
text/plain 352b
On 2016-12-28 19:58:27, JKEENAN wrote: Show quoted text
> So, either you could issue a new CPAN release and then inform p5p of > the new version's availability, or I could merge my branch into blead > and let you pick it up from there.
Merge to blead, let me know when it's in (directly; not via this ticket which I am closing), and I will pick up from there. Thanks.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.