[clang] [Sema] Fix crash on arithmetic on _Atomic function pointer (PR #228255)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 05:03:35 PDT 2026
AaronBallman wrote:
> The caller checkArithmeticOpPointerOperand already strips _Atomic for its own checks but passes the original expression to the diagnostic function. The sibling function checkArithmeticIncompletePointerType handles this correctly by stripping _Atomic before the assertion.
I think a bit more investigation is needed; I would expect lvalue conversion to have already taken place by the time we're checking on arithmetic and so the types should be non-atomic by this point. However, I suspect we're passing the original type so that we get better diagnostic behavior in some cases. I wonder if it would make more sense to split the "require the original type" checks out into their own functions and pass the actual type used for arithmetic to the usual "check" functions so we can stop sprinkling type adjustments everywhere. WDYT?
https://github.com/llvm/llvm-project/pull/228255
More information about the cfe-commits
mailing list