+2022-02-27 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from master:
+ 2021-02-10 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/104329
+ * openmp.cc (resolve_omp_atomic): Defer extra-code assert after
+ other diagnostics.
+
2022-02-27 Tobias Burnus <tobias@codesourcery.com>
Backported from master:
gfc_omp_atomic_op aop
= (gfc_omp_atomic_op) (atomic_code->ext.omp_clauses->atomic_op
& GFC_OMP_ATOMIC_MASK);
- gfc_code *stmt = NULL, *capture_stmt = NULL;
+ gfc_code *stmt = NULL, *capture_stmt = NULL, *tailing_stmt = NULL;
gfc_expr *comp_cond = NULL;
locus *loc = NULL;
stmt = code;
capture_stmt = code->next;
}
- gcc_assert (!code->next->next);
+ /* Shall be NULL but can happen for invalid code. */
+ tailing_stmt = code->next->next;
}
else
{
stmt = code;
if (!atomic_code->ext.omp_clauses->compare && stmt->op != EXEC_ASSIGN)
goto unexpected;
- gcc_assert (!code->next);
+ /* Shall be NULL but can happen for invalid code. */
+ tailing_stmt = code->next;
}
if (comp_cond)
return;
}
+ /* Should be diagnosed above already. */
+ gcc_assert (tailing_stmt == NULL);
+
var = stmt->expr1->symtree->n.sym;
stmt_expr2 = is_conversion (stmt->expr2, true, true);
if (stmt_expr2 == NULL)
+2022-02-27 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from master:
+ 2021-02-10 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/104329
+ * gfortran.dg/gomp/atomic-28.f90: New test.
+
2022-02-27 Tobias Burnus <tobias@codesourcery.com>
Backported from master:
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/104329
+!
+! Contributed by G. Steinmetz
+!
+subroutine z1
+ character(:), allocatable :: x(:)
+ x = ['123']
+ !$omp atomic update
+ x = (x) ! { dg-error "OMP ATOMIC statement must set a scalar variable of intrinsic type" }
+end
+
+subroutine z2
+ character(:), allocatable :: x(:)
+ x = ['123']
+ !$omp atomic update
+ x = 'a' // x // 'e' ! { dg-error "OMP ATOMIC statement must set a scalar variable of intrinsic type" }
+end
+
+
+subroutine z3
+ character(:), allocatable :: x(:)
+ x = ['123']
+ !$omp atomic capture
+ x = 'a' // x // 'e' ! { dg-error "OMP ATOMIC statement must set a scalar variable of intrinsic type" }
+ x = x
+end