diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-02-16 23:40:32 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-02-16 23:40:32 +0100 |
commit | 83d9be558117c0dea6b12d3db4171eae1c90a2d7 (patch) | |
tree | 2928af1a64421d351d8d34be1829fa0f34927163 /gcc | |
parent | 019e0ae8e00068d14aeee7c3b9e54ec14d2a5dd9 (diff) | |
download | gcc-83d9be558117c0dea6b12d3db4171eae1c90a2d7.zip gcc-83d9be558117c0dea6b12d3db4171eae1c90a2d7.tar.gz gcc-83d9be558117c0dea6b12d3db4171eae1c90a2d7.tar.bz2 |
re PR fortran/84418 (ICE with fortran OpenMP linear (ref ()) clause)
PR fortran/84418
* trans-openmp.c (gfc_trans_omp_clauses): For OMP_CLAUSE_LINEAR_REF
kind set OMP_CLAUSE_LINEAR_STEP to TYPE_SIZE_UNIT times last_step.
* libgomp.fortran/pr84418-1.f90: New test.
* libgomp.fortran/pr84418-2.f90: New test.
From-SVN: r257771
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.c | 29 |
2 files changed, 35 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1c06bfd..445b9cc 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,10 @@ -2018-02-16 Dominique d'Humieres <dominiq@gcc.gnu.org> +2018-02-16 Jakub Jelinek <jakub@redhat.com> + + PR fortran/84418 + * trans-openmp.c (gfc_trans_omp_clauses): For OMP_CLAUSE_LINEAR_REF + kind set OMP_CLAUSE_LINEAR_STEP to TYPE_SIZE_UNIT times last_step. + +2018-02-16 Dominique d'Humieres <dominiq@gcc.gnu.org> PR fortran/84354 * decl.c (gfc_get_pdt_instance): Replace '%qs' with %qs. @@ -390,7 +396,7 @@ * trans-io.c (get_dtio_proc): Likewise. (transfer_expr): Fix whitespace. -2018-01-13 Thomas Koenig <tkoenig@gcc.gnu.org> +2018-01-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/83744 * dump-parse-tree.c (get_c_type_name): Remove extra line. @@ -414,7 +420,7 @@ * trans-array.c (is_pointer_array): Remove unconditional return of false for -fopenmp. -2018-01-13 Thomas Koenig <tkoenig@gcc.gnu.org> +2018-01-13 Thomas Koenig <tkoenig@gcc.gnu.org> <emsr@gcc.gnu.org> PR fortran/83803 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 4f5c385..795175d 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1949,9 +1949,32 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, } else { - tree type = gfc_typenode_for_spec (&n->sym->ts); - OMP_CLAUSE_LINEAR_STEP (node) - = fold_convert (type, last_step); + if (kind == OMP_CLAUSE_LINEAR_REF) + { + tree type; + if (n->sym->attr.flavor == FL_PROCEDURE) + { + type = gfc_get_function_type (n->sym); + type = build_pointer_type (type); + } + else + type = gfc_sym_type (n->sym); + if (POINTER_TYPE_P (type)) + type = TREE_TYPE (type); + /* Otherwise to be determined what exactly + should be done. */ + tree t = fold_convert (sizetype, last_step); + t = size_binop (MULT_EXPR, t, + TYPE_SIZE_UNIT (type)); + OMP_CLAUSE_LINEAR_STEP (node) = t; + } + else + { + tree type + = gfc_typenode_for_spec (&n->sym->ts); + OMP_CLAUSE_LINEAR_STEP (node) + = fold_convert (type, last_step); + } } if (n->sym->attr.dimension || n->sym->attr.allocatable) OMP_CLAUSE_LINEAR_ARRAY (node) = 1; |