Re: [PATCH 1/3] Compiler Attributes: Add __assume macro

From: Miguel Ojeda

Date: Thu Sep 11 2025 - 14:59:42 EST


On Wed, Sep 10, 2025 at 5:12 PM Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:
>
> + * Beware: Code which makes use of __assume must be written as if the compiler
> + * ignores the hint. Otherwise this may lead to subtle bugs if code is compiled
> + * with compilers which do not support the attribute.

I am not sure I understand this "Beware:" comment: is it referring to
evaluation side-effects? If so, the GCC docs say it is not evaluated.
The real danger is triggering UB with it, but that is different, i.e.
one needs to be really, really sure the expression is true.

Cheers,
Miguel