Hello, I'm using valgrind built from SVN, r16025. I encountered helgrind complaining about invalid argument used with pthread_rwlock_destroy, for variable initialized with PTHREAD_RWLOCK_INITIALIZER. Is this a known thing? Am I doing something wrong? I searched the mailing list archives on https://sourceforge.net/p/valgrind/mailman/valgrind-users/, but couldn't find anything. I'm asking because I think pthreads allows me to destroy rwlock initialized that way.
I reproduced this with minimal test case on Ubuntu 14.04: $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty $ cat pthread_rwlock_destroy.c # define _POSIX_C_SOURCE 20161006L #include <assert.h> #include <pthread.h> int main(void) { pthread_rwlock_t l = PTHREAD_RWLOCK_INITIALIZER; assert(0 == pthread_rwlock_destroy(&l)); return 0; } $ gcc -Wall -Wextra -std=c99 -pedantic -O0 -ggdb pthread_rwlock_destroy.c -pthread $ valgrind --tool=helgrind ./a.out ==4199== Helgrind, a thread error detector ==4199== Copyright (C) 2007-2015, and GNU GPL'd, by OpenWorks LLP et al. ==4199== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info ==4199== Command: ./a.out ==4199== ==4199== ---Thread-Announcement------------------------------------------ ==4199== ==4199== Thread #1 is the program's root thread ==4199== ==4199== ---------------------------------------------------------------- ==4199== ==4199== Thread #1: pthread_rwlock_destroy with invalid argument ==4199== at 0x4C302D6: pthread_rwlock_destroy_WRK (hg_intercepts.c:2096) ==4199== by 0x4C33018: pthread_rwlock_destroy (hg_intercepts.c:2113) ==4199== by 0x400707: main (pthread_rwlock_destroy.c:9) ==4199== ==4199== ==4199== For counts of detected and suppressed errors, rerun with: -v ==4199== Use --history-level=approx or =none to gain increased speed, at ==4199== the cost of reduced accuracy of conflicting-access information ==4199== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Regards, Mateusz ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users