FYI, the issue appears to be either fixed or latent in current clang/llvm trunk for the 7.0 release. However Apple is conservative about absorbing changes from llvm.org so we need to file a radar to make sure they test that this issue if fixed in the next major Xcode release.
FYI, the preprocessed failing test case doesn't trigger on ubuntu bionic using the same clang 6.0.0 release so the issue appears to be entirely darwin specific. The proposed fix of restricting the addition of -fno-strict-aliasing to darwin should be appropriate.
Note that I opened https://bugs.llvm.org/show_bug.cgi?id=37280 with the upstream llvm clang developers.
I would also note that, on darwin, we seem to automatically get -fno-strict-aliasing appended to compilations of c code through setup.py but not c++ code. Hence the need to explicitly pass -fno-strict-aliasing in setup.py on darwin. /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -Os -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -D_PYMOL_LIBPNG -D_PYMOL_INLINE -D_PYMOL_VMD_PLUGINS -D_HAVE_LIBXML -D_PYMOL_FREETYPE -DNO_MMLIBS -D_PYMOL_NUMPY -D_PYMOL_OSX -Iov/src -Ilayer0 -Ilayer1...
I would also note that, on darwin, we seem to automatically get -fno-strict-aliasing appended to compilations of c code through setup.py but not c++ code. Hence the need to explicitly pass -fno-strict-aliasing in setup.py on darwin. /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -Os -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -D_PYMOL_LIBPNG -D_PYMOL_INLINE -D_PYMOL_VMD_PLUGINS -D_HAVE_LIBXML -D_PYMOL_FREETYPE -DNO_MMLIBS -D_PYMOL_NUMPY -D_PYMOL_OSX -Iov/src -Ilayer0 -Ilayer1...
This issue can be fixed far more gracefully with the following change to setup.py... Index: setup.py =================================================================== --- setup.py (revision 4187) +++ setup.py (working copy) @@ -392,12 +392,12 @@ libs += ["GLEW"] libs += pyogl_libs - ext_comp_args += ["-ffast-math", "-funroll-loops", "-fcommon"] + ext_comp_args += ["-ffast-math", "-funroll-loops", "-fcommon", "-O3"] # optimization currently causes a clang segfault on OS X 10.9 when # compiling layer2/RepCylBond.cpp...
Opps. I missed that you are disabling -O3 on darwin. It would be better to enhance that with a check the offending compiler version of clang instead of all versions of clang.
modules not built with -O3 like main pymol files