GCC Bug May Cause Crashes in OpenMesh

Hi, this is an announcement to make you aware of a GCC compiler bug that caused us a lot of grief. This bug affects the C++11 version of the VectorT class in OpenMesh (and hence also any Vec(2/3/4)(d/f/i) typedef). Since OpenFlipper heavily depends on the OpenMesh vector class, it is affected as well. This bug only affects you, if * you are using OpenMesh's vector class (possibly indirectly) * and you are using GCC >= 4.9 and < 6.0 * and you are compiling with -O3 (that's default in release mode) * and you are compiling with -std=c++11 (or c++0x or c++14). If these four conditions are satisfied then the compiler sometimes generates SSE instructions (which require 16 byte alignment) using memory addresses that are not 16-byte-aligned. Since these errors lead to segfaults, suggesting that you tried to access invalid memory addresses, they are extremely hard to recognize and debug. There are several workarounds: * Use GCC <= 4.8 or use GCC >= 6.0 * or use clang * or use -O2 (instead of -O3) * or use -O3 -march=<architecture> for an architecture that supports AVX. This way the compiler will generate AVX instead of SSE instructions which do allow unaligned memory access at a small performance penalty. This is the corresponding bug report in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66598 We are currently working on adding a unit test that exposes this bug. Best Hans-Christian Ebke -- Dipl.-Inform. Hans-Christian Ebke RWTH Aachen University Department for Computer Graphics, Multimedia, and Computer Vision Ahornstraße 55 52074 Aachen Building E3, Room 114 Phone: +49 241 8021803
participants (1)
-
Hans-Christian Ebke