aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r--gcc/fortran/trans-openmp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 8da55d3b467..9642a7d6b29 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -3255,6 +3255,19 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
inits.safe_push (e);
}
+ if (dovar_found == 2
+ && op == EXEC_OMP_SIMD
+ && collapse == 1
+ && !simple)
+ {
+ for (tmp = omp_clauses; tmp; tmp = OMP_CLAUSE_CHAIN (tmp))
+ if (OMP_CLAUSE_CODE (tmp) == OMP_CLAUSE_LINEAR
+ && OMP_CLAUSE_DECL (tmp) == dovar)
+ {
+ OMP_CLAUSE_LINEAR_NO_COPYIN (tmp) = 1;
+ break;
+ }
+ }
if (!dovar_found)
{
if (op == EXEC_OMP_SIMD)
@@ -3263,6 +3276,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
{
tmp = build_omp_clause (input_location, OMP_CLAUSE_LINEAR);
OMP_CLAUSE_LINEAR_STEP (tmp) = step;
+ OMP_CLAUSE_LINEAR_NO_COPYIN (tmp) = 1;
}
else
tmp = build_omp_clause (input_location, OMP_CLAUSE_LASTPRIVATE);
@@ -3330,7 +3344,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
else if (collapse == 1)
{
tmp = build_omp_clause (input_location, OMP_CLAUSE_LINEAR);
- OMP_CLAUSE_LINEAR_STEP (tmp) = step;
+ OMP_CLAUSE_LINEAR_STEP (tmp) = build_int_cst (type, 1);
OMP_CLAUSE_LINEAR_NO_COPYIN (tmp) = 1;
OMP_CLAUSE_LINEAR_NO_COPYOUT (tmp) = 1;
}