[clang] [Clang] Allow all address spaces to be converted to the default (PR #112248)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 15 05:39:12 PDT 2024
AlexVlx wrote:
> > I'm thinking we could have a language option like `-fimplicit-default-addrspace-cast` that allows all conversions to default. Then if we want users to be aware that this even exists we could suggest it in the error message if it would fix it.
> > I do understand that there's some weird semantics here, and it does change some surprisingly unrelated tests so I don't think the patch as-is will be sound. Hiding it behind an option makes sense so I can do that.
>
> I think we should avoid modality / language dependence. I thought the problem you were dealing with was the cuda_ attributes not behaving consistently in C++ mode?
But this is language dependent, it's not some inconsequential BE/LLVM aspect being bubbled up. Explicit, semantically meaningful ASes impact the language. They should not "just work" if you're compiling for vanilla C/C++ (so not CUDA C++, or SYCL, or OpenCL C/C++ etc.) because neither of those defines such a notion. Furthermore, C++ expects that it's possible for implementation specific attributes to be removable/ignorable without there being an impact on program semantics / behaviour, which doesn't necessarily have to be the case here. Finally, it's not clear that it's even right to have this implicit conversion to default from a linguistic standpoint in C/C++, even if it is convenient. It would require more thought and consideration for how it composes with the rest of the language. So given these, it actually makes sense to have it be opt-in, IMHO, to clearly signal that one is opting into non-standard behaviour.
https://github.com/llvm/llvm-project/pull/112248
More information about the cfe-commits
mailing list