Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some potential issues reported by clang-16.0.0rc1 (with memorysanitizer) #1948

Open
bjodah opened this issue Jan 31, 2023 · 0 comments
Open

Comments

@bjodah
Copy link
Contributor

bjodah commented Jan 31, 2023

Since these are reported by a release candidate of clang it might not really be a problem, but I'm putting the backtrace here:

Output from ctest
+ cd /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99-msan
+ ctest --output-on-failure
Test project /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99-msan
      Start  1: test_rcp
 1/59 Test  #1: test_rcp .........................   Passed    0.02 sec
      Start  2: test_basic
 2/59 Test  #2: test_basic .......................   Passed    0.05 sec
      Start  3: test_arit
 3/59 Test  #3: test_arit ........................   Passed    0.17 sec
      Start  4: test_poly
 4/59 Test  #4: test_poly ........................   Passed    0.02 sec
      Start  5: test_series
 5/59 Test  #5: test_series ......................   Passed    0.02 sec
      Start  6: test_series_generic
 6/59 Test  #6: test_series_generic ..............   Passed    0.69 sec
      Start  7: test_functions
 7/59 Test  #7: test_functions ...................   Passed    0.21 sec
      Start  8: test_subs
 8/59 Test  #8: test_subs ........................   Passed    0.03 sec
      Start  9: test_integer
 9/59 Test  #9: test_integer .....................   Passed    0.02 sec
      Start 10: test_rational
10/59 Test #10: test_rational ....................   Passed    0.02 sec
      Start 11: test_relationals
11/59 Test #11: test_relationals .................   Passed    0.03 sec
      Start 12: test_number
12/59 Test #12: test_number ......................   Passed    0.02 sec
      Start 13: test_as_numer_denom
13/59 Test #13: test_as_numer_denom ..............   Passed    0.03 sec
      Start 14: test_parser
14/59 Test #14: test_parser ......................   Passed    0.21 sec
      Start 15: test_serialize-cereal
15/59 Test #15: test_serialize-cereal ............   Passed    0.02 sec
      Start 16: test_sbml_parser
16/59 Test #16: test_sbml_parser .................   Passed    0.20 sec
      Start 17: test_sets
17/59 Test #17: test_sets ........................   Passed    0.09 sec
      Start 18: test_fields
18/59 Test #18: test_fields ......................   Passed    0.57 sec
      Start 19: test_infinity
19/59 Test #19: test_infinity ....................   Passed    0.04 sec
      Start 20: test_nan
20/59 Test #20: test_nan .........................   Passed    0.02 sec
      Start 21: test_solve
21/59 Test #21: test_solve .......................   Passed    0.24 sec
      Start 22: test_as_real_imag
22/59 Test #22: test_as_real_imag ................   Passed    0.06 sec
      Start 23: test_integer_class
23/59 Test #23: test_integer_class ...............   Passed    0.03 sec
      Start 24: test_cse
24/59 Test #24: test_cse .........................   Passed    0.04 sec
      Start 25: test_count_ops
25/59 Test #25: test_count_ops ...................   Passed    0.02 sec
      Start 26: test_test_visitors
26/59 Test #26: test_test_visitors ...............   Passed    0.04 sec
      Start 27: test_assumptions
27/59 Test #27: test_assumptions .................   Passed    0.02 sec
      Start 28: test_refine
28/59 Test #28: test_refine ......................   Passed    0.03 sec
      Start 29: test_simplify
29/59 Test #29: test_simplify ....................   Passed    0.02 sec
      Start 30: test_tuple
30/59 Test #30: test_tuple .......................   Passed    0.02 sec
      Start 31: test_tribool
31/59 Test #31: test_tribool .....................   Passed    0.02 sec
      Start 32: test_ntheory
32/59 Test #32: test_ntheory .....................   Passed    0.07 sec
      Start 33: test_diophantine
33/59 Test #33: test_diophantine .................   Passed    0.03 sec
      Start 34: test_ntheory_funcs
34/59 Test #34: test_ntheory_funcs ...............   Passed    0.06 sec
      Start 35: test_matrix
35/59 Test #35: test_matrix ......................   Passed    0.15 sec
      Start 36: test_printing
36/59 Test #36: test_printing ....................   Passed    0.08 sec
      Start 37: test_ccode
37/59 Test #37: test_ccode .......................   Passed    0.03 sec
      Start 38: test_uintpoly
38/59 Test #38: test_uintpoly ....................   Passed    0.03 sec
      Start 39: test_uratpoly
39/59 Test #39: test_uratpoly ....................   Passed    0.03 sec
      Start 40: test_mintpoly
40/59 Test #40: test_mintpoly ....................   Passed    0.04 sec
      Start 41: test_uexprpoly
41/59 Test #41: test_uexprpoly ...................   Passed    0.05 sec
      Start 42: test_mexprpoly
42/59 Test #42: test_mexprpoly ...................   Passed    0.06 sec
      Start 43: test_basic_conversions
43/59 Test #43: test_basic_conversions ...........   Passed    0.08 sec
      Start 44: test_evalf
44/59 Test #44: test_evalf .......................   Passed    0.02 sec
      Start 45: test_eval_double
45/59 Test #45: test_eval_double .................   Passed    0.06 sec
      Start 46: test_lambda_double
46/59 Test #46: test_lambda_double ...............   Passed    0.04 sec
      Start 47: test_cwrapper
47/59 Test #47: test_cwrapper ....................***Failed    0.15 sec
==899==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f4ad07a0e7b in std::__1::__function::__func::bvisit(SymEngine::Symbol const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Symbol const&)::'lambda'(double const*)>, double (double const*)>::operator()(double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:356:5
    #1 0x7f4ad07a70a1 in std::__1::__function::__value_func::operator()[abi:v160000](double const*&&) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:510:16
    #2 0x7f4ad07a70a1 in std::__1::function::operator()(double const*) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:1156:12
    #3 0x7f4ad07a70a1 in SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)::operator()(double const*) const /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/lambda_double.h:163:53
    #4 0x7f4ad07a70a1 in decltype(std::declval::bvisit(SymEngine::Add const&)::'lambda'(double const*)&>()(std::declval())) std::__1::__invoke[abi:v160000]::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*>(SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/invoke.h:394:23
    #5 0x7f4ad07a70a1 in double std::__1::__invoke_void_return_wrapper::__call::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*>(SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/invoke.h:478:16
    #6 0x7f4ad07a70a1 in std::__1::__function::__alloc_func::bvisit(SymEngine::Add const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Add const&)::'lambda'(double const*)>, double (double const*)>::operator()[abi:v160000](double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:185:16    #7 0x7f4ad07a70a1 in std::__1::__function::__func::bvisit(SymEngine::Add const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Add const&)::'lambda'(double const*)>, double (double const*)>::operator()(double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:356:12
    #8 0x7f4ad07a7001 in std::__1::__function::__value_func::operator()[abi:v160000](double const*&&) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:510:16
    #9 0x7f4ad07a7001 in std::__1::function::operator()(double const*) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:1156:12
    #10 0x7f4ad07a7001 in SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)::operator()(double const*) const /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/lambda_double.h:163:44
    #11 0x7f4ad07a7001 in decltype(std::declval::bvisit(SymEngine::Add const&)::'lambda'(double const*)&>()(std::declval())) std::__1::__invoke[abi:v160000]::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*>(SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/invoke.h:394:23
    #12 0x7f4ad07a7001 in double std::__1::__invoke_void_return_wrapper::__call::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*>(SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/invoke.h:478:16
    #13 0x7f4ad07a7001 in std::__1::__function::__alloc_func::bvisit(SymEngine::Add const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Add const&)::'lambda'(double const*)>, double (double const*)>::operator()[abi:v160000](double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:185:16
    #14 0x7f4ad07a7001 in std::__1::__function::__func::bvisit(SymEngine::Add const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Add const&)::'lambda'(double const*)>, double (double const*)>::operator()(double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:356:12
    #15 0x7f4ad07a7001 in std::__1::__function::__value_func::operator()[abi:v160000](double const*&&) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:510:16
    #16 0x7f4ad07a7001 in std::__1::function::operator()(double const*) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:1156:12
    #17 0x7f4ad07a7001 in SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)::operator()(double const*) const /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/lambda_double.h:163:44
    #18 0x7f4ad07a7001 in decltype(std::declval::bvisit(SymEngine::Add const&)::'lambda'(double const*)&>()(std::declval())) std::__1::__invoke[abi:v160000]::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*>(SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/invoke.h:394:23
    #19 0x7f4ad07a7001 in double std::__1::__invoke_void_return_wrapper::__call::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*>(SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Add const&)::'lambda'(double const*)&, double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/invoke.h:478:16
    #20 0x7f4ad07a7001 in std::__1::__function::__alloc_func::bvisit(SymEngine::Add const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Add const&)::'lambda'(double const*)>, double (double const*)>::operator()[abi:v160000](double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:185:16
    #21 0x7f4ad07a7001 in std::__1::__function::__func::bvisit(SymEngine::Add const&)::'lambda'(double const*), std::__1::allocator::bvisit(SymEngine::Add const&)::'lambda'(double const*)>, double (double const*)>::operator()(double const*&&) /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:356:12
    #22 0x7f4ad07910ac in std::__1::__function::__value_func::operator()[abi:v160000](double const*&&) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:510:16
    #23 0x7f4ad07910ac in std::__1::function::operator()(double const*) const /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:1156:12
    #24 0x7f4ad07910ac in SymEngine::LambdaDoubleVisitor::call(double*, double const*) /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/lambda_double.h:107:23
    #25 0x7f4ad07870c8 in lambda_real_double_visitor_call /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/cwrapper.cpp:1848:13
    #26 0x55ecd38bdbd6 in test_lambda_double /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/tests/cwrapper/test_cwrapper.c:2163:9
    #27 0x55ecd38beb17 in main /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/tests/cwrapper/test_cwrapper.c:2400:5
    #28 0x7f4ad0167189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #29 0x7f4ad0167244 in __libc_start_main csu/../csu/libc-start.c:381:3
    #30 0x55ecd3827140 in _start (/src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99-msan/symengine/tests/cwrapper/test_cwrapper+0x24140)

Member fields were destroyed
#0 0x55ecd38a09ce in __sanitizer_dtor_callback_fields /build/llvm-project-llvmorg-16.0.0-rc1/compiler-rt/lib/msan/msan_interceptors.cpp:961:5
#1 0x7f4ad07548c6 in SymEngine::RCP<SymEngine::Basic const>::~RCP() /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/symengine_rcp.h:207:8
#2 0x7f4ad07548c6 in SymEngine::RCP<SymEngine::Basic const>::~RCP() /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/symengine_rcp.h:144:5
#3 0x7f4ad07548c6 in basic_free_stack /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/cwrapper.cpp:130:10
#4 0x55ecd38bbb0c in test_eval /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/tests/cwrapper/test_cwrapper.c:1703:5
#5 0x55ecd38beb0d in main /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99/symengine/tests/cwrapper/test_cwrapper.c:2392:5
#6 0x7f4ad0167189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: MemorySanitizer: use-of-uninitialized-value /opt-2/libcxx16-msan/include/c++/v1/__functional/function.h:356:5 in std::__1::__function::__func<SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Symbol const&)::'lambda'(double const*), std::__1::allocator<SymEngine::LambdaDoubleVisitor::bvisit(SymEngine::Symbol const&)::'lambda'(double const*)>, double (double const*)>::operator()(double const*&&)
Exiting

  Start 48: test_expression

48/59 Test #48: test_expression .................. Passed 0.07 sec
Start 49: test_logic
49/59 Test #49: test_logic ....................... Passed 0.03 sec
Start 50: test_finitediff
50/59 Test #50: test_finitediff .................. Passed 0.03 sec
Start 51: test_bipartite
51/59 Test #51: test_bipartite ................... Passed 0.02 sec
Start 52: test_hopcroft_karp
52/59 Test #52: test_hopcroft_karp ............... Passed 0.02 sec
Start 53: test_case001
53/59 Test #53: test_case001 ..................... Passed 0.02 sec
Start 54: test_case002
54/59 Test #54: test_case002 ..................... Passed 0.02 sec
Start 55: test_case003
55/59 Test #55: test_case003 ..................... Passed 0.02 sec
Start 56: test_case004
56/59 Test #56: test_case004 ..................... Passed 0.02 sec
Start 57: test_case005
57/59 Test #57: test_case005 ..................... Passed 0.02 sec
Start 58: test_case006
58/59 Test #58: test_case006 ..................... Passed 0.02 sec
Start 59: test_case007
59/59 Test #59: test_case007 ..................... Passed 0.03 sec

98% tests passed, 1 tests failed out of 59

Total Test time (real) = 4.38 sec

The following tests FAILED:
47 - test_cwrapper (Failed)
Errors while running CTest

It might also just be a bug in test_cwrapper.c. Either way, here's the corresponding cmake config

cmake invocation
-- The C compiler identification is Clang 16.0.0
-- The CXX compiler identification is Clang 16.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt-2/llvm-16/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt-2/llvm-16/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Linker does not support --exclude-libs
-- Linker does not support -unexported_symbol
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long double
-- Check size of long double - done
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0")  
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
--------------------------------------------------------------------------------

+-------------------------------+
| Configuration results SUMMARY |
+-------------------------------+

CMAKE_C_COMPILER: /opt-2/llvm-16/bin/clang
CMAKE_CXX_COMPILER: /opt-2/llvm-16/bin/clang++
CMAKE_BUILD_TYPE: Debug
CMAKE_CONFIGURATION_TYPES:
CMAKE_C_FLAGS:
CMAKE_CXX_FLAGS: -std=c++11 -std=c++17 -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-memory-param-retval -fsized-deallocation -stdlib=libc++ -nostdinc++ -isystem /opt-2/libcxx16-msan/include/c++/v1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -glldb -fPIC
CMAKE_CXX_FLAGS_DEBUG: -Wall -Wextra -Wno-unused-parameter -g -ggdb -Wno-unknown-pragmas
CMAKE_CXX_FLAGS_RELEASE: -Wall -Wextra -Wno-unused-parameter -O3 -funroll-loops -Wno-unknown-pragmas
CMAKE_INSTALL_PREFIX: /opt-4/symengine-fcef5c7-msan
BUILD_SHARED_LIBS: ON
INTEGER_CLASS : BOOSTMP
HAVE_SYMENGINE_GMP: no
WITH_SYMENGINE_ASSERT: yes
WITH_SYMENGINE_RCP: ON
WITH_SYMENGINE_TEUCHOS: no
WITH_COTIRE: OFF
WITH_GENERATE_PARSER: no
HAVE_GCC_ABI_DEMANGLE: no
HAVE_C_FUNCTION_NOT_FUNC: no
HAVE_DEFAULT_CONSTRUCTORS: yes
HAVE_SYMENGINE_NOEXCEPT: yes
HAVE_SYMENGINE_IS_CONSTRUCTIBLE: yes
HAVE_SYMENGINE_RESERVE: yes
HAVE_SYMENGINE_STD_TO_STRING: TRUE
WITH_SYMENGINE_THREAD_SAFE: no
BUILD_TESTS: ON
BUILD_BENCHMARKS: OFF
BUILD_BENCHMARKS_GOOGLE: no
WITH_GMP: no
WITH_BFD: OFF
WITH_ECM: no
WITH_PRIMESIEVE: no
WITH_FLINT: no
WITH_ARB: no
WITH_MPFR: no
WITH_PIRANHA: no
WITH_LLVM: OFF
WITH_BOOST: yes
BOOST_INCLUDE_DIRS: /usr/include
BOOST_LIBRARIES:
WITH_PTHREAD: no
WITH_MPC: no
WITH_TCMALLOC: no
WITH_OPENMP: no
WITH_VIRTUAL_TYPEID: no
LIBS:


-- Configuring done
-- Generating done
-- Build files have been written to: /src/symengine-fcef5c7d6cc848e3f6c0b9ecc5a22d30e5e98f99-msan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant