diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2019-05-10 07:59:42 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2019-05-10 07:59:42 +0000 |
commit | 0a52429609a9570149af903c231c25f17da79b15 (patch) | |
tree | 5949919936e24cc45ea5df3794892250570d0ba2 /gcc/fortran/decl.c | |
parent | e965aaf6027f52020992279f59ed166805c33d55 (diff) | |
download | gcc-0a52429609a9570149af903c231c25f17da79b15.zip gcc-0a52429609a9570149af903c231c25f17da79b15.tar.gz gcc-0a52429609a9570149af903c231c25f17da79b15.tar.bz2 |
re PR fortran/90093 (Extended C interop: optional argument incorrectly identified as PRESENT)
2019-05-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/90093
* trans-decl.c (convert_CFI_desc): Test that the dummy is
present before doing any of the conversions.
PR fortran/90352
* decl.c (gfc_verify_c_interop_param): Restore the error for
charlen > 1 actual arguments passed to bind(C) procs.
Clean up trailing white space.
PR fortran/90355
* trans-array.c (gfc_trans_create_temp_array): Set the 'span'
field to the element length for all types.
(gfc_conv_expr_descriptor): The force_no_tmp flag is used to
prevent temporary creation, especially for substrings.
* trans-decl.c (gfc_trans_deferred_vars): Rather than assert
that the backend decl for the string length is non-null, use it
as a condition before calling gfc_trans_vla_type_sizes.
* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): 'force_no_tmp'
is set before calling gfc_conv_expr_descriptor.
* trans.c (get_array_span): Move the code for extracting 'span'
from gfc_build_array_ref to this function. This is specific to
descriptors that are component and indirect references.
* trans.h : Add the force_no_tmp flag bitfield to gfc_se.
2019-05-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/90093
* gfortran.dg/ISO_Fortran_binding_12.f90: New test.
* gfortran.dg/ISO_Fortran_binding_12.c: Supplementary code.
PR fortran/90352
* gfortran.dg/iso_c_binding_char_1.f90: New test.
PR fortran/90355
* gfortran.dg/ISO_Fortran_binding_4.f90: Add 'substr' to test
the direct passing of substrings as descriptors to bind(C).
* gfortran.dg/assign_10.f90: Increase the tree_dump count of
'atmp' to account for the setting of the 'span' field.
* gfortran.dg/transpose_optimization_2.f90: Ditto.
From-SVN: r271057
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 66f1094..1c785a4 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -406,7 +406,7 @@ match_data_constant (gfc_expr **result) contains the right constant expression. Check here. */ if ((*result)->symtree == NULL && (*result)->expr_type == EXPR_CONSTANT - && ((*result)->ts.type == BT_INTEGER + && ((*result)->ts.type == BT_INTEGER || (*result)->ts.type == BT_REAL)) return m; @@ -1493,19 +1493,18 @@ gfc_verify_c_interop_param (gfc_symbol *sym) /* Character strings are only C interoperable if they have a length of 1. */ - if (sym->ts.type == BT_CHARACTER) + if (sym->ts.type == BT_CHARACTER && !sym->attr.dimension) { gfc_charlen *cl = sym->ts.u.cl; if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT || mpz_cmp_si (cl->length->value.integer, 1) != 0) { - if (!gfc_notify_std (GFC_STD_F2018, - "Character argument %qs at %L " - "must be length 1 because " - "procedure %qs is BIND(C)", - sym->name, &sym->declared_at, - sym->ns->proc_name->name)) - retval = false; + gfc_error ("Character argument %qs at %L " + "must be length 1 because " + "procedure %qs is BIND(C)", + sym->name, &sym->declared_at, + sym->ns->proc_name->name); + retval = false; } } @@ -6074,7 +6073,7 @@ static bool in_module_or_interface(void) { if (gfc_current_state () == COMP_MODULE - || gfc_current_state () == COMP_SUBMODULE + || gfc_current_state () == COMP_SUBMODULE || gfc_current_state () == COMP_INTERFACE) return true; @@ -6085,7 +6084,7 @@ in_module_or_interface(void) gfc_state_data *p; for (p = gfc_state_stack->previous; p ; p = p->previous) { - if (p->state == COMP_MODULE || p->state == COMP_SUBMODULE + if (p->state == COMP_MODULE || p->state == COMP_SUBMODULE || p->state == COMP_INTERFACE) return true; } @@ -6304,7 +6303,7 @@ gfc_match_formal_arglist (gfc_symbol *progname, int st_flag, } if (gfc_match_char (')') == MATCH_YES) - { + { if (typeparam) { gfc_error_now ("A type parameter list is required at %C"); @@ -7489,7 +7488,7 @@ gfc_match_entry (void) if (!gfc_add_is_bind_c (&(entry->attr), entry->name, &(entry->declared_at), 1)) return MATCH_ERROR; - + } if (!gfc_current_ns->parent |