AaronBallman wrote:

> So,
> 
> ```c++
>    _Static_assert(__builtin_is_aligned((void *)33, 32), "");
> ```
> 
> this is supposed to....? Work? Not work?

By my reading of the docs, I think it's not supposed to work?

> This means that arbitrary integer values stored in pointer-type variables 
> must not be passed to these builtins. For those use cases, the builtins can 
> still be used, but the operation must be performed on the pointer cast to 
> uintptr_t.

This isn't stored in a pointer-type variable but I think it's a morally 
equivalent case.

> ```c++
>    _Static_assert(__builtin_is_aligned((void *)32, 32), "");
> ```
> 
> this works, but isn't the alignment of both of those pointers the same? Are 
> we really supposed to treat an integer casted to a pointer just like an 
> integer?

I don't think so, but I'm not confident in that answer.

https://github.com/llvm/llvm-project/pull/224549
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to