[cfe-dev] clang-tidy & SSE with GCC toolchain

Daniel Evers via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 25 04:25:15 PST 2018


Hey!

I have a project which is compiled with GCC (7) and Clang (5.0). The clang built uses the GCC tool chain, like this (Red Hat 7 with devtoolset-7):
     clang++ -gcc-toolchain /opt/rh/devtoolset-7/root/usr [...]

The code compiles and runs fine, but running clang-tidy (using the same compiler flags) chokes on the SSE built-ins in GCC's headers:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include/xmmintrin.h:54:3: error: argument to '__builtin_prefetch' must be a constant integer [clang-diagnostic-error]
  __builtin_prefetch (__P, (__I & 0x4) >> 2, __I & 0x3);
  ^
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include/xmmintrin.h:130:19: error: use of undeclared identifier '__builtin_ia32_addss' [clang-diagnostic-error]
  return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B);
                  ^
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include/xmmintrin.h:136:19: error: use of undeclared identifier '__builtin_ia32_subss' [clang-diagnostic-error]
  return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B);

[more errors following...]

This happens as soon as I include <xmmintrin.h> (e.g. indirectly via Boost.UUID).

I'm wondering that the clang compiler accepts the code, while clang-tidy doesn't.
Any ideas how to fix this? My current workaround is to disable SSE-support in Boost.UUID via macro for clang-tidy, but the problem will re-appear as soon as some other lib tries to use SSE instructions.

Cheers,
Daniel Evers


________________________________

Utimaco TS GmbH
Germanusstr. 4, D.52080 Aachen, Germany, Tel: +49-241-1696-0, www.utimaco.com
Seat: Aachen - Registergericht Aachen HRB 18923
VAT ID No.: DE 815 496 507
Managementboard: Malte Pollmann (Chairman) CEO, Dr. Frank J. Nellissen CFO

This communication is confidential. We only send and receive email on the basis of the terms set out at https://www.utimaco.com/en/e-mail-disclaimer/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180125/43f4d815/attachment.html>


More information about the cfe-dev mailing list