diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 29 | ||||
-rw-r--r-- | gcc/fortran/cpp.c | 4 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 7 | ||||
-rw-r--r-- | gcc/fortran/scanner.c | 10 | ||||
-rw-r--r-- | gcc/fortran/target-memory.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-const.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 15 |
8 files changed, 59 insertions, 12 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index aaebe17fb51..5b003d81a99 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,32 @@ +2017-10-15 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/82372 + * fortran/scanner.c (last_error_char): New global variable. + (gfc_scanner_init_1): Set last_error_char to NULL. + (gfc_gobble_whitespace): If a character not printable or + not newline, issue an error. + +2017-10-13 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/81048 + * resolve.c (resolve_symbol): Ensure that derived type array + results get default initialization. + +2017-10-11 Nathan Sidwell <nathan@acm.org> + + * cpp.c (gfc_cpp_add_include_path): Update incpath_e names. + (gfc_cpp_add_include_path_after): Likewise. + +2017-10-10 Richard Sandiford <richard.sandiford@linaro.org> + + * target-memory.c (gfc_interpret_logical): Use wi::to_wide when + operating on trees as wide_ints. + * trans-const.c (gfc_conv_tree_to_mpz): Likewise. + * trans-expr.c (gfc_conv_cst_int_power): Likewise. + * trans-intrinsic.c (trans_this_image): Likewise. + (gfc_conv_intrinsic_bound): Likewise. + (conv_intrinsic_cobound): Likewise. + 2017-10-08 Steven G. Kargl <kargl@gcc.gnu.org> * check.c (gfc_check_x): Remove function. diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c index 4d1b56a0045..af8a69ca3f7 100644 --- a/gcc/fortran/cpp.c +++ b/gcc/fortran/cpp.c @@ -683,14 +683,14 @@ gfc_cpp_add_include_path (char *path, bool user_supplied) include path. Fortran does not define any system include paths. */ int cxx_aware = 0; - add_path (path, BRACKET, cxx_aware, user_supplied); + add_path (path, INC_BRACKET, cxx_aware, user_supplied); } void gfc_cpp_add_include_path_after (char *path, bool user_supplied) { int cxx_aware = 0; - add_path (path, AFTER, cxx_aware, user_supplied); + add_path (path, INC_AFTER, cxx_aware, user_supplied); } void diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index bd316344813..5e4988e6945 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -14967,7 +14967,12 @@ resolve_symbol (gfc_symbol *sym) if ((!a->save && !a->dummy && !a->pointer && !a->in_common && !a->use_assoc - && !a->result && !a->function) + && a->referenced + && !((a->function || a->result) + && (!a->dimension + || sym->ts.u.derived->attr.alloc_comp + || sym->ts.u.derived->attr.pointer_comp)) + && !(a->function && sym != sym->result)) || (a->dummy && a->intent == INTENT_OUT && !a->pointer)) apply_default_init (sym); else if (a->function && sym->result && a->access != ACCESS_PRIVATE diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 82f431da527..49decfac52a 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -80,6 +80,7 @@ static struct gfc_file_change size_t file_changes_cur, file_changes_count; size_t file_changes_allocated; +static gfc_char_t *last_error_char; /* Functions dealing with our wide characters (gfc_char_t) and sequences of such characters. */ @@ -269,6 +270,7 @@ gfc_scanner_init_1 (void) continue_line = 0; end_flag = 0; + last_error_char = NULL; } @@ -1700,6 +1702,14 @@ gfc_gobble_whitespace (void) } while (gfc_is_whitespace (c)); + if (!ISPRINT(c) && c != '\n' && last_error_char != gfc_current_locus.nextc) + { + char buf[20]; + last_error_char = gfc_current_locus.nextc; + snprintf (buf, 20, "%2.2X", c); + gfc_error_now ("Invalid character 0x%s at %C", buf); + } + gfc_current_locus = old_loc; } diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c index ceca3accd93..b2fe8eee01c 100644 --- a/gcc/fortran/target-memory.c +++ b/gcc/fortran/target-memory.c @@ -429,7 +429,7 @@ gfc_interpret_logical (int kind, unsigned char *buffer, size_t buffer_size, { tree t = native_interpret_expr (gfc_get_logical_type (kind), buffer, buffer_size); - *logical = wi::eq_p (t, 0) ? 0 : 1; + *logical = wi::to_wide (t) == 0 ? 0 : 1; return size_logical (kind); } diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 128d47d0fa3..62b85f738fc 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -211,7 +211,7 @@ gfc_conv_mpz_to_tree (mpz_t i, int kind) void gfc_conv_tree_to_mpz (mpz_t i, tree source) { - wi::to_mpz (source, i, TYPE_SIGN (TREE_TYPE (source))); + wi::to_mpz (wi::to_wide (source), i, TYPE_SIGN (TREE_TYPE (source))); } /* Converts a real constant into backend form. */ diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index d1b61b5228b..4e8bfc5d6f9 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2861,7 +2861,7 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs) HOST_WIDE_INT m; unsigned HOST_WIDE_INT n; int sgn; - wide_int wrhs = rhs; + wi::tree_to_wide_ref wrhs = wi::to_wide (rhs); /* If exponent is too large, we won't expand it anyway, so don't bother with large integer values. */ diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 9bc465e43d9..532d3ab237d 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2235,8 +2235,9 @@ trans_this_image (gfc_se * se, gfc_expr *expr) if (INTEGER_CST_P (dim_arg)) { - if (wi::ltu_p (dim_arg, 1) - || wi::gtu_p (dim_arg, GFC_TYPE_ARRAY_CORANK (TREE_TYPE (desc)))) + if (wi::ltu_p (wi::to_wide (dim_arg), 1) + || wi::gtu_p (wi::to_wide (dim_arg), + GFC_TYPE_ARRAY_CORANK (TREE_TYPE (desc)))) gfc_error ("%<dim%> argument of %s intrinsic at %L is not a valid " "dimension index", expr->value.function.isym->name, &expr->where); @@ -2657,8 +2658,9 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) if (INTEGER_CST_P (bound)) { if (((!as || as->type != AS_ASSUMED_RANK) - && wi::geu_p (bound, GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc)))) - || wi::gtu_p (bound, GFC_MAX_DIMENSIONS)) + && wi::geu_p (wi::to_wide (bound), + GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc)))) + || wi::gtu_p (wi::to_wide (bound), GFC_MAX_DIMENSIONS)) gfc_error ("%<dim%> argument of %s intrinsic at %L is not a valid " "dimension index", upper ? "UBOUND" : "LBOUND", &expr->where); @@ -2853,8 +2855,9 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr) if (INTEGER_CST_P (bound)) { - if (wi::ltu_p (bound, 1) - || wi::gtu_p (bound, GFC_TYPE_ARRAY_CORANK (TREE_TYPE (desc)))) + if (wi::ltu_p (wi::to_wide (bound), 1) + || wi::gtu_p (wi::to_wide (bound), + GFC_TYPE_ARRAY_CORANK (TREE_TYPE (desc)))) gfc_error ("%<dim%> argument of %s intrinsic at %L is not a valid " "dimension index", expr->value.function.isym->name, &expr->where); |