-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:headersHeaders provided by Clang, e.g. for intrinsicsHeaders provided by Clang, e.g. for intrinsicsplatform:windows
Description
This is a simplified example to reproduce the issue:
#include <immintrin.h>
#pragma clang attribute push(__attribute__((target("avx"))), apply_to=function)
#include <atomic>
#pragma clang attribute pop
int main()
{
return 0;
}
Build the example with:
clang-cl.exe /c main.cpp /Fomain.obj /nologo /std:c++20
or
clang-cl.exe /c main.cpp /Fomain.obj /nologo -D__RTM__
The result is:
In file included from main.cpp:1:
In file included from C:\tools\LLVM-18.1.6\lib\clang\18\include\immintrin.h:603:
C:\tools\LLVM-18.1.6\lib\clang\18\include\rtmintrin.h(36,1): error: attribute 'target' multiversioning cannot be combined with attribute 'always_inline'
36 | _xend(void)
| ^
C:\tools\LLVM-18.1.6\lib\clang\18\include\intrin.h(167,6): note: function multiversioning caused by this declaration
167 | void _xend(void);
| ^
1 error generated.
I reproduce this with:
clang version 18.1.6
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Tools\LLVM-18.1.6\bin
and
Visual Studio Community 2022
17.10.1
The example is artificial, I have the same issue when building skia ( https://github.com/google/skia ) with clang-cl and c++20 enabled.
I'm not absolutely sure if this is really a clang issue but it seems reasonable to me to push attributes before including a header which declares a set of functions which also happen to use standard library functions.
Does the declaration of _xend() in intrin.h really necessary if the intrinsics are enabled?
Metadata
Metadata
Assignees
Labels
clang:headersHeaders provided by Clang, e.g. for intrinsicsHeaders provided by Clang, e.g. for intrinsicsplatform:windows