[clang] [clang] Fixed a crash when explicitly casting to atomic complex (PR #172163)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 17 04:02:24 PST 2025


AmrDeveloper wrote:

> Hmm. Since this is an IBM / GCC extension, I would normally ask what GCC thinks the type of `__real(a)` is. But GCC actually appears to accept `&__real(a)`, which cannot be correctly implemented, so clearly this is just not carefully tested, which is not too surprising for an extension.
> 
> I would say that `__real`/`__imag` applied to an atomic type should just force lvalue conversion on the operand, which will strip the atomic type. `__real(a) = r;` is theoretically implementable but I don't see any urgency to do it.
> 
> More generally, I think it's extremely regrettable that C requires atomic types to exist as r-value types at all, but it may just be something we have to live with.

Thanks for the explanation :D, I will focus on the two crashes and then test more cases with atomics 🙏🏻  

https://github.com/llvm/llvm-project/pull/172163


More information about the cfe-commits mailing list