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

Elizabeth Andrews via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 15:29:56 PST 2022


eandrews added inline comments.


================
Comment at: clang/test/CodeGen/avr/functionptr-addrspace.c:3
+
+int main() {
+  int (*p)();
----------------
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


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

https://reviews.llvm.org/D111566



More information about the cfe-commits mailing list