When running valgrind on a simple program opening an OpenCV namedWindow (https://docs.opencv.org/3.3.0/d7/dfc/group__highgui.html#ga5afdf8410934fd099df85c75b2e0888b), it reports: UNKNOWN workq_ops option 128 ==88358== valgrind: Unrecognised instruction at address 0x10219bb50. ==88358== at 0x10219BB50: _dispatch_kq_init (in /usr/lib/system/libdispatch.dylib) (Full report and example code below) It is not impossible that this is a bug on OpenCV's site. Versions etc: OS: macOS Sierra 10.12.6 (MB Pro, 15inch, Mid 2015 / 2.8 GHz Intel Core i7) Installed most things straight with brew package manager. valgrind --version: valgrind-3.14.0.SVN (brew HEAD-16470) clang --version: Apple LLVM version 9.0.0 (clang-900.0.37) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin pkg-config --modversion opencv: 3.3.0 ls /usr/lib/libstdc++.*: /usr/lib/libstdc++.6.0.9.dylib /usr/lib/libstdc++.6.dylib /usr/lib/libstdc++.dylib Example code: test.cpp: ``` #include "opencv2/highgui.hpp" int main(const int argc, const char** const argv) { cv::namedWindow("NamedWindow"); // while (true) if (cv::waitKey(1) != -1) break; } ``` You might want to add the commented line to see the window in action when running the program normally. Compile commands: ``` clang -lstdc++ $(pkg-config --cflags --libs opencv) test.cpp -o test ``` Report (simple `valgrind ./test`): ``` ==88358== Memcheck, a memory error detector ==88358== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==88358== Using Valgrind-3.14.0.SVN and LibVEX; rerun with -h for copyright info ==88358== Command: ./test ==88358== --88358-- run: /usr/bin/dsymutil "./test" warning: no debug symbols in executable (-arch x86_64) ==88358== Syscall param msg->desc.port.name points to uninitialised byte(s) ==88358== at 0x1023AF34A: mach_msg_trap (in /usr/lib/system/libsystem_kernel.dylib) ==88358== by 0x1023AE796: mach_msg (in /usr/lib/system/libsystem_kernel.dylib) ==88358== by 0x1023A8485: task_set_special_port (in /usr/lib/system/libsystem_kernel.dylib) ==88358== by 0x10254410E: _os_trace_create_debug_control_port (in /usr/lib/system/libsystem_trace.dylib) ==88358== by 0x102544458: _libtrace_init (in /usr/lib/system/libsystem_trace.dylib) ==88358== by 0x1020749DF: libSystem_initializer (in /usr/lib/libSystem.B.dylib) ==88358== by 0x100018A1A: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==88358== by 0x100018C1D: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==88358== by 0x1000144A9: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==88358== by 0x100014440: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==88358== by 0x100013523: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==88358== by 0x1000135B8: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld) ==88358== Address 0x104889a2c is on thread 1's stack ==88358== in frame #2, created by task_set_special_port (???:) ==88358== --88358-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option --88358-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2 times) --88358-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4 times) UNKNOWN workq_ops option 128 ==88358== valgrind: Unrecognised instruction at address 0x10219bb50. ==88358== at 0x10219BB50: _dispatch_kq_init (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1021998FB: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1021998B8: dispatch_once_f (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219BA90: _dispatch_kq_update (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219D0CD: _dispatch_kevent_resume (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219D03D: _dispatch_source_kevent_resume (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219CE85: _dispatch_source_kevent_register (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1021AC651: _dispatch_queue_resume_finalize_activation (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1024EC3C0: _notify_lib_init (in /usr/lib/system/libsystem_notify.dylib) ==88358== by 0x1024EC9AB: notify_register_dispatch (in /usr/lib/system/libsystem_notify.dylib) ==88358== by 0x1088BF916: CFUniCharMapTo (in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) ==88358== by 0x1021998FB: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib) ==88358== Your program just tried to execute an instruction that Valgrind ==88358== did not recognise. There are two possible reasons for this. ==88358== 1. Your program has a bug and erroneously jumped to a non-code ==88358== location. If you are running Memcheck and you just saw a ==88358== warning about a bad jump, it's probably your program's fault. ==88358== 2. The instruction is legitimate but Valgrind doesn't handle it, ==88358== i.e. it's Valgrind's fault. If you think this is the case or ==88358== you are not sure, please let us know and we'll try to fix it. ==88358== Either way, Valgrind will now raise a SIGILL signal which will ==88358== probably kill your program. ==88358== ==88358== Process terminating with default action of signal 4 (SIGILL) ==88358== Illegal opcode at address 0x10219BB50 ==88358== at 0x10219BB50: _dispatch_kq_init (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1021998FB: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1021998B8: dispatch_once_f (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219BA90: _dispatch_kq_update (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219D0CD: _dispatch_kevent_resume (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219D03D: _dispatch_source_kevent_resume (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x10219CE85: _dispatch_source_kevent_register (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1021AC651: _dispatch_queue_resume_finalize_activation (in /usr/lib/system/libdispatch.dylib) ==88358== by 0x1024EC3C0: _notify_lib_init (in /usr/lib/system/libsystem_notify.dylib) ==88358== by 0x1024EC9AB: notify_register_dispatch (in /usr/lib/system/libsystem_notify.dylib) ==88358== by 0x1088BF916: CFUniCharMapTo (in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) ==88358== by 0x1021998FB: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib) ==88358== ==88358== HEAP SUMMARY: ==88358== in use at exit: 2,355,679 bytes in 1,302 blocks ==88358== total heap usage: 5,463 allocs, 4,161 frees, 4,758,949 bytes allocated ==88358== ==88358== LEAK SUMMARY: ==88358== definitely lost: 1,264 bytes in 4 blocks ==88358== indirectly lost: 0 bytes in 0 blocks ==88358== possibly lost: 9,792 bytes in 226 blocks ==88358== still reachable: 69,037 bytes in 741 blocks ==88358== suppressed: 2,275,586 bytes in 331 blocks ==88358== Rerun with --leak-check=full to see details of leaked memory ==88358== ==88358== For counts of detected and suppressed errors, rerun with: -v ==88358== Use --track-origins=yes to see where uninitialised values come from ==88358== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 23 from 4) [1] 88358 illegal hardware instruction valgrind ./test ```
Hi, this is a duplicate of an issue we are already tracking with ud2 within _dispatch_kq_init (in /usr/lib/system/libdispatch.dylib) *** This bug has been marked as a duplicate of bug 383723 ***