cchen added a comment. Herald added subscribers: sstefan1, yaxunl. @ABataev, the below test is extracted from Sollve test suite and Clang now emit:
test.c:17:35: error: subscripted value is not an array or pointer #pragma omp target update to( (([N][N])foo)[1:M] ) ^~~~~~~~~~~~~ test.c:17:5: error: expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update' #pragma omp target update to( (([N][N])foo)[1:M] ) This error message came from the `ActOnOMPArraySectionExpr` which is called inside `ParsePostfixExpressionSuffix`. The issue is that the base expression in `ActOnOMPArraySectionExpr` looks like: ParenExpr 0x122859be0 '<OpenMP array shaping type>' lvalue `-OMPArrayShapingExpr 0x122859b98 '<OpenMP array shaping type>' lvalue |-IntegerLiteral 0x122859b38 'int' 5 |-IntegerLiteral 0x122859b58 'int' 5 `-DeclRefExpr 0x122859b78 'int *' lvalue Var 0x1228599d0 'foo' 'int *' which is not a base that we would expect in an array section expr. I've tried relaxing the base type check in `ActOnOMPArraySectionExpr` but not sure it's the way to go. (or should I just extract the DeclReExpr from ArrayShapingExpr before calling `ActOnOMPArraySectionExpr`?) #define N 5 #define M 3 int main(void) { int tmp[N][N]; for(int i=0; i<N; i++) for(int j=0; j<N; j++) tmp[i][j] = N*i + j; int *foo = &tmp[0][0]; // This compiles just fine //#pragma omp target update to( ([N][N])foo ) // This is rejected by the compiler #pragma omp target update to( (([N][N])foo)[1:M] ) } Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74144/new/ https://reviews.llvm.org/D74144 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits