Build failure with clang on older CPU :Illegal instruction

Luboš Luňák l.lunak at
Mon Nov 11 08:46:37 UTC 2019

On Monday 11 of November 2019, Luke Benes wrote:
> Noel,
> After
>c6a14e87eed48b2f15a28d loplugin:unusedmethods

 The guilty commit is actually .

 The INTRINSICS_CXXFLAGS variable is misdesigned or misused. What happens is 
that a source file gets unconditionally compiled with whatever configure 
finds to be the most advanced instruction set, and then the code from the 
compiled source gets executed unconditionally, without a runtime check. A 
runtime check is necessary, as flags like -mavx2 allow the compiler to use 
newer instructions even for source code that doesn't explicitly use them.

 Looking at tools/qa/cppunit/test_cpuid.cxx, it seems that it doesn't need any 
special CXXFLAGS, as it doesn't use them. And if it does need them, then 
those parts need to be split to one source file per instruction set, each 
compiled with its matching CXXFLAGS, and then another source file (compiled 
normally) needs to call them only after doing a runtime check. See the 
description of -mavx2 etc. in 'man gcc' and see 'git grep SSE2 sc/' for an 

> Clang 7 on KDE Neon x86-64, and clang 10-git on openSUSE Tumbleweed i686 is
> failing with 
> [CUT] tools_test
> Illegal instruction (core dumped)
> Thread 1 (Thread 0x7f90ea199740 (LWP 8225)):
> #0  0x00007f90e824f538 in CppUnit::TestSuiteFactory<(anonymous
> namespace)::CpuInstructionSetSupport>::makeTest() () at
> /core/workdir/LinkTarget/CppunitTest/ #1 
> 0x00007f90e9d66f3b in
> CppUnit::TestFactoryRegistry::addTestToSuite(CppUnit::TestSuite*) () at
> /core/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/
>0 #2  0x00007f90e9d66e67 in CppUnit::TestFactoryRegistry::makeTest() () at
> /core/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/
>0 #3  0x00000000004042a9 in (anonymous
> namespace)::ProtectedFixtureFunctor::run() const () #4  0x00000000004035be
> in main ()
> Error: a unit test failed, please do one of:
> make CppunitTest_tools_test CPPUNITTRACE="gdb --args"
> ...
> $ cat /proc/cpuinfo
> model name      : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
> Newer CPU's like my Broadwell Core i3 Processors have no issue with the
> same distros.

 Luboš Luňák
 l.lunak at

More information about the LibreOffice mailing list