You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clang throws an error when compiling the following C code. Changing the log1pf function name to something else will make this compile, as well as removing inline or __attribute__((always_inline)) from the definition. This code compiles with GCC. https://godbolt.org/z/oqPeqsva6
<source>:7:33: error: alias must point to a defined variable or function
7 | float foo(float) __attribute__((alias("log1pf")));
| ^
<source>:7:33: note: the function or variable specified in an alias must refer to its mangled name
<source>:7:33: note: function by that name is mangled as "log1pf"
7 | float foo(float) __attribute__((alias("log1pf")));
| ^~~~~~~~~~~~~~~
| alias("log1pf")
1 error generated.
Compiler returned: 1
Version (trunk):
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 753498eed1d2d6d8c419bae5b65458640e5fbfd7)
Target: x86_64-unknown-linux-gnu
The text was updated successfully, but these errors were encountered:
Clang throws an error when compiling the following C code. Changing the `log1pf` function name to something else will make this compile, as well as removing `inline` or `__attribute__((always_inline))` from the definition. This code compiles with GCC.
https://godbolt.org/z/oqPeqsva6
```
float log1pf(float);
<source>:7:33: error: alias must point to a defined variable or function
7 | float foo(float) attribute((alias("log1pf")));
| ^
<source>:7:33: note: the function or variable specified in an alias must refer to its mangled name
<source>:7:33: note: function by that name is mangled as "log1pf"
7 | float foo(float) attribute((alias("log1pf")));
| ^~~~~~~~~~~~~~~
| alias("log1pf")
1 error generated.
Compiler returned: 1
In general, an alias has to be aliased to a definition, in the ELF sense. A C "inline definition" doesn't count as a definition in that sense. So we have to make sure that the definition is written in a way that it will actually be emitted.
Normally, the given testcase wouldn't count as an "inline definition"... but this particular testcase is hitting the carveout from https://reviews.llvm.org/D71082 . Which I think is a bug: it shouldn't count as an inline definition of a builtin because it's not an inline definition at all. That said, it's hard for me to imagine anyone hitting this in practice.
Clang throws an error when compiling the following C code. Changing the
log1pf
function name to something else will make this compile, as well as removinginline
or__attribute__((always_inline))
from the definition. This code compiles with GCC.https://godbolt.org/z/oqPeqsva6
Output:
Version (trunk):
The text was updated successfully, but these errors were encountered: