Index: gcc/gcc/fortran/openmp.c |
diff --git a/gcc/gcc/fortran/openmp.c b/gcc/gcc/fortran/openmp.c |
index b75a1e844cb42ab2d9c459f907785e313ba1c8a2..bae0d2572d24eb300b9289fb43985ac811fc9a3f 100644 |
--- a/gcc/gcc/fortran/openmp.c |
+++ b/gcc/gcc/fortran/openmp.c |
@@ -1,5 +1,5 @@ |
/* OpenMP directive matching and resolving. |
- Copyright (C) 2005, 2006, 2007, 2008 |
+ Copyright (C) 2005, 2006, 2007, 2008, 2010 |
Free Software Foundation, Inc. |
Contributed by Jakub Jelinek |
@@ -812,6 +812,8 @@ resolve_omp_clauses (gfc_code *code) |
if (el) |
continue; |
} |
+ if (n->sym->attr.proc_pointer) |
+ continue; |
} |
gfc_error ("Object '%s' is not a variable at %L", n->sym->name, |
&code->loc); |
@@ -873,7 +875,7 @@ resolve_omp_clauses (gfc_code *code) |
if (!n->sym->attr.threadprivate) |
gfc_error ("Non-THREADPRIVATE object '%s' in COPYIN clause" |
" at %L", n->sym->name, &code->loc); |
- if (n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp) |
+ if (n->sym->ts.type == BT_DERIVED && n->sym->ts.u.derived->attr.alloc_comp) |
gfc_error ("COPYIN clause object '%s' at %L has ALLOCATABLE components", |
n->sym->name, &code->loc); |
} |
@@ -884,7 +886,7 @@ resolve_omp_clauses (gfc_code *code) |
if (n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE) |
gfc_error ("Assumed size array '%s' in COPYPRIVATE clause " |
"at %L", n->sym->name, &code->loc); |
- if (n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp) |
+ if (n->sym->ts.type == BT_DERIVED && n->sym->ts.u.derived->attr.alloc_comp) |
gfc_error ("COPYPRIVATE clause object '%s' at %L has ALLOCATABLE components", |
n->sym->name, &code->loc); |
} |
@@ -916,7 +918,7 @@ resolve_omp_clauses (gfc_code *code) |
n->sym->name, name, &code->loc); |
/* Variables in REDUCTION-clauses must be of intrinsic type (flagged below). */ |
if ((list < OMP_LIST_REDUCTION_FIRST || list > OMP_LIST_REDUCTION_LAST) && |
- n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp) |
+ n->sym->ts.type == BT_DERIVED && n->sym->ts.u.derived->attr.alloc_comp) |
gfc_error ("%s clause object '%s' has ALLOCATABLE components at %L", |
name, n->sym->name, &code->loc); |
if (n->sym->attr.cray_pointer) |
@@ -1073,20 +1075,20 @@ resolve_omp_atomic (gfc_code *code) |
gcc_assert (code->op == EXEC_ASSIGN); |
gcc_assert (code->next == NULL); |
- if (code->expr->expr_type != EXPR_VARIABLE |
- || code->expr->symtree == NULL |
- || code->expr->rank != 0 |
- || (code->expr->ts.type != BT_INTEGER |
- && code->expr->ts.type != BT_REAL |
- && code->expr->ts.type != BT_COMPLEX |
- && code->expr->ts.type != BT_LOGICAL)) |
+ if (code->expr1->expr_type != EXPR_VARIABLE |
+ || code->expr1->symtree == NULL |
+ || code->expr1->rank != 0 |
+ || (code->expr1->ts.type != BT_INTEGER |
+ && code->expr1->ts.type != BT_REAL |
+ && code->expr1->ts.type != BT_COMPLEX |
+ && code->expr1->ts.type != BT_LOGICAL)) |
{ |
gfc_error ("!$OMP ATOMIC statement must set a scalar variable of " |
"intrinsic type at %L", &code->loc); |
return; |
} |
- var = code->expr->symtree->n.sym; |
+ var = code->expr1->symtree->n.sym; |
expr2 = is_conversion (code->expr2, false); |
if (expr2 == NULL) |
expr2 = code->expr2; |
@@ -1367,7 +1369,6 @@ gfc_resolve_omp_parallel_blocks (gfc_code *code, gfc_namespace *ns) |
void |
gfc_resolve_do_iterator (gfc_code *code, gfc_symbol *sym) |
{ |
- struct omp_context *ctx; |
int i = omp_current_do_collapse; |
gfc_code *c = omp_current_do_code; |
@@ -1386,21 +1387,21 @@ gfc_resolve_do_iterator (gfc_code *code, gfc_symbol *sym) |
c = c->block->next; |
} |
- for (ctx = omp_current_ctx; ctx; ctx = ctx->previous) |
- { |
- if (pointer_set_contains (ctx->sharing_clauses, sym)) |
- continue; |
+ if (omp_current_ctx == NULL) |
+ return; |
- if (! pointer_set_insert (ctx->private_iterators, sym)) |
- { |
- gfc_omp_clauses *omp_clauses = ctx->code->ext.omp_clauses; |
- gfc_namelist *p; |
+ if (pointer_set_contains (omp_current_ctx->sharing_clauses, sym)) |
+ return; |
- p = gfc_get_namelist (); |
- p->sym = sym; |
- p->next = omp_clauses->lists[OMP_LIST_PRIVATE]; |
- omp_clauses->lists[OMP_LIST_PRIVATE] = p; |
- } |
+ if (! pointer_set_insert (omp_current_ctx->private_iterators, sym)) |
+ { |
+ gfc_omp_clauses *omp_clauses = omp_current_ctx->code->ext.omp_clauses; |
+ gfc_namelist *p; |
+ |
+ p = gfc_get_namelist (); |
+ p->sym = sym; |
+ p->next = omp_clauses->lists[OMP_LIST_PRIVATE]; |
+ omp_clauses->lists[OMP_LIST_PRIVATE] = p; |
} |
} |
@@ -1504,6 +1505,9 @@ resolve_omp_do (gfc_code *code) |
void |
gfc_resolve_omp_directive (gfc_code *code, gfc_namespace *ns ATTRIBUTE_UNUSED) |
{ |
+ if (code->op != EXEC_OMP_ATOMIC) |
+ gfc_maybe_initialize_eh (); |
+ |
switch (code->op) |
{ |
case EXEC_OMP_DO: |