Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for codegen Crash in Clang when using locator omp_all_memory with depobj construct #114221

Merged
merged 7 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions clang/lib/CodeGen/CGStmtOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5556,12 +5556,14 @@ void CodeGenFunction::EmitOMPDepobjDirective(const OMPDepobjDirective &S) {
const auto *DO = S.getSingleClause<OMPDepobjClause>();
LValue DOLVal = EmitLValue(DO->getDepobj());
if (const auto *DC = S.getSingleClause<OMPDependClause>()) {
OMPTaskDataTy::DependData Dependencies(DC->getDependencyKind(),
DC->getModifier());
Dependencies.DepExprs.append(DC->varlist_begin(), DC->varlist_end());
Address DepAddr = CGM.getOpenMPRuntime().emitDepobjDependClause(
*this, Dependencies, DC->getBeginLoc());
EmitStoreOfScalar(DepAddr.emitRawPointer(*this), DOLVal);
// Build list and emit dependences
OMPTaskDataTy Data;
buildDependences(S, Data);
for (auto &Dep : Data.Dependences) {
Address DepAddr = CGM.getOpenMPRuntime().emitDepobjDependClause(
*this, Dep, DC->getBeginLoc());
EmitStoreOfScalar(DepAddr.emitRawPointer(*this), DOLVal);
}
return;
}
if (const auto *DC = S.getSingleClause<OMPDestroyClause>()) {
Expand Down
2 changes: 2 additions & 0 deletions clang/test/OpenMP/depobj_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ int main(int argc, char **argv) {
#pragma omp depobj(b) update(mutexinoutset)
#pragma omp depobj(a) depend(iterator(char *p = argv[argc]:argv[0]:-1), out: p[0])
(void)tmain(a), tmain(b);
omp_depend_t obj;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-gen check lines please. You might want do do a pre-commit for existing test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated !!!

#pragma omp depobj(obj) depend(inout: omp_all_memory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add actual checks here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated !!

return 0;
}

Expand Down
Loading