[llvm-bugs] [Bug 49315] New: ICE when assigning a function to a pointer.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 22 07:09:48 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49315
Bug ID: 49315
Summary: ICE when assigning a function to a pointer.
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: OpenCL
Assignee: unassignedclangbugs at nondot.org
Reporter: anastasia.stulova at arm.com
CC: anastasia.stulova at arm.com, llvm-bugs at lists.llvm.org
When the extension for the function pointers is used
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
void foo();
void bar(){
void (*f)() = foo;
}
frontend fails to compile it failing in the incorrect address space conversion
check.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e03183c1a42f..8aece0b63037 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -15823,6 +15823,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType
ConvTy,
isInvalid = true;
+ // FIXME: On function types we should not be taking a pointee.
Qualifiers lhq = SrcType->getPointeeType().getQualifiers();
Qualifiers rhq = DstType->getPointeeType().getQualifiers();
+ // FIXME: The right check should take the address space compatibility into
account.
if (lhq.getAddressSpace() != rhq.getAddressSpace()) {
This issue is not triggered in C++ for OpenCL mode that seems to follow
different conversion path.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210222/0e146a64/attachment.html>
More information about the llvm-bugs
mailing list