[clang] clang/OpenCL: Fix assertion on call to function with addrspace argument (PR #115093)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 6 00:55:52 PST 2024
AlexVlx wrote:
> The following also currently crashes with the flags in question:
>
> ```
> void use_of_private_var()
> {
> int x = 0 ;
> __private void* xx = &x;
> }
> ```
>
> And the AST for the call in your testcase looks fine:
>
> ```
> `-CallExpr 0xd4aeec8 <line:7:5, col:19> 'void'
> |-ImplicitCastExpr 0xd4aeeb0 <col:5> 'void (*)(__private int *__private)' <FunctionToPointerDecay>
> | `-DeclRefExpr 0xd4aedf0 <col:5> 'void (__private int *__private)' Function 0xd4ae950 'private_ptr' 'void (__private int *__private)'
> `-UnaryOperator 0xd4aee30 <col:17, col:18> '__private int *' prefix '&' cannot overflow
> `-DeclRefExpr 0xd4aee10 <col:18> '__private int' lvalue Var 0xd4aed50 'x' '__private int'
> ```
>
> I think this is actually a bug in the implementation of the "&" operator.
I’m not sure that’s a bug, I think that’s just the wonky OpenCL rules at play. I have a separate PR fixing this at the root which is stuck because @arsenm had objections and there’s a more robust way of handling ‘sret’, see #113930
https://github.com/llvm/llvm-project/pull/115093
More information about the cfe-commits
mailing list