From 4dcfc05c20b508d8418309af61c403a6381e8a08 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 26 Dec 2022 09:04:17 +0100 Subject: [PATCH] Fixes related to Bug 392331 1. Added C++17 check to configure.ac 2. Needed Linux version of suppression 3. Added a filter for pthread_cond_signal --- configure.ac | 20 +++++++++++++++++++ helgrind/tests/Makefile.am | 4 +++- helgrind/tests/bug392331.supp | 20 ++++++++++++++++++- helgrind/tests/bug392331.vgtest | 1 + helgrind/tests/bug392331_supp.vgtest | 1 + helgrind/tests/filter_stderr.in | 3 +++ helgrind/tests/tc20_verifywrap.stderr.exp | 2 +- .../tc20_verifywrap.stderr.exp-glibc-2.18 | 2 +- .../tc20_verifywrap.stderr.exp-glibc-2.21 | 2 +- .../tests/tc20_verifywrap.stderr.exp-mips32 | 2 +- .../tests/tc20_verifywrap.stderr.exp-mips32-b | 2 +- .../tests/tc20_verifywrap.stderr.exp-s390x | 2 +- .../tests/tc20_verifywrap.stderr.exp-solaris | 2 +- 13 files changed, 54 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 5ae9377119..467c98e023 100755 --- a/configure.ac +++ b/configure.ac @@ -2009,6 +2009,26 @@ AC_MSG_RESULT([no]) # clang 3.3 cannot process from e.g. # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 +AC_MSG_CHECKING([that C++ compiler can compile C++17 code]) +AC_LANG(C++) +safe_CXXFLAGS=$CXXFLAGS +CXXFLAGS=-std=c++17 + +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +int x; +])], +[ +ac_have_cxx_17=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_cxx_17=no +AC_MSG_RESULT([no]) +]) +CXXFLAGS=$safe_CXXFLAGS +AC_LANG(C) + +AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes) + AC_MSG_CHECKING([that C++ compiler can include header file]) AC_LANG(C++) safe_CXXFLAGS=$CXXFLAGS diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 926a367c7e..2286e220f1 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -142,7 +142,6 @@ noinst_HEADERS = safe-pthread.h safe-semaphore.h # should be conditionally compiled like tc20_verifywrap is. check_PROGRAMS = \ annotate_hbefore \ - bug392331 \ cond_init_destroy \ cond_timedwait_invalid \ cond_timedwait_test \ @@ -242,6 +241,9 @@ annotate_hbefore_CFLAGS = $(AM_CFLAGS) endif bug322621_SOURCES = bug322621.cpp +if HAVE_CXX17 +check_PROGRAMS += bug392331 bug392331_SOURCES = bug392331.cpp bug392331_CXXFLAGS = $(AM_CXXFLAGS) -std=c++17 +endif diff --git a/helgrind/tests/bug392331.supp b/helgrind/tests/bug392331.supp index 8262d142e1..6b8c5e1174 100644 --- a/helgrind/tests/bug392331.supp +++ b/helgrind/tests/bug392331.supp @@ -1,7 +1,25 @@ { - Check that Dubious suppression works + Check that Dubious suppression works FreeBSD Helgrind:Dubious fun:pthread_cond_signal_WRK fun:pthread_cond_signal fun:_ZNSt3__118condition_variable10notify_oneEv } +{ + Check that Dubious suppression works Linux standalone + Helgrind:Dubious + fun:pthread_cond_signal_WRK + fun:pthread_cond_signal@* + fun:__gthread_cond_signal + fun:UnknownInlinedFun + fun:_ZNSt18condition_variable10notify_oneEv +} +# for some very strange reason the suppression is different +# when running under regtest +{ + Check that Dubious suppression works Linux regtest + Helgrind:Dubious + fun:pthread_cond_signal_WRK + fun:pthread_cond_signal@* + fun:_ZNSt18condition_variable10notify_oneEv +} diff --git a/helgrind/tests/bug392331.vgtest b/helgrind/tests/bug392331.vgtest index 6c4aff6bf1..c160dcd40e 100644 --- a/helgrind/tests/bug392331.vgtest +++ b/helgrind/tests/bug392331.vgtest @@ -1,2 +1,3 @@ +prereq: test -e bug392331 vgopts: -q prog: bug392331 diff --git a/helgrind/tests/bug392331_supp.vgtest b/helgrind/tests/bug392331_supp.vgtest index 611b4ca814..64fc729607 100644 --- a/helgrind/tests/bug392331_supp.vgtest +++ b/helgrind/tests/bug392331_supp.vgtest @@ -1,2 +1,3 @@ +prereq: test -e bug392331 vgopts: -q --suppressions=bug392331.supp prog: bug392331 diff --git a/helgrind/tests/filter_stderr.in b/helgrind/tests/filter_stderr.in index 9953b6527f..e7fecf5916 100755 --- a/helgrind/tests/filter_stderr.in +++ b/helgrind/tests/filter_stderr.in @@ -60,6 +60,9 @@ $SED \ # Some arches return ENOSYS instead of EINVAL for undefined futex operations. $SED -e "s/with error code 38 (ENOSYS: Function not implemented)/with error code 22 (EINVAL: Invalid argument)/" | +# filter differences in pthread_cond_signal +$SED -e "s/pthread_cond_signal@\*/pthread_cond_signal/" | + $dir/../../helgrind/tests/filter_helgrind "$@" exit 0 diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp b/helgrind/tests/tc20_verifywrap.stderr.exp index 372daeab76..e5e128d837 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp +++ b/helgrind/tests/tc20_verifywrap.stderr.exp @@ -124,7 +124,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.18 b/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.18 index b823d4000c..8b691ab838 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.18 +++ b/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.18 @@ -116,7 +116,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.21 b/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.21 index 2a2ee9b5d2..cef930f2ad 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.21 +++ b/helgrind/tests/tc20_verifywrap.stderr.exp-glibc-2.21 @@ -124,7 +124,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp-mips32 b/helgrind/tests/tc20_verifywrap.stderr.exp-mips32 index be73900790..7aecc1df2d 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp-mips32 +++ b/helgrind/tests/tc20_verifywrap.stderr.exp-mips32 @@ -124,7 +124,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp-mips32-b b/helgrind/tests/tc20_verifywrap.stderr.exp-mips32-b index d3f17d1506..d5bb6f83d8 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp-mips32-b +++ b/helgrind/tests/tc20_verifywrap.stderr.exp-mips32-b @@ -124,7 +124,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp-s390x b/helgrind/tests/tc20_verifywrap.stderr.exp-s390x index f19215efb5..7737447ba4 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp-s390x +++ b/helgrind/tests/tc20_verifywrap.stderr.exp-s390x @@ -126,7 +126,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp-solaris b/helgrind/tests/tc20_verifywrap.stderr.exp-solaris index 891b504908..64edaaca2f 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp-solaris +++ b/helgrind/tests/tc20_verifywrap.stderr.exp-solaris @@ -116,7 +116,7 @@ Thread #x's call to pthread_cond_wait failed Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) - by 0x........: pthread_cond_signal@* (hg_intercepts.c:...) + by 0x........: pthread_cond_signal (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:167) -- 2.47.2