You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we crash on an assertion when we try to use a member from a parent class. This is caused by an assertion that the initializer of the variable is a this clause, which isn't true in this case as it is actually a cast.
class A {
public:
double *ptr;
virtual void foo() = 0;
};
class B : public A {
public:
virtual void foo() override;
};
void B::foo() {
#pragma omp target data use_device_ptr(A::ptr)
{}
}
$ clang bug.cpp -fopenmp --offload-arch=sm_80 --offload-device-only -S -emit-llvm -o -
clang-17: /root/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:7149: void clang::CodeGen::CodeGenFunction::EmitOMPUseDevicePtrClause(const clang::OMPUseDevicePtrClause&, clang::CodeGen::CodeGenFunction::OMPPrivateScope&, const llvm::DenseMap<const clang::ValueDecl*, clang::CodeGen::Address>&): Assertion `isa<CXXThisExpr>(ME->getBase()) && "Base should be the current struct!"' failed.
The AST dump for the problematic expression shows
MemberExpr 0x5558ae7245b0 'double *' lvalue ->ptr 0x5558ae7053d0
`-ImplicitCastExpr 0x5558ae724590 'class A *' <UncheckedDerivedToBase (A)>
`-CXXThisExpr 0x5558ae724580 'class B *' implicit this
Currently, we crash on an assertion when we try to use a member from a parent class. This is caused by an assertion that the initializer of the variable is a
this
clause, which isn't true in this case as it is actually a cast.The AST dump for the problematic expression shows
This bug is reproducible from the following link https://godbolt.org/z/Kand715qs.
The text was updated successfully, but these errors were encountered: