| Issue |
71858
|
| Summary |
clang does not implement `__assume__` attribute, fails libstdc++ build
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
trofi
|
`gcc` implements `__assume__` attribute as: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html, quoting the example:
```c
int
foo (int x, int y)
{
__attribute__((assume(x == 42)));
__attribute__((assume(++y == 43)));
return x + y;
}
```
`clang-16` fails to build it as:
```
$ clang -c a.c
a.c:4:18: error: 'assume' attribute cannot be applied to a statement
__attribute__((assume(x == 42)));
^ ~
a.c:5:18: error: 'assume' attribute cannot be applied to a statement
__attribute__((assume(++y == 43)));
^ ~
2 errors generated.
```
Recently `gcc` started using it in `libstdc++` https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e39b3e02c27bd7 as
```c++
void
_M_assume_normalized() const
{
unsigned int __ofst = _M_offset;
__attribute__ ((__assume__ (__ofst < unsigned(_S_word_bit))));
}
```
and `clang++` now fails to parse `<vector>` from `libstdc++`.
Is there a change `clang` would support this style of `__assume__` attribute or at least skipped it in stead of producing build failure?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs