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

valgrind errors with unittest IlmCtlTest - Conditional jump or move depends on uninitialised value(s) #85

Closed
michaeldsmith opened this issue Jul 9, 2022 · 1 comment · Fixed by #91

Comments

@michaeldsmith
Copy link
Collaborator

michaeldsmith commented Jul 9, 2022

compiled in debug mode first before running valgrind

cd build
rm -R *
cmake -DCMAKE_BUILD_TYPE=Debug ..
make

3 similar issues found by valgrind related to :
Conditional jump or move depends on uninitialised value(s)
testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
Uninitialised value was created by a heap allocations
testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)

1: + cd ./unittest/IlmCtl/
1: + valgrind -s --error-exitcode=1 --leak-check=full --track-origins=yes --show-leak-kinds=all ./IlmCtlTest
1: ==763== Memcheck, a memory error detector
1: ==763== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
1: ==763== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
1: ==763== Command: ./IlmCtlTest
1: ==763== 
1: 
1: Testing end-of-line conventions
1: Dos source file
1: Unix source file
1: Mac source file
1: ok
1: 
1: Testing parser
1: Testing variable scope
1: ok
1: Testing more variable scope
1: ok
1: Testing integer and floating-point literals
1: "''	
1:  line 1 
1:  line 2
1: string string one two three one two three
1: ok
1: Testing comments
1: ok
1: Testing operations on type bool, run-time
1: ok
1: Testing operations on type bool, compile-time
1: ok
1: Testing operations on type int, run-time
1: ok
1: Testing operations on type int, compile-time
1: ok
1: Testing operations on type unsigned int, run-time
1: ok
1: Testing operations on type unsigned int, compile-time
1: ok
1: Testing operations on type half, run-time
1: ok
1: Testing operations on type half, compile-time
1: ok
1: Testing operations on type float, run-time
1: ok
1: Testing operations on type float, compile-time
1: ok
1: Testing while and for loops
1: ok
1: Testing cos(), exp(), sqrt() etc.
1: ok
1: Testing operations on 3x3 and 4x4 matrices and 3D vectors
1: ok
1: Testing conversion between RGB and CIE XYZ
1: ok
1: Testing conversion between CIE XYZ and CIE L*u*v*
1: ok
1: Testing conversion between CIE XYZ and CIE L*a*b*
1: ok
1: Testing 1D table lookups: linear, regular spacіng
1: ok
1: Testing 1D table lookups: cubic, regular spacing
1: ok
1: Testing 3D table lookups, trilinear, regular spacing
1: ok
1: Testing 1D table lookups: linear, random spacing
1: ok
1: Testing 1D table lookups: cubic, random spacing
1: ok
1: Testing divisions by zero
1: ok
1: Testing 3D scattered data interpolation
1: ok
1: Testing CTL version check
1: ok
1: 1 2 3 4 5 
1: b = 0, f = -1.2e-07, random literals: 4, 3
1: ok
1: 
1: Testing varying examples from documentation.
1: 1 2 3 4 5 
1: b = 0, f = -1.2e-07, random literals: 4, 3
1: all f: [varying (0, 1.2) (1, 0) (2, 0) (3, -1.001) (4, 0)]
1: f > 1: [varying (0, 1.2)]
1: ok
1: 
1: Testing function calls from C++.
1: ok
1: 
1: Testing varying data.
1: ok
1: 
1: Testing varying data with branching & return stmt.
1: ok
1: 
1: Testing table lookups with varying data
1: 1D, linear, regular spacing
1: 1D, cubic, regular spacing
1: ==763== Conditional jump or move depends on uninitialised value(s)
1: ==763==    at 0x5093409: float Imath_2_3::clamp<float>(float, float, float) (ImathFun.h:113)
1: ==763==    by 0x5092163: Ctl::lookup1D(float const*, int, float, float, float) (CtlLookupTable.cpp:119)
1: ==763==    by 0x5092252: Ctl::lookupCubic1D(float const*, int, float, float, float) (CtlLookupTable.cpp:138)
1: ==763==    by 0x48D4FCC: Ctl::(anonymous namespace)::simdDoLookup1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&, float (*)(float const*, int, float, float, float)) (CtlSimdStdLibLookupTable.cpp:137)
1: ==763==    by 0x48D50F5: Ctl::(anonymous namespace)::simdLookupCubic1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&) (CtlSimdStdLibLookupTable.cpp:177)
1: ==763==    by 0x48C22E6: Ctl::SimdCCallInst::execute(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:476)
1: ==763==    by 0x48C1064: Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:185)
1: ==763==    by 0x4925B58: Ctl::SimdXContext::run(int, Ctl::SimdInst const*) (CtlSimdXContext.cpp:233)
1: ==763==    by 0x48BE0C2: Ctl::SimdFunctionCall::callFunction(unsigned long) (CtlSimdFunctionCall.cpp:148)
1: ==763==    by 0x120F5F: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763==  Uninitialised value was created by a heap allocation
1: ==763==    at 0x483C583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
1: ==763==    by 0x48CDC46: Ctl::SimdReg::SimdReg(bool, unsigned long) (CtlSimdReg.cpp:90)
1: ==763==    by 0x48BDCA3: Ctl::SimdFunctionCall::SimdFunctionCall(Ctl::SimdInterpreter&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ctl::RcPtr<Ctl::FunctionType>, Ctl::RcPtr<Ctl::SimdInstAddr>, Ctl::SymbolTable&) (CtlSimdFunctionCall.cpp:110)
1: ==763==    by 0x48C57AF: Ctl::SimdInterpreter::newFunctionCallInternal(Ctl::RcPtr<Ctl::SymbolInfo>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlSimdInterpreter.cpp:167)
1: ==763==    by 0x4A6551D: Ctl::Interpreter::newFunctionCall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlInterpreter.cpp:507)
1: ==763==    by 0x1206B4: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763== 
1: ==763== Conditional jump or move depends on uninitialised value(s)
1: ==763==    at 0x509341B: float Imath_2_3::clamp<float>(float, float, float) (ImathFun.h:113)
1: ==763==    by 0x5092163: Ctl::lookup1D(float const*, int, float, float, float) (CtlLookupTable.cpp:119)
1: ==763==    by 0x5092252: Ctl::lookupCubic1D(float const*, int, float, float, float) (CtlLookupTable.cpp:138)
1: ==763==    by 0x48D4FCC: Ctl::(anonymous namespace)::simdDoLookup1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&, float (*)(float const*, int, float, float, float)) (CtlSimdStdLibLookupTable.cpp:137)
1: ==763==    by 0x48D50F5: Ctl::(anonymous namespace)::simdLookupCubic1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&) (CtlSimdStdLibLookupTable.cpp:177)
1: ==763==    by 0x48C22E6: Ctl::SimdCCallInst::execute(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:476)
1: ==763==    by 0x48C1064: Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:185)
1: ==763==    by 0x4925B58: Ctl::SimdXContext::run(int, Ctl::SimdInst const*) (CtlSimdXContext.cpp:233)
1: ==763==    by 0x48BE0C2: Ctl::SimdFunctionCall::callFunction(unsigned long) (CtlSimdFunctionCall.cpp:148)
1: ==763==    by 0x120F5F: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763==  Uninitialised value was created by a heap allocation
1: ==763==    at 0x483C583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
1: ==763==    by 0x48CDC46: Ctl::SimdReg::SimdReg(bool, unsigned long) (CtlSimdReg.cpp:90)
1: ==763==    by 0x48BDCA3: Ctl::SimdFunctionCall::SimdFunctionCall(Ctl::SimdInterpreter&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ctl::RcPtr<Ctl::FunctionType>, Ctl::RcPtr<Ctl::SimdInstAddr>, Ctl::SymbolTable&) (CtlSimdFunctionCall.cpp:110)
1: ==763==    by 0x48C57AF: Ctl::SimdInterpreter::newFunctionCallInternal(Ctl::RcPtr<Ctl::SymbolInfo>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlSimdInterpreter.cpp:167)
1: ==763==    by 0x4A6551D: Ctl::Interpreter::newFunctionCall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlInterpreter.cpp:507)
1: ==763==    by 0x1206B4: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763== 
1: ==763== Conditional jump or move depends on uninitialised value(s)
1: ==763==    at 0x509205A: Ctl::(anonymous namespace)::indicesAndWeights(float, int, int&, int&, float&, float&) (CtlLookupTable.cpp:72)
1: ==763==    by 0x50921A6: Ctl::lookup1D(float const*, int, float, float, float) (CtlLookupTable.cpp:123)
1: ==763==    by 0x5092252: Ctl::lookupCubic1D(float const*, int, float, float, float) (CtlLookupTable.cpp:138)
1: ==763==    by 0x48D4FCC: Ctl::(anonymous namespace)::simdDoLookup1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&, float (*)(float const*, int, float, float, float)) (CtlSimdStdLibLookupTable.cpp:137)
1: ==763==    by 0x48D50F5: Ctl::(anonymous namespace)::simdLookupCubic1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&) (CtlSimdStdLibLookupTable.cpp:177)
1: ==763==    by 0x48C22E6: Ctl::SimdCCallInst::execute(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:476)
1: ==763==    by 0x48C1064: Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:185)
1: ==763==    by 0x4925B58: Ctl::SimdXContext::run(int, Ctl::SimdInst const*) (CtlSimdXContext.cpp:233)
1: ==763==    by 0x48BE0C2: Ctl::SimdFunctionCall::callFunction(unsigned long) (CtlSimdFunctionCall.cpp:148)
1: ==763==    by 0x120F5F: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763==  Uninitialised value was created by a heap allocation
1: ==763==    at 0x483C583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
1: ==763==    by 0x48CDC46: Ctl::SimdReg::SimdReg(bool, unsigned long) (CtlSimdReg.cpp:90)
1: ==763==    by 0x48BDCA3: Ctl::SimdFunctionCall::SimdFunctionCall(Ctl::SimdInterpreter&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ctl::RcPtr<Ctl::FunctionType>, Ctl::RcPtr<Ctl::SimdInstAddr>, Ctl::SymbolTable&) (CtlSimdFunctionCall.cpp:110)
1: ==763==    by 0x48C57AF: Ctl::SimdInterpreter::newFunctionCallInternal(Ctl::RcPtr<Ctl::SymbolInfo>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlSimdInterpreter.cpp:167)
1: ==763==    by 0x4A6551D: Ctl::Interpreter::newFunctionCall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlInterpreter.cpp:507)
1: ==763==    by 0x1206B4: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763== 
1: 3D, linear, regular spacing
1: 1D, linear, random spacing
1: 1D, cubic, random spacing
1: ok
1: 
1: Testing a very large static array.
1: 	Generating file ./ctlMakeBigArray.ctl
1: 	ok
1: 	Loading large arrays in module ctlMakeBigArray.
1: very large array : size = 1000000.
1: 	Removing file ./ctlMakeBigArray.ctl
1: 	ok
1: 	ok
1: ok
1: ==763== 
1: ==763== HEAP SUMMARY:
1: ==763==     in use at exit: 0 bytes in 0 blocks
1: ==763==   total heap usage: 5,231,208 allocs, 5,231,208 frees, 407,807,008 bytes allocated
1: ==763== 
1: ==763== All heap blocks were freed -- no leaks are possible
1: ==763== 
1: ==763== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
1: ==763== 
1: ==763== 1 errors in context 1 of 3:
1: ==763== Conditional jump or move depends on uninitialised value(s)
1: ==763==    at 0x509205A: Ctl::(anonymous namespace)::indicesAndWeights(float, int, int&, int&, float&, float&) (CtlLookupTable.cpp:72)
1: ==763==    by 0x50921A6: Ctl::lookup1D(float const*, int, float, float, float) (CtlLookupTable.cpp:123)
1: ==763==    by 0x5092252: Ctl::lookupCubic1D(float const*, int, float, float, float) (CtlLookupTable.cpp:138)
1: ==763==    by 0x48D4FCC: Ctl::(anonymous namespace)::simdDoLookup1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&, float (*)(float const*, int, float, float, float)) (CtlSimdStdLibLookupTable.cpp:137)
1: ==763==    by 0x48D50F5: Ctl::(anonymous namespace)::simdLookupCubic1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&) (CtlSimdStdLibLookupTable.cpp:177)
1: ==763==    by 0x48C22E6: Ctl::SimdCCallInst::execute(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:476)
1: ==763==    by 0x48C1064: Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:185)
1: ==763==    by 0x4925B58: Ctl::SimdXContext::run(int, Ctl::SimdInst const*) (CtlSimdXContext.cpp:233)
1: ==763==    by 0x48BE0C2: Ctl::SimdFunctionCall::callFunction(unsigned long) (CtlSimdFunctionCall.cpp:148)
1: ==763==    by 0x120F5F: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763==  Uninitialised value was created by a heap allocation
1: ==763==    at 0x483C583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
1: ==763==    by 0x48CDC46: Ctl::SimdReg::SimdReg(bool, unsigned long) (CtlSimdReg.cpp:90)
1: ==763==    by 0x48BDCA3: Ctl::SimdFunctionCall::SimdFunctionCall(Ctl::SimdInterpreter&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ctl::RcPtr<Ctl::FunctionType>, Ctl::RcPtr<Ctl::SimdInstAddr>, Ctl::SymbolTable&) (CtlSimdFunctionCall.cpp:110)
1: ==763==    by 0x48C57AF: Ctl::SimdInterpreter::newFunctionCallInternal(Ctl::RcPtr<Ctl::SymbolInfo>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlSimdInterpreter.cpp:167)
1: ==763==    by 0x4A6551D: Ctl::Interpreter::newFunctionCall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlInterpreter.cpp:507)
1: ==763==    by 0x1206B4: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763== 
1: ==763== 
1: ==763== 1 errors in context 2 of 3:
1: ==763== Conditional jump or move depends on uninitialised value(s)
1: ==763==    at 0x509341B: float Imath_2_3::clamp<float>(float, float, float) (ImathFun.h:113)
1: ==763==    by 0x5092163: Ctl::lookup1D(float const*, int, float, float, float) (CtlLookupTable.cpp:119)
1: ==763==    by 0x5092252: Ctl::lookupCubic1D(float const*, int, float, float, float) (CtlLookupTable.cpp:138)
1: ==763==    by 0x48D4FCC: Ctl::(anonymous namespace)::simdDoLookup1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&, float (*)(float const*, int, float, float, float)) (CtlSimdStdLibLookupTable.cpp:137)
1: ==763==    by 0x48D50F5: Ctl::(anonymous namespace)::simdLookupCubic1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&) (CtlSimdStdLibLookupTable.cpp:177)
1: ==763==    by 0x48C22E6: Ctl::SimdCCallInst::execute(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:476)
1: ==763==    by 0x48C1064: Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:185)
1: ==763==    by 0x4925B58: Ctl::SimdXContext::run(int, Ctl::SimdInst const*) (CtlSimdXContext.cpp:233)
1: ==763==    by 0x48BE0C2: Ctl::SimdFunctionCall::callFunction(unsigned long) (CtlSimdFunctionCall.cpp:148)
1: ==763==    by 0x120F5F: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763==  Uninitialised value was created by a heap allocation
1: ==763==    at 0x483C583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
1: ==763==    by 0x48CDC46: Ctl::SimdReg::SimdReg(bool, unsigned long) (CtlSimdReg.cpp:90)
1: ==763==    by 0x48BDCA3: Ctl::SimdFunctionCall::SimdFunctionCall(Ctl::SimdInterpreter&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ctl::RcPtr<Ctl::FunctionType>, Ctl::RcPtr<Ctl::SimdInstAddr>, Ctl::SymbolTable&) (CtlSimdFunctionCall.cpp:110)
1: ==763==    by 0x48C57AF: Ctl::SimdInterpreter::newFunctionCallInternal(Ctl::RcPtr<Ctl::SymbolInfo>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlSimdInterpreter.cpp:167)
1: ==763==    by 0x4A6551D: Ctl::Interpreter::newFunctionCall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlInterpreter.cpp:507)
1: ==763==    by 0x1206B4: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763== 
1: ==763== 
1: ==763== 1 errors in context 3 of 3:
1: ==763== Conditional jump or move depends on uninitialised value(s)
1: ==763==    at 0x5093409: float Imath_2_3::clamp<float>(float, float, float) (ImathFun.h:113)
1: ==763==    by 0x5092163: Ctl::lookup1D(float const*, int, float, float, float) (CtlLookupTable.cpp:119)
1: ==763==    by 0x5092252: Ctl::lookupCubic1D(float const*, int, float, float, float) (CtlLookupTable.cpp:138)
1: ==763==    by 0x48D4FCC: Ctl::(anonymous namespace)::simdDoLookup1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&, float (*)(float const*, int, float, float, float)) (CtlSimdStdLibLookupTable.cpp:137)
1: ==763==    by 0x48D50F5: Ctl::(anonymous namespace)::simdLookupCubic1D(Ctl::SimdBoolMask const&, Ctl::SimdXContext&) (CtlSimdStdLibLookupTable.cpp:177)
1: ==763==    by 0x48C22E6: Ctl::SimdCCallInst::execute(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:476)
1: ==763==    by 0x48C1064: Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const (CtlSimdInst.cpp:185)
1: ==763==    by 0x4925B58: Ctl::SimdXContext::run(int, Ctl::SimdInst const*) (CtlSimdXContext.cpp:233)
1: ==763==    by 0x48BE0C2: Ctl::SimdFunctionCall::callFunction(unsigned long) (CtlSimdFunctionCall.cpp:148)
1: ==763==    by 0x120F5F: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:216)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763==  Uninitialised value was created by a heap allocation
1: ==763==    at 0x483C583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
1: ==763==    by 0x48CDC46: Ctl::SimdReg::SimdReg(bool, unsigned long) (CtlSimdReg.cpp:90)
1: ==763==    by 0x48BDCA3: Ctl::SimdFunctionCall::SimdFunctionCall(Ctl::SimdInterpreter&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ctl::RcPtr<Ctl::FunctionType>, Ctl::RcPtr<Ctl::SimdInstAddr>, Ctl::SymbolTable&) (CtlSimdFunctionCall.cpp:110)
1: ==763==    by 0x48C57AF: Ctl::SimdInterpreter::newFunctionCallInternal(Ctl::RcPtr<Ctl::SymbolInfo>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlSimdInterpreter.cpp:167)
1: ==763==    by 0x4A6551D: Ctl::Interpreter::newFunctionCall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CtlInterpreter.cpp:507)
1: ==763==    by 0x1206B4: testLookupCubic1D(Ctl::Interpreter&) (testVaryingLookup.cpp:160)
1: ==763==    by 0x1257FD: testVaryingLookup() (testVaryingLookup.cpp:528)
1: ==763==    by 0x10D990: main (main.cpp:81)
1: ==763== 
1: ==763== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
@michaeldsmith
Copy link
Collaborator Author

this can be fixed by adding () to the new statement on line 90 of CtlSimdReg.cpp to invoke the default initializer
change

SimdReg::SimdReg (bool varying, size_t elementSize)
: _eSize(elementSize), 
  _varying(varying), 
  _oVarying(false),
  _offsets(zeroOffset),
  _data (new char [ varying ? MAX_REG_SIZE * _eSize : _eSize]),
  _ref(0)
{
}

to

SimdReg::SimdReg (bool varying, size_t elementSize)
: _eSize(elementSize), 
  _varying(varying), 
  _oVarying(false),
  _offsets(zeroOffset),
  _data (new char [ varying ? MAX_REG_SIZE * _eSize : _eSize]() ),
  _ref(0)
{
}

michaeldsmith added a commit to michaeldsmith/CTL that referenced this issue Jul 10, 2022
michaeldsmith added a commit that referenced this issue Aug 6, 2022
* install valgrind dependency in github workflow
* build unittests before running valgrind
* add script to run valgrind
* add valgrind to docker
#85 #86 are two issues reported by valgrind
michaeldsmith added a commit to michaeldsmith/CTL that referenced this issue Aug 6, 2022
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

Successfully merging a pull request may close this issue.

1 participant