diff options
author | Yiran Wang <yiran@google.com> | 2015-06-23 15:33:17 -0700 |
---|---|---|
committer | Yiran Wang <yiran@google.com> | 2015-06-29 10:56:28 -0700 |
commit | 1d9fec7937f45dde5e04cac966a2d9a12f2fc15a (patch) | |
tree | 3fbcd18a379a05fd6d43491a107e1f36bc61b185 /gcc-4.9/gcc/fortran | |
parent | f378ebf14df0952eae870c9865bab8326aa8f137 (diff) | |
download | toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.gz toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.bz2 toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.zip |
Synchronize with google/gcc-4_9 to r224707 (from r214835)
Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d
Diffstat (limited to 'gcc-4.9/gcc/fortran')
-rw-r--r-- | gcc-4.9/gcc/fortran/ChangeLog | 65 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/interface.c | 95 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/module.c | 5 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/resolve.c | 14 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/trans-array.c | 7 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/trans-decl.c | 5 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/trans-expr.c | 2 | ||||
-rw-r--r-- | gcc-4.9/gcc/fortran/trans-openmp.c | 22 |
8 files changed, 156 insertions, 59 deletions
diff --git a/gcc-4.9/gcc/fortran/ChangeLog b/gcc-4.9/gcc/fortran/ChangeLog index 9f4bec74e..3828f1ab1 100644 --- a/gcc-4.9/gcc/fortran/ChangeLog +++ b/gcc-4.9/gcc/fortran/ChangeLog @@ -1,3 +1,68 @@ +2015-01-14 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-01-13 Jakub Jelinek <jakub@redhat.com> + + PR fortran/64528 + * trans-decl.c (create_function_arglist): Don't set TREE_READONLY + on dummy args with VALUE attribute. + +2015-01-12 Janus Weil <janus@gcc.gnu.org> + + Backport from mainline + PR fortran/63733 + * interface.c (gfc_extend_expr): Look for type-bound operators before + non-typebound ones. + +2015-01-08 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/56867 + * trans-array.c (gfc_conv_resolve_dependencies): Also check + dependencies when there may be substrings of character arrays. + +2014-12-23 Janus Weil <janus@gcc.gnu.org> + + Backport from mainline + PR fortran/64244 + * resolve.c (resolve_typebound_call): New argument to pass out the + non-overridable attribute of the specific procedure. + (resolve_typebound_subroutine): Get overridable flag from + resolve_typebound_call. + +2014-11-28 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2014-11-24 Jakub Jelinek <jakub@redhat.com> + + PR fortran/63938 + * trans-openmp.c (gfc_trans_omp_atomic): Make sure lhsaddr is + simple enough for goa_lhs_expr_p. + +2014-10-30 Release Manager + + * GCC 4.9.2 released. + +2014-10-10 Jakub Jelinek <jakub@redhat.com> + + PR fortran/59488 + * trans-openmp.c (gfc_omp_predetermined_sharing): Return + OMP_CLAUSE_DEFAULT_SHARED for parameters or vtables. + +2014-09-03 Marek Polacek <polacek@redhat.com> + + Backport from trunk + PR fortran/62270 + * interface.c (compare_parameter): Fix condition. + * trans-expr.c (gfc_conv_procedure_call): Likewise. + +2014-08-29 Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> + + Backport from trunk + PR fortran/62215 + * module.c (gfc_dump_module): Unlink old module file before + renaming new one. + 2014-08-21 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/gcc-4.9/gcc/fortran/interface.c b/gcc-4.9/gcc/fortran/interface.c index 67548c062..f24641c1e 100644 --- a/gcc-4.9/gcc/fortran/interface.c +++ b/gcc-4.9/gcc/fortran/interface.c @@ -2014,7 +2014,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, if (formal->ts.type == BT_CLASS && formal->attr.class_ok && actual->expr_type != EXPR_NULL && ((CLASS_DATA (formal)->attr.class_pointer - && !formal->attr.intent == INTENT_IN) + && formal->attr.intent != INTENT_IN) || CLASS_DATA (formal)->attr.allocatable)) { if (actual->ts.type != BT_CLASS) @@ -3675,6 +3675,8 @@ gfc_extend_expr (gfc_expr *e) gfc_user_op *uop; gfc_intrinsic_op i; const char *gname; + gfc_typebound_proc* tbo; + gfc_expr* tb_base; sym = NULL; @@ -3691,6 +3693,48 @@ gfc_extend_expr (gfc_expr *e) i = fold_unary_intrinsic (e->value.op.op); + /* See if we find a matching type-bound operator. */ + if (i == INTRINSIC_USER) + tbo = matching_typebound_op (&tb_base, actual, + i, e->value.op.uop->name, &gname); + else + switch (i) + { +#define CHECK_OS_COMPARISON(comp) \ + case INTRINSIC_##comp: \ + case INTRINSIC_##comp##_OS: \ + tbo = matching_typebound_op (&tb_base, actual, \ + INTRINSIC_##comp, NULL, &gname); \ + if (!tbo) \ + tbo = matching_typebound_op (&tb_base, actual, \ + INTRINSIC_##comp##_OS, NULL, &gname); \ + break; + CHECK_OS_COMPARISON(EQ) + CHECK_OS_COMPARISON(NE) + CHECK_OS_COMPARISON(GT) + CHECK_OS_COMPARISON(GE) + CHECK_OS_COMPARISON(LT) + CHECK_OS_COMPARISON(LE) +#undef CHECK_OS_COMPARISON + + default: + tbo = matching_typebound_op (&tb_base, actual, i, NULL, &gname); + break; + } + + /* If there is a matching typebound-operator, replace the expression with + a call to it and succeed. */ + if (tbo) + { + gcc_assert (tb_base); + build_compcall_for_operator (e, actual, tb_base, tbo, gname); + + if (!gfc_resolve_expr (e)) + return MATCH_ERROR; + else + return MATCH_YES; + } + if (i == INTRINSIC_USER) { for (ns = gfc_current_ns; ns; ns = ns->parent) @@ -3741,58 +3785,9 @@ gfc_extend_expr (gfc_expr *e) if (sym == NULL) { - gfc_typebound_proc* tbo; - gfc_expr* tb_base; - - /* See if we find a matching type-bound operator. */ - if (i == INTRINSIC_USER) - tbo = matching_typebound_op (&tb_base, actual, - i, e->value.op.uop->name, &gname); - else - switch (i) - { -#define CHECK_OS_COMPARISON(comp) \ - case INTRINSIC_##comp: \ - case INTRINSIC_##comp##_OS: \ - tbo = matching_typebound_op (&tb_base, actual, \ - INTRINSIC_##comp, NULL, &gname); \ - if (!tbo) \ - tbo = matching_typebound_op (&tb_base, actual, \ - INTRINSIC_##comp##_OS, NULL, &gname); \ - break; - CHECK_OS_COMPARISON(EQ) - CHECK_OS_COMPARISON(NE) - CHECK_OS_COMPARISON(GT) - CHECK_OS_COMPARISON(GE) - CHECK_OS_COMPARISON(LT) - CHECK_OS_COMPARISON(LE) -#undef CHECK_OS_COMPARISON - - default: - tbo = matching_typebound_op (&tb_base, actual, i, NULL, &gname); - break; - } - - /* If there is a matching typebound-operator, replace the expression with - a call to it and succeed. */ - if (tbo) - { - bool result; - - gcc_assert (tb_base); - build_compcall_for_operator (e, actual, tb_base, tbo, gname); - - result = gfc_resolve_expr (e); - if (!result) - return MATCH_ERROR; - - return MATCH_YES; - } - /* Don't use gfc_free_actual_arglist(). */ free (actual->next); free (actual); - return MATCH_NO; } diff --git a/gcc-4.9/gcc/fortran/module.c b/gcc-4.9/gcc/fortran/module.c index 2bfe17784..f50c5b740 100644 --- a/gcc-4.9/gcc/fortran/module.c +++ b/gcc-4.9/gcc/fortran/module.c @@ -6072,7 +6072,10 @@ gfc_dump_module (const char *name, int dump_flag) || crc_old != crc) { /* Module file have changed, replace the old one. */ - if (rename (filename_tmp, filename)) + if (unlink (filename) && errno != ENOENT) + gfc_fatal_error ("Can't delete module file '%s': %s", filename, + xstrerror (errno)); + if (rename (filename_tmp, filename)) gfc_fatal_error ("Can't rename module file '%s' to '%s': %s", filename_tmp, filename, xstrerror (errno)); } diff --git a/gcc-4.9/gcc/fortran/resolve.c b/gcc-4.9/gcc/fortran/resolve.c index c959f5d95..a23f6d44c 100644 --- a/gcc-4.9/gcc/fortran/resolve.c +++ b/gcc-4.9/gcc/fortran/resolve.c @@ -5590,7 +5590,7 @@ success: /* Resolve a call to a type-bound subroutine. */ static bool -resolve_typebound_call (gfc_code* c, const char **name) +resolve_typebound_call (gfc_code* c, const char **name, bool *overridable) { gfc_actual_arglist* newactual; gfc_symtree* target; @@ -5614,6 +5614,10 @@ resolve_typebound_call (gfc_code* c, const char **name) if (!resolve_typebound_generic_call (c->expr1, name)) return false; + /* Pass along the NON_OVERRIDABLE attribute of the specific TBP. */ + if (overridable) + *overridable = !c->expr1->value.compcall.tbp->non_overridable; + /* Transform into an ordinary EXEC_CALL for now. */ if (!resolve_typebound_static (c->expr1, &target, &newactual)) @@ -5873,7 +5877,7 @@ resolve_typebound_subroutine (gfc_code *code) if (c->ts.u.derived == NULL) c->ts.u.derived = gfc_find_derived_vtab (declared); - if (!resolve_typebound_call (code, &name)) + if (!resolve_typebound_call (code, &name, NULL)) return false; /* Use the generic name if it is there. */ @@ -5905,7 +5909,7 @@ resolve_typebound_subroutine (gfc_code *code) } if (st == NULL) - return resolve_typebound_call (code, NULL); + return resolve_typebound_call (code, NULL, NULL); if (!resolve_ref (code->expr1)) return false; @@ -5918,10 +5922,10 @@ resolve_typebound_subroutine (gfc_code *code) || (!class_ref && st->n.sym->ts.type != BT_CLASS)) { gfc_free_ref_list (new_ref); - return resolve_typebound_call (code, NULL); + return resolve_typebound_call (code, NULL, NULL); } - if (!resolve_typebound_call (code, &name)) + if (!resolve_typebound_call (code, &name, &overridable)) { gfc_free_ref_list (new_ref); return false; diff --git a/gcc-4.9/gcc/fortran/trans-array.c b/gcc-4.9/gcc/fortran/trans-array.c index a36db45c0..8e5bea191 100644 --- a/gcc-4.9/gcc/fortran/trans-array.c +++ b/gcc-4.9/gcc/fortran/trans-array.c @@ -4350,6 +4350,13 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, && ss_expr->rank) nDepend = gfc_check_dependency (dest_expr, ss_expr, true); + /* Check for cases like c(:)(1:2) = c(2)(2:3) */ + if (!nDepend && dest_expr->rank > 0 + && dest_expr->ts.type == BT_CHARACTER + && ss_expr->expr_type == EXPR_VARIABLE) + + nDepend = gfc_check_dependency (dest_expr, ss_expr, false); + continue; } diff --git a/gcc-4.9/gcc/fortran/trans-decl.c b/gcc-4.9/gcc/fortran/trans-decl.c index 2b0667960..4b3e89b79 100644 --- a/gcc-4.9/gcc/fortran/trans-decl.c +++ b/gcc-4.9/gcc/fortran/trans-decl.c @@ -2262,8 +2262,9 @@ create_function_arglist (gfc_symbol * sym) /* Fill in arg stuff. */ DECL_CONTEXT (parm) = fndecl; DECL_ARG_TYPE (parm) = TREE_VALUE (typelist); - /* All implementation args are read-only. */ - TREE_READONLY (parm) = 1; + /* All implementation args except for VALUE are read-only. */ + if (!f->sym->attr.value) + TREE_READONLY (parm) = 1; if (POINTER_TYPE_P (type) && (!f->sym->attr.proc_pointer && f->sym->attr.flavor != FL_PROCEDURE)) diff --git a/gcc-4.9/gcc/fortran/trans-expr.c b/gcc-4.9/gcc/fortran/trans-expr.c index 824ab785b..2b06304cb 100644 --- a/gcc-4.9/gcc/fortran/trans-expr.c +++ b/gcc-4.9/gcc/fortran/trans-expr.c @@ -4409,7 +4409,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, && e->expr_type == EXPR_VARIABLE && (!e->ref || (e->ref->type == REF_ARRAY - && !e->ref->u.ar.type != AR_FULL)) + && e->ref->u.ar.type != AR_FULL)) && e->symtree->n.sym->attr.optional) { tmp = fold_build3_loc (input_location, COND_EXPR, diff --git a/gcc-4.9/gcc/fortran/trans-openmp.c b/gcc-4.9/gcc/fortran/trans-openmp.c index 548b5d3a4..3b0e6e9e9 100644 --- a/gcc-4.9/gcc/fortran/trans-openmp.c +++ b/gcc-4.9/gcc/fortran/trans-openmp.c @@ -135,6 +135,16 @@ gfc_omp_predetermined_sharing (tree decl) if (GFC_DECL_RESULT (decl) && ! DECL_HAS_VALUE_EXPR_P (decl)) return OMP_CLAUSE_DEFAULT_SHARED; + /* These are either array or derived parameters, or vtables. + In the former cases, the OpenMP standard doesn't consider them to be + variables at all (they can't be redefined), but they can nevertheless appear + in parallel/task regions and for default(none) purposes treat them as shared. + For vtables likely the same handling is desirable. */ + if (TREE_CODE (decl) == VAR_DECL + && TREE_READONLY (decl) + && TREE_STATIC (decl)) + return OMP_CLAUSE_DEFAULT_SHARED; + return OMP_CLAUSE_DEFAULT_UNSPECIFIED; } @@ -2673,6 +2683,18 @@ gfc_trans_omp_atomic (gfc_code *code) } lhsaddr = save_expr (lhsaddr); + if (TREE_CODE (lhsaddr) != SAVE_EXPR + && (TREE_CODE (lhsaddr) != ADDR_EXPR + || TREE_CODE (TREE_OPERAND (lhsaddr, 0)) != VAR_DECL)) + { + /* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize + it even after unsharing function body. */ + tree var = create_tmp_var_raw (TREE_TYPE (lhsaddr), NULL); + DECL_CONTEXT (var) = current_function_decl; + lhsaddr = build4 (TARGET_EXPR, TREE_TYPE (lhsaddr), var, lhsaddr, + NULL_TREE, NULL_TREE); + } + rhs = gfc_evaluate_now (rse.expr, &block); if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK) |