diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2015-10-06 00:03:12 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2015-10-06 00:03:12 +0200 |
commit | f0657a6b172619c44d4942d93edb8fe071490c81 (patch) | |
tree | 0dc9a9fcc3f4ff16f11e85ea3d40ed97e0b03b8e /gcc/fortran | |
parent | 9c9ff2bc6885aa07d55ecef8248c08a8e14ff9b6 (diff) |
Merge branches/gcc-5-branch rev 228499.
Change-Id: I4e83b66fdc6bceb6b3b5f23c426b96f1e5618d1c
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 41 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 7 | ||||
-rw-r--r-- | gcc/fortran/io.c | 9 | ||||
-rw-r--r-- | gcc/fortran/parse.c | 11 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 2 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 23 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 1 |
7 files changed, 79 insertions, 15 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b2138b067b1..5575870da79 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,44 @@ +2015-10-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67802 + * decl.c (add_init_expr_to_sym): Numeric constant for character + length must be an INTEGER. + +2015-10-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67616 + * primary.c (gfc_match_structure_constructor): Use a possibly + host-associated symtree to prevent ICE. + +2015-10-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/66979 + * io.c (gfc_resolve_filepos): Check for a UNIT number. Add a nearby + missing 'return false'. + +2015-10-01 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/67721 + * trans-expr.c (gfc_trans_assignment_1): Remove the non-constantness + condition guarding deep copy. + +2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67614 + * resolve.c (gfc_resolve_code): Prevent ICE for invalid EXPR_NULL. + +2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67525 + * parse.c (match_deferred_characteristics): Remove an assert, which + allows an invalid SELECT TYPE selector to be detected. + +2015-09-21 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67615 + * resolve.c (gfc_resolve_code): Check for scalar expression in + arithmetic-if. + 2015-09-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67526 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c31180d3ef5..9e409bf4ea8 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1417,7 +1417,12 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus) /* Update initializer character length according symbol. */ else if (sym->ts.u.cl->length->expr_type == EXPR_CONSTANT) { - int len = mpz_get_si (sym->ts.u.cl->length->value.integer); + int len; + + if (!gfc_specification_expr (sym->ts.u.cl->length)) + return false; + + len = mpz_get_si (sym->ts.u.cl->length->value.integer); if (init->expr_type == EXPR_CONSTANT) gfc_set_constant_character_len (len, init, -1); diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index fe0886854e5..9fabeeb966a 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2516,12 +2516,21 @@ gfc_resolve_filepos (gfc_filepos *fp) if (!gfc_reference_st_label (fp->err, ST_LABEL_TARGET)) return false; + if (!fp->unit && (fp->iostat || fp->iomsg)) + { + locus where; + where = fp->iostat ? fp->iostat->where : fp->iomsg->where; + gfc_error ("UNIT number missing in statement at %L", &where); + return false; + } + if (fp->unit->expr_type == EXPR_CONSTANT && fp->unit->ts.type == BT_INTEGER && mpz_sgn (fp->unit->value.integer) < 0) { gfc_error ("UNIT number in statement at %L must be non-negative", &fp->unit->where); + return false; } return true; diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index f22b191ba7c..27ead210b50 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -3092,15 +3092,18 @@ match_deferred_characteristics (gfc_typespec * ts) static void check_function_result_typed (void) { - gfc_typespec* ts = &gfc_current_ns->proc_name->result->ts; + gfc_typespec ts; gcc_assert (gfc_current_state () == COMP_FUNCTION); - gcc_assert (ts->type != BT_UNKNOWN); + + if (!gfc_current_ns->proc_name->result) return; + + ts = gfc_current_ns->proc_name->result->ts; /* Check type-parameters, at the moment only CHARACTER lengths possible. */ /* TODO: Extend when KIND type parameters are implemented. */ - if (ts->type == BT_CHARACTER && ts->u.cl && ts->u.cl->length) - gfc_expr_check_typed (ts->u.cl->length, gfc_current_ns, true); + if (ts.type == BT_CHARACTER && ts.u.cl && ts.u.cl->length) + gfc_expr_check_typed (ts.u.cl->length, gfc_current_ns, true); } diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 59819ee9906..44d5e99734a 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2645,7 +2645,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) gfc_expr *e; gfc_symtree *symtree; - gfc_get_sym_tree (sym->name, NULL, &symtree, false); /* Can't fail */ + gfc_get_ha_sym_tree (sym->name, &symtree); e = gfc_get_expr (); e->symtree = symtree; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index da9d825d86d..eb70631373b 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -10230,15 +10230,22 @@ gfc_resolve_code (gfc_code *code, gfc_namespace *ns) } case EXEC_ARITHMETIC_IF: - if (t - && code->expr1->ts.type != BT_INTEGER - && code->expr1->ts.type != BT_REAL) - gfc_error ("Arithmetic IF statement at %L requires a numeric " - "expression", &code->expr1->where); + { + gfc_expr *e = code->expr1; + + gfc_resolve_expr (e); + if (e->expr_type == EXPR_NULL) + gfc_error ("Invalid NULL at %L", &e->where); - resolve_branch (code->label1, code); - resolve_branch (code->label2, code); - resolve_branch (code->label3, code); + if (t && (e->rank > 0 + || !(e->ts.type == BT_REAL || e->ts.type == BT_INTEGER))) + gfc_error ("Arithmetic IF statement at %L requires a scalar " + "REAL or INTEGER expression", &e->where); + + resolve_branch (code->label1, code); + resolve_branch (code->label2, code); + resolve_branch (code->label3, code); + } break; case EXEC_IF: diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 81279f8982a..bdc823fab25 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -8999,7 +8999,6 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, scalar_to_array = (expr2->ts.type == BT_DERIVED && expr2->ts.u.derived->attr.alloc_comp && !expr_is_variable (expr2) - && !gfc_is_constant_expr (expr2) && expr1->rank && !expr2->rank); scalar_to_array |= (expr1->ts.type == BT_DERIVED && expr1->rank |