[PATCH] D111566: [SYCL] Fix function pointer address space

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 18:38:29 PST 2022


rjmccall accepted this revision.
rjmccall added a comment.

LGTM, thanks!



================
Comment at: clang/test/CodeGen/avr/functionptr-addrspace.c:3
+
+int main() {
+  int (*p)();
----------------
eandrews wrote:
> When writing the test I noticed an existing crash in the compiler. I am not sure if I am doing something wrong but if you try to assign to the pointer, you will hit the following assert - https://llvm.org/doxygen/Constants_8cpp_source.html#l02280
> 
> ```
> int f() { return 0; }
> 
> int main() {
>   int (*p)() = f;
>   return 0;
> }
> ```
> 
> I briefly debugged this and I think the crash is because in `GetAddrOfFunction` we call `ConvertType` which returns type without the address space here - https://clang.llvm.org/doxygen/CodeGenTypes_8cpp_source.html#l00419.
> 
> I didn't fix this or debug this further since it is outside the scope of this patch but I can look into it as a followup PR
Okay.  AVR may be a constrained enough environment that they don't actually run into this sort of thing, but yeah, it'd be great to chase these bugs down.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111566/new/

https://reviews.llvm.org/D111566



More information about the cfe-commits mailing list