Mercurial > hg > CbC > CbC_gcc
diff gcc/fortran/trans-openmp.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/gcc/fortran/trans-openmp.c Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/fortran/trans-openmp.c Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* OpenMP directive translation -- generate GCC trees from gfc_code. - Copyright (C) 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. Contributed by Jakub Jelinek <jakub@redhat.com> This file is part of GCC. @@ -413,7 +413,7 @@ { tem = fold_convert (pvoid_type_node, tem); tem = fold_build2_loc (input_location, NE_EXPR, - boolean_type_node, tem, + logical_type_node, tem, null_pointer_node); then_b = build3_loc (input_location, COND_EXPR, void_type_node, tem, then_b, @@ -540,7 +540,7 @@ GFC_DESCRIPTOR_TYPE_P (type) ? gfc_conv_descriptor_data_get (outer) : outer); tem = unshare_expr (tem); - cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, tem, null_pointer_node); gfc_add_expr_to_block (&block, build3_loc (input_location, COND_EXPR, @@ -646,7 +646,7 @@ build_zero_cst (TREE_TYPE (dest))); else_b = gfc_finish_block (&cond_block); - cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, unshare_expr (srcptr), null_pointer_node); gfc_add_expr_to_block (&block, build3_loc (input_location, COND_EXPR, @@ -699,7 +699,7 @@ GFC_DESCRIPTOR_TYPE_P (type) ? gfc_conv_descriptor_data_get (dest) : dest); tem = unshare_expr (tem); - cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, tem, null_pointer_node); tem = build3_loc (input_location, COND_EXPR, void_type_node, cond, then_b, build_empty_stmt (input_location)); @@ -739,7 +739,7 @@ destptr = fold_convert (pvoid_type_node, destptr); gfc_add_modify (&cond_block, ptr, destptr); - nonalloc = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, + nonalloc = fold_build2_loc (input_location, EQ_EXPR, logical_type_node, destptr, null_pointer_node); cond = nonalloc; if (GFC_DESCRIPTOR_TYPE_P (type)) @@ -755,11 +755,11 @@ tem = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, tem, gfc_conv_descriptor_lbound_get (dest, rank)); - tem = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + tem = fold_build2_loc (input_location, NE_EXPR, logical_type_node, tem, gfc_conv_descriptor_ubound_get (dest, rank)); cond = fold_build2_loc (input_location, TRUTH_ORIF_EXPR, - boolean_type_node, cond, tem); + logical_type_node, cond, tem); } } @@ -835,7 +835,7 @@ } else_b = gfc_finish_block (&cond_block); - cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, unshare_expr (srcptr), null_pointer_node); gfc_add_expr_to_block (&block, build3_loc (input_location, COND_EXPR, @@ -1028,7 +1028,7 @@ GFC_DESCRIPTOR_TYPE_P (type) ? gfc_conv_descriptor_data_get (decl) : decl); tem = unshare_expr (tem); - tree cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + tree cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, tem, null_pointer_node); tem = build3_loc (input_location, COND_EXPR, void_type_node, cond, then_b, build_empty_stmt (input_location)); @@ -1129,7 +1129,7 @@ tem = gfc_conv_descriptor_data_get (decl); tem = fold_convert (pvoid_type_node, tem); cond = fold_build2_loc (input_location, NE_EXPR, - boolean_type_node, tem, null_pointer_node); + logical_type_node, tem, null_pointer_node); gfc_add_expr_to_block (&block, build3_loc (input_location, COND_EXPR, void_type_node, cond, then_b, else_b)); @@ -1623,6 +1623,7 @@ intrinsic_sym.attr.referenced = 1; intrinsic_sym.attr.intrinsic = 1; intrinsic_sym.attr.function = 1; + intrinsic_sym.attr.implicit_type = 1; intrinsic_sym.result = &intrinsic_sym; intrinsic_sym.declared_at = where; @@ -1948,9 +1949,32 @@ } 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; @@ -2155,7 +2179,7 @@ tem = gfc_conv_descriptor_data_get (decl); tem = fold_convert (pvoid_type_node, tem); cond = fold_build2_loc (input_location, NE_EXPR, - boolean_type_node, + logical_type_node, tem, null_pointer_node); gfc_add_expr_to_block (block, build3_loc (input_location, @@ -2871,6 +2895,16 @@ c = build_omp_clause (where.lb->location, OMP_CLAUSE_AUTO); omp_clauses = gfc_trans_add_clause (c, omp_clauses); } + if (clauses->if_present) + { + c = build_omp_clause (where.lb->location, OMP_CLAUSE_IF_PRESENT); + omp_clauses = gfc_trans_add_clause (c, omp_clauses); + } + if (clauses->finalize) + { + c = build_omp_clause (where.lb->location, OMP_CLAUSE_FINALIZE); + omp_clauses = gfc_trans_add_clause (c, omp_clauses); + } if (clauses->independent) { c = build_omp_clause (where.lb->location, OMP_CLAUSE_INDEPENDENT); @@ -3599,7 +3633,7 @@ /* The condition should not be folded. */ TREE_VEC_ELT (cond, i) = build2_loc (input_location, simple > 0 ? LE_EXPR : GE_EXPR, - boolean_type_node, dovar, to); + logical_type_node, dovar, to); TREE_VEC_ELT (incr, i) = fold_build2_loc (input_location, PLUS_EXPR, type, dovar, step); TREE_VEC_ELT (incr, i) = fold_build2_loc (input_location, @@ -3626,7 +3660,7 @@ build_int_cst (type, 0)); /* The condition should not be folded. */ TREE_VEC_ELT (cond, i) = build2_loc (input_location, LT_EXPR, - boolean_type_node, + logical_type_node, count, tmp); TREE_VEC_ELT (incr, i) = fold_build2_loc (input_location, PLUS_EXPR, type, count,