With GCC/LLVM-GCC/LLVM, don’t call omp_get_num_threads() and omp_get_max_threads() in a thread method. It will crash.
I confirmed this just a minutes ago.
I think this is a bug. At least GraphicsMagick and ImageMagick were written considering that they didn’t cause crash, or they thought that Magick::Image class is always created and accessed in a single thread function.
Magick::Image class uses omp_get_max_threads() in its constructor and its read() method.