forked from OSchip/llvm-project
[OPENMP]Fix PR45383: type dependent array subscripts are diagnosed erroneously.
Summary: If the array subscript expression is type depent, its analysis must be delayed before its instantiation. Reviewers: jdoerfert Subscribers: yaxunl, guansong, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D78637
This commit is contained in:
parent
652b3757c8
commit
3c191ae555
|
@ -16128,7 +16128,7 @@ Sema::ActOnOpenMPDependClause(Expr *DepModifier, OpenMPDependClauseKind DepKind,
|
|||
|
||||
auto *ASE = dyn_cast<ArraySubscriptExpr>(SimpleExpr);
|
||||
if (!RefExpr->IgnoreParenImpCasts()->isLValue() ||
|
||||
(ASE &&
|
||||
(ASE && !ASE->getBase()->isTypeDependent() &&
|
||||
!ASE->getBase()
|
||||
->getType()
|
||||
.getNonReferenceType()
|
||||
|
|
|
@ -99,7 +99,8 @@ T tmain(T argc, T *argv) {
|
|||
T arr[argc];
|
||||
omp_depend_t x;
|
||||
omp_event_handle_t evt;
|
||||
#pragma omp task untied depend(in : argc, argv[b:argc], arr[:], ([argc][sizeof(T)])argv) if (task : argc > 0) depend(depobj: x) detach(evt)
|
||||
double *arr_double;
|
||||
#pragma omp task untied depend(in : argc, argv[b:argc], arr[:], ([argc][sizeof(T)])argv, arr_double[argc]) if (task : argc > 0) depend(depobj: x) detach(evt)
|
||||
a = 2;
|
||||
#pragma omp task default(none), private(argc, b) firstprivate(argv) shared(d) if (argc > 0) final(S<T>::TS > 0) priority(argc) affinity(argc, argv[b:argc], arr[:], ([argc][sizeof(T)])argv)
|
||||
foo();
|
||||
|
@ -116,7 +117,8 @@ T tmain(T argc, T *argv) {
|
|||
// CHECK-NEXT: T arr[argc];
|
||||
// CHECK-NEXT: omp_depend_t x;
|
||||
// CHECK-NEXT: omp_event_handle_t evt;
|
||||
// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:],([argc][sizeof(T)])argv) if(task: argc > 0) depend(depobj : x) detach(evt)
|
||||
// CHECK-NEXT: double *arr_double;
|
||||
// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:],([argc][sizeof(T)])argv,arr_double[argc]) if(task: argc > 0) depend(depobj : x) detach(evt)
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<T>::TS > 0) priority(argc) affinity(argc,argv[b:argc],arr[:],([argc][sizeof(T)])argv)
|
||||
// CHECK-NEXT: foo()
|
||||
|
@ -130,7 +132,8 @@ T tmain(T argc, T *argv) {
|
|||
// CHECK-NEXT: int arr[argc];
|
||||
// CHECK-NEXT: omp_depend_t x;
|
||||
// CHECK-NEXT: omp_event_handle_t evt;
|
||||
// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:],([argc][sizeof(int)])argv) if(task: argc > 0) depend(depobj : x) detach(evt)
|
||||
// CHECK-NEXT: double *arr_double;
|
||||
// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:],([argc][sizeof(int)])argv,arr_double[argc]) if(task: argc > 0) depend(depobj : x) detach(evt)
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<int>::TS > 0) priority(argc) affinity(argc,argv[b:argc],arr[:],([argc][sizeof(int)])argv)
|
||||
// CHECK-NEXT: foo()
|
||||
|
@ -144,7 +147,8 @@ T tmain(T argc, T *argv) {
|
|||
// CHECK-NEXT: long arr[argc];
|
||||
// CHECK-NEXT: omp_depend_t x;
|
||||
// CHECK-NEXT: omp_event_handle_t evt;
|
||||
// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:],([argc][sizeof(long)])argv) if(task: argc > 0) depend(depobj : x) detach(evt)
|
||||
// CHECK-NEXT: double *arr_double;
|
||||
// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:],([argc][sizeof(long)])argv,arr_double[argc]) if(task: argc > 0) depend(depobj : x) detach(evt)
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<long>::TS > 0) priority(argc) affinity(argc,argv[b:argc],arr[:],([argc][sizeof(long)])argv)
|
||||
// CHECK-NEXT: foo()
|
||||
|
|
Loading…
Reference in New Issue