aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-19Work around bootstrap failure in Fortran front end.Sandra Loosemore1-0/+4
Switching the C++ front end to lower loops the same was as the C front end triggered this error when bootstrapping the Fortran front end: /path/to/gcc/fortran/interface.c:3546:12: error: '*new_arg' may be used uninitialized [-Werror=maybe-uninitialized] 3546 | new_arg[i]->next = NULL; | ~~~~~~~~~^ Work around this by adding an assertion, which seems appropriate for documentation and good coding practices anyway. 2020-08-12 Sandra Loosemore <sandra@codesourcery.com> gcc/fortran/ * interface.c (gfc_compare_actual_formal): Add assertion after main processing loop to silence maybe-uninitialized error.
2020-08-30 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>José Rui Faustino de Sousa1-1/+4
gcc/fortran/ChangeLog: PR fortran/94110 * interface.c (gfc_compare_actual_formal): Add code to also raise the actual argument cannot be an assumed-size array error when the dummy arguments are deferred-shape or assumed-rank pointer. gcc/testsuite/ChangeLog: PR fortran/94110 * gfortran.dg/PR94110.f90: New test.
2020-08-02This patch fixes PR96320. See the explanatory comment in the testcase.Paul Thomas1-3/+16
2020-08-01 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR target/96320 * interface.c (gfc_check_dummy_characteristics): If a module procedure arrives with assumed shape in the interface and deferred shape in the procedure itself, update the latter and copy the lower bounds. gcc/testsuite/ PR target/96320 * gfortran.dg/module_procedure_4.f90 : New test.
2020-07-11Fix ICE on warning with new interface check.Thomas Koenig1-1/+2
In the test case, there was a warning about INTENT where an EXTERNAL masked an interface in an outer scope, when the location of the symbol was not set, leading to an ICE. Two problems, two-part solution: It makes no sense to warn about INTENT for artificially generated formal argument lists, and the location should be set. gcc/fortran/ChangeLog: PR fortran/96073 * frontend-passes.c (check_externals_procedure): Add locus information for new_sym. * interface.c (gfc_check_dummy_characteristics): Do not warn about INTENT for artificially generated variables. gcc/testsuite/ChangeLog: PR fortran/96073 * gfortran.dg/interface_48.f90: New test.
2020-07-02Fortran : ICE in generic_correspondence PR95584Mark Eggleston1-1/+1
Output an error for ambiguous interfaces in generic interface instead of ICE. 2020-07-02 Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran/ PR fortran/95584 * interface.c (generic_correspondence): Only use the pointer to a symbol if exists. 2020-07-02 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/95584 * gfortran.dg/pr95584.f90: New test.
2020-06-20PR fortran/95689 - ICE in check_sym_interfaces, at fortran/interface.c:2015Harald Anlauf1-1/+4
With submodules, name mangling of interfaces may result in long internal symbols overflowing an internal buffer. We now check that we do not exceed the enlarged buffer size. gcc/fortran/ PR fortran/95689 * interface.c (check_sym_interfaces): Enlarge temporary buffer, and add check on length on mangled name to prevent overflow.
2020-05-11Fortran : Spurious warning message with -Wsurprising PR59107Mark Eggleston1-2/+3
This change is from a patch developed for gcc-5. The code has moved on since then requiring a change to interface.c 2020-05-11 Janus Weil <janus@gcc.gnu.org> Dominique d'Humieres <dominiq@lps.ens.fr> gcc/fortran/ PR fortran/59107 * gfortran.h: Rename field resolved as resolve_symbol_called and assign two 2 bits instead of 1. * interface.c (check_dtio_interface1): Use new field name. (gfc_find_typebound_dtio_proc): Use new field name. * resolve.c (gfc_resolve_intrinsic): Replace check of the formal field with resolve_symbol_called is at least 2, if it is not set the field to 2. (resolve_typebound_procedure): Use new field name. (resolve_symbol): Use new field name and check whether it is at least 1, if it is not set the field to 1. 2020-05-11 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/59107 * gfortran.dg/pr59107.f90: New test.
2020-04-27Revert r10-7920-g06eca1acafa27e19e82dc73927394a7a4d0bdbc5 .Thomas Koenig1-34/+0
2020-04-27 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93956 PR fortran/94788 * expr.c (gfc_check_pointer_assign): Revert patch for PR 93956. * interface.c: Likewise. 2020-04-27 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93956 PR fortran/94788 * gfortran.dg/pointer_assign_13.f90: Remove.
2020-04-23Fix PR 93956, wrong pointer when returned via function.Thomas König1-0/+34
This one took a bit of detective work. When array pointers point to components of derived types, we currently set the span field and then create an array temporary when we pass the array pointer to a procedure as a non-pointer or non-target argument. (This is inefficient, but that's for another release). Now, the compiler detected this case when there was a direct assignment like p => a%b, but not when p was returned either as a function result or via an argument. This patch fixes that. 2020-04-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93956 * expr.c (gfc_check_pointer_assign): Also set subref_array_pointer when a function returns a pointer. * interface.c (gfc_set_subref_array_pointer_arg): New function. (gfc_procedure_use): Call it. 2020-04-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93956 * gfortran.dg/pointer_assign_13.f90: New test.
2020-04-17Fix ICE on invalid, PR94090.Thomas König1-3/+11
The attached patch fixes an ICE on invalid: When the return type of a function was misdeclared with a wrong rank, we issued a warning, but not an error (unless with -pedantic); later on, an ICE ensued. Nothing good can come from wrongly declaring a function type (considering the ABI), so I changed that into a hard error. 2020-04-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/94090 * gfortran.dg (gfc_compare_interfaces): Add optional argument bad_result_characteristics. * interface.c (gfc_check_result_characteristics): Fix whitespace. (gfc_compare_interfaces): Handle new argument; return true if function return values are wrong. * resolve.c (resolve_global_procedure): Hard error if the return value of a function is wrong. 2020-04-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/94090 * gfortran.dg/interface_46.f90: New test.
2020-04-14Fix PR 94270 by not warning about artifical dummy arguments.Thomas König1-1/+1
2020-04-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/94270 * interface.c (gfc_get_formal_from_actual_arglist): Always set artificial attribute for symbols. * trans-decl.c (generate_local_decl): Do not warn if the symbol is artifical. 2020-04-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/94270 * gfortran.dg/warn_unused_dummy_argument_6.f90: New test.
2020-04-02[Fortran] Resolve formal args before checking DTIOTobias Burnus1-1/+3
* gfortran.h (gfc_resolve_formal_arglist): Add prototype. * interface.c (check_dtio_interface1): Call it. * resolve.c (gfc_resolve_formal_arglist): Renamed from resolve_formal_arglist, removed static. (find_arglists, resolve_types): Update calls. * gfortran.dg/dtio_35.f90: New.
2020-02-23Add missing closing parenthises in error message.Thomas König1-1/+1
2020-02-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93889 * interface.c (compare_parameter): Fix error message.
2020-02-23Fix error message.Thomas König1-2/+2
2020-02-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93890 * interface.c: Replace "can not" by "cannot" and remove trailing space. 2020-02-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93890 * gfortran.dg/argument_checking_24.f90: Correct test case.
2020-01-21Fortran] PR93309 – permit repeated 'implicit none(external)'Tobias Burnus1-1/+9
PR fortran/93309 * interface.c (gfc_procedure_use): Also check parent namespace for 'implict none (external)'. * symbol.c (gfc_get_namespace): Don't set has_implicit_none_export to parent namespace's setting. PR fortran/93309 * gfortran.dg/external_implicit_none_2.f90: New.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-08re PR fortran/92764 (ICE in gfc_procedure_use)Thomas Koenig1-0/+2
2018-12-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/92764 * interface.c (gfc_procedure_use): Check for existence of derived component before using (twice). 2018-12-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/92764 * gfortran.dg/interface_44.f90: New test. From-SVN: r279087
2019-10-14re PR fortran/92004 (Rejection of different ranks for dummy array argument ↵Thomas Koenig1-5/+95
where actual argument is an element) 2019-10-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/92004 * array.c (expand_constructor): Set from_constructor on expression. * gfortran.h (gfc_symbol): Add maybe_array. (gfc_expr): Add from_constructor. * interface.c (maybe_dummy_array_arg): New function. (compare_parameter): If the formal argument is generated from a call, check the conditions where an array element could be passed to an array. Adjust error message for assumed-shape or pointer array. Use correct language for assumed shaped arrays. (gfc_get_formal_from_actual_arglist): Set maybe_array on the symbol if the actual argument is an array element fulfilling the conditions of 15.5.2.4. 2019-10-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/92004 * gfortran.dg/argument_checking_24.f90: New test. * gfortran.dg/abstract_type_6.f90: Add error message. * gfortran.dg/argument_checking_11.f90: Correct wording in error message. * gfortran.dg/argumeent_checking_13.f90: Likewise. * gfortran.dg/interface_40.f90: Add error message. From-SVN: r276972
2019-10-03Character typenames in errors and warningsMark Eggleston1-5/+6
Character type names now incorporate length, kind is only shown if the default character is not being used. Examples: character(7) is reported as CHARACTER(7) character(len=20,kind=4) is reported as CHARACTER(20,4) dummy character variables with assumed length: character(*) is reported as CHARACTER(*) character(*,kind=4) is reported as CHARACTER(*,4) From-SVN: r276505
2019-09-14re PR fortran/91557 (Bogus warning about unused dummy argument _formal_*)Thomas Koenig1-37/+83
2019-09-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91557 PR fortran/91556 * frontend-passes.c (check_externals_procedure): Reformat argument list. Use gfc_compare_actual_formal instead of gfc_procedure_use. * gfortran.h (gfc_symbol): Add flag error. * interface.c (gfc_compare_interfaces): Reformat. (argument_rank_mismatch): Add where_formal argument. If it is present, note that the error is between different calls. (compare_parameter): Change warnings that previously dependended on -Wargument-mismatch to unconditional. Issue an error / warning on type mismatch only once. Pass where_formal to argument_rank_mismatch for artificial variables. (compare_actual_formal): Change warnings that previously dependeded on -Wargument-mismatch to unconditional. (gfc_check_typebound_override): Likewise. (gfc_get_formal_from_actual_arglist): Set declared_at for artificial symbol. * invoke.texi: Extend description of -fallow-argument-mismatch. Delete -Wargument-mismatch. * lang.opt: Change -Wargument-mismatch to do-nothing option. * resolve.c (resolve_structure_cons): Change warnings that previously depended on -Wargument-mismatch to unconditional. * trans-decl.c (generate_local_decl): Do not warn if the symbol is artificial. 2019-09-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91557 PR fortran/91556 * gfortran.dg/argument_checking_20.f90: New test. * gfortran.dg/argument_checking_21.f90: New test. * gfortran.dg/argument_checking_22.f90: New test. * gfortran.dg/argument_checking_23.f90: New test. * gfortran.dg/warn_unused_dummy_argument_5.f90: New test. * gfortran.dg/bessel_3.f90: Add pattern for type mismatch. * gfortran.dg/g77/20010519-1.f: Adjust dg-warning messages to new handling. * gfortran.dg/pr24823.f: Likewise. * gfortran.dg/pr39937.f: Likewise. From-SVN: r275719
2019-08-24re PR fortran/91390 (treatment of extra parameter in a subroutine call)Thomas Koenig1-8/+70
2019-08-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91390 PR fortran/91519 * frontend-passes.c (check_externals_procedure): New function. If a procedure is not in the translation unit, create an "interface" for it, including its formal arguments. (check_externals_code): Use check_externals_procedure for common code with check_externals_expr. (check_externals_expr): Vice versa. * gfortran.h (gfc_get_formal_from_actual-arglist): New prototype. (gfc_compare_actual_formal): New prototype. * interface.c (compare_actual_formal): Rename to (gfc_compare_actual_formal): New function, make global. (gfc_get_formal_from_actual_arglist): Make global, and move here from * trans-types.c (get_formal_from_actual_arglist): Remove here. (gfc_get_function_type): Use gfc_get_formal_from_actual_arglist. 2019-08-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91390 PR fortran/91519 * gfortran.dg/bessel_3.f90: Add type mismatch errors. * gfortran.dg/coarray_7.f90: Rename subroutines to avoid additional errors. * gfortran.dg/g77/20010519-1.f: Add -std=legacy. Remove warnings for ASSIGN. Add warnings for type mismatch. * gfortran.dg/goacc/acc_on_device-1.f95: Add -std=legacy. Add catch-all warning. * gfortran.dg/internal_pack_9.f90: Rename subroutine to avoid type error. * gfortran.dg/internal_pack_9.f90: Add -std=legacy. Add warnings for type mismatch. * gfortran.dg/pr39937.f: Add -std=legacy and type warnings. Move here from * gfortran.fortran-torture/compile/pr39937.f: Move to gfortran.dg. From-SVN: r274902
2019-08-15re PR fortran/91443 (-Wargument-mismatch does not catch mismatch for global ↵Thomas Koenig1-5/+19
procedure) 2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91443 * frontend-passes.c (check_externals_expr): New function. (check_externals_code): New function. (gfc_check_externals): New function. * gfortran.h (debug): Add prototypes for gfc_symbol * and gfc_expr *. (gfc_check_externals): Add prototype. * interface.c (compare_actual_formal): Do not complain about alternate returns if the formal argument is optional. (gfc_procedure_use): Handle cases when an error has been issued previously. Break long line. * parse.c (gfc_parse_file): Call gfc_check_externals for all external procedures. * resolve.c (resolve_global_procedure): Remove checking of argument list. 2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91443 * gfortran.dg/argument_checking_19.f90: New test. * gfortran.dg/altreturn_10.f90: Change dg-warning to dg-error. * gfortran.dg/dec_union_11.f90: Add -std=legacy. * gfortran.dg/hollerith8.f90: Likewise. Remove warning for Hollerith constant. * gfortran.dg/integer_exponentiation_2.f90: New subroutine gee_i8; use it to avoid type mismatches. * gfortran.dg/pr41011.f: Add -std=legacy. * gfortran.dg/whole_file_1.f90: Change warnings to errors. * gfortran.dg/whole_file_2.f90: Likewise. From-SVN: r274551
2019-07-30re PR fortran/91296 (ICE when passing complex number %re/%im as a procedure ↵Steven G. Kargl1-0/+7
argument with -Waliasing.) 2019-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91296 * interface.c (compare_actual_expr): When checking for aliasing, add a case to handle REF_INQUIRY (e.g., foo(x%re, x%im) do not alias). 2019-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91296 * gfortran.dg/pr91296.f90: New test. From-SVN: r273914
2019-07-23arith.c (gfc_convert_integer, [...]): Move to ...Steven G. Kargl1-0/+6
2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org> * arith.c (gfc_convert_integer, gfc_convert_real, gfc_convert_complex): Move to ... * primary.c (convert_integer, convert_real, convert_complex): ... here. Rename and make static functions. (match_integer_constant): Use convert_integer (match_real_constant): Use convert_real. (match_complex_constant: Use convert_complex. * arith.h (gfc_convert_integer, gfc_convert_real, gfc_convert_complex): Remove prototypes. * array.c (match_array_cons_element): A BOZ cannot be a data statement value. Jump to a common exit point. * check.c (gfc_invalid_boz): New function. Emit error or warning for a BOZ in an invalid context. (boz_args_check): Move to top of file to prevent need of forward declaration. (is_boz_constant): New function. Check that BOZ expr is constant. (gfc_b z2real): New function. In-place conversion of BOZ literal constant to REAL in accordance to F2018. (gfc_boz2int): New function. In-place conversion of BOZ literal onstant to INTEGER in accordance to F2018. (gfc_check_achar, gfc_check_char, gfc_check_float): Use gfc_invalid_boz. Convert BOZ as needed. (gfc_check_bge_bgt_ble_blt): Enforce F2018 requirements on BGE, BGT, BLE, and BLT intrinsic functions. (gfc_check_cmplx): Re-organize to check kind, if present, first. Convert BOZ real and/or imaginary parts as needed in accordance to F2018. (gfc_check_complex): Use gfc_invalid_boz. Convert BOZ as needed. (gfc_check_dcmplx, gfc_check_dble ): Convert BOZ as needed. (gfc_check_dshift): Make dshift[lr] conform to F2018 standard. gfc_check_float (gfc_expr *a) (gfc_check_iand_ieor_ior): Make IAND, IEOR, and IOR conform to F2018 standard. (gfc_check_int): Conform to F2018 standard. (gfc_check_intconv): Deprecate SHORT and LONG aliases for INT2 and INT. Simply return for a BOZ argument. See gfc_simplify_intconv. (gfc_check_merge_bits): Make MERGE_BITS conform to Fortran 2018 standard. (gfc_check_real): Remove incorrect comment. Check kind, if present, first. Simply return for a BOZ argument. See gfc_simplify_real. (gfc_check_and): Re-do error handling for BOZ arguments. Remove special casing ts.type != BT_INTEGER or BT_LOGICAL. * decl.c (match_old_style_init): Check for BOZ in old-style initialization. Issue error or warning depending on -fallow-invalid-boz option. Issue error if variable is not an INTEGER or REAL and the value is BOZ. * expr.c (gfc_copy_expr): Copy a BT_BOZ gfc_expr. (gfc_check_assign): Re-do error handling for a BOZ in an assignment statement. Do in-place conversion of RHS based on LHS type of INTEGER or REAL. * gfortran.h (gfc_expr): Add a boz component. Remove is_boz component. (gfc_boz2int, gfc_boz2real, gfc_invalid_boz): New prototypes. * interface.c (gfc_extend_assign): Guard against replacing an intrinsic involving a BOZ literal constant on RHS. * invoke.texi: Doument -fallow-invalid-boz. * lang.opt: New option. -fallow-invalid-boz. * libgfortran.h (bt): Elevate BOZ to a basic type. * misc.c (gfc_basic_typename, gfc_typename): Translate BT_BOZ to BOZ. * primary.c (convert_integer, convert_real, convert_complex): to here. Rename and make static functions. * primary.c(match_boz_constant): Rewrite parsing of a BOZ. Re-do error handling. Deprecate 'X' for hexidecimal and postfix notation. Use -fallow-invalid-boz and gfc_invalid_boz to accept deprecated code. * resolve.c (resolve_ordinary_assign): Rework a RHS that is a BOZ literal constant. Use gfc_invalid_boz to allow previous nonstandard behavior. Remove range checking of BOZ conversion. * simplify.c (convert_boz): Remove function. (simplify_cmplx): Remove conversion of BOZ constants, because conversion is done in gfc_check_cmplx. (gfc_simplify_float): Remove conversion of BOZ constant, because conversion is done in gfc_check_float. (simplify_intconv): Use gfc_boz2int to convert BOZ to INTEGER. Remove range checking for BOZ conversion. (gfc_simplify_real): Use k, if present, to determine kind. Convert BOZ to REAL. Remove range checking for BOZ conversion. target-memory.c (gfc_convert_boz): Rewrite to deal with convert of a BOZ to a REAL value. 2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/achar_5.f90: Fix for new BOZ handling. * arithmetic_overflow_1.f90: Ditto. * gfortran.dg/boz_11.f90: Ditto. * gfortran.dg/boz_12.f90: Ditto. * gfortran.dg/boz_4.f90: Ditto. * gfortran.dg/boz_5.f90: Ditto. * gfortran.dg/boz_6.f90: Ditto. * gfortran.dg/boz_7.f90: Ditto. * gfortran.dg/boz_8.f90: Ditto. * gfortran.dg/dec_structure_6.f90: Ditto. * gfortran.dg/dec_union_1.f90: Ditto. * gfortran.dg/dec_union_2.f90: Ditto. * gfortran.dg/dec_union_5.f90: Ditto. * gfortran.dg/dshift_3.f90: Ditto. * gfortran.dg/gnu_logical_2.f90: Ditto. * gfortran.dg/int_conv_1.f90: Ditto. * gfortran.dg/ishft_1.f90: Ditto. * gfortran.dg/nan_4.f90: Ditto. * gfortran.dg/no_range_check_3.f90: Ditto. * gfortran.dg/pr16433.f: Ditto. * gfortran.dg/pr44491.f90: Ditto. * gfortran.dg/pr58027.f90: Ditto. * gfortran.dg/pr81509_2.f90: Ditto. * gfortran.dg/unf_io_convert_1.f90: Ditto. * gfortran.dg/unf_io_convert_2.f90: Ditto. * gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90: Ditto. * gfortran.fortran-torture/execute/intrinsic_mvbits.f90: Ditto. * gfortran.fortran-torture/execute/intrinsic_nearest.f90: Ditto. * gfortran.fortran-torture/execute/seq_io.f90: Ditto. * gfortran.dg/gnu_logical_1.F: Delete test. * gfortran.dg/merge_bits_3.f90: New test. * gfortran.dg/merge_bits_3.f90: Ditto. * gfortran.dg/boz_int.f90: Ditto. * gfortran.dg/boz_bge.f90: Ditto. * gfortran.dg/boz_complex_1.f90: Ditto. * gfortran.dg/boz_complex_2.f90: Ditto. * gfortran.dg/boz_complex_3.f90: Ditto. * gfortran.dg/boz_dble.f90: Ditto. * gfortran.dg/boz_dshift_1.f90: Ditto. * gfortran.dg/boz_dshift_2.f90: Ditto. * gfortran.dg/boz_float_1.f90: Ditto. * gfortran.dg/boz_float_2.f90: Ditto. * gfortran.dg/boz_float_3.f90: Ditto. * gfortran.dg/boz_iand_1.f90: Ditto. * gfortran.dg/boz_iand_2.f90: Ditto. 2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org> * testsuite/libgomp.fortran/reduction4.f90: Update BOZ usage * testsuite/libgomp.fortran/reduction5.f90: Ditto. From-SVN: r273747
2019-05-29re PR fortran/90329 (Incompatibility between gfortran and C lapack calls)Jakub Jelinek1-0/+1
PR fortran/90329 * lang.opt (fbroken-callers): Remove. (ftail-call-workaround, ftail-call-workaround=): New options. * gfortran.h (struct gfc_namespace): Add implicit_interface_calls. * interface.c (gfc_procedure_use): Set implicit_interface_calls for calls to implicit interface procedures. * trans-decl.c (create_function_arglist): Use flag_tail_call_workaround instead of flag_broken_callers. If it is not 2, also require sym->ns->implicit_interface_calls. * invoke.texi (fbroken-callers): Remove documentation. (ftail-call-workaround, ftail-call-workaround=): Document. From-SVN: r271738
2019-05-10re PR fortran/61968 (ICE (assembly failure) due to wrongly generating a ↵Thomas Koenig1-1/+2
vtable for TYPE(*) / BT_ASSUMED_TYPE) 2019-05-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/61968 * interface.c (compare_actual_formal): Do not create a vtab if the actual argument is assumed type. 2019-05-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/61968 * gfortran.dg/assumed_type_10.f90: New test case. * gfortran.dg/assumed_type_11.f90: New test case. From-SVN: r271076
2019-03-24re PR fortran/78865 (ICE in create_tmp_var, at gimple-expr.c:473)Thomas Koenig1-4/+6
2019-03-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/78865 * interface.c (compare_actual_formal): Change errors about missing or extra to gfc_error_now to make sure they are issued. Change "spec" to "specifier" in message. * resolve.c (resolve_global_procedure): Also check for mismatching interface with global symbols if the namespace has already been resolved. 2019-03-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/78865 * gfortran.dg/altreturn_10.f90: New test. * gfortran.dg/whole_file_3.f90: Change dg-warning to dg-error. From-SVN: r269895
2019-03-12Replace can't in error messages for Fortran.Martin Liska1-1/+1
2019-03-12 Martin Liska <mliska@suse.cz> * c-opts.c (c_common_handle_option): Wrap option with %< and %>. 2019-03-12 Martin Liska <mliska@suse.cz> * decl.c (add_init_expr_to_sym): Replace usage of 'can't' with 'cannot'. (variable_decl): Likewise. (cray_pointer_decl): Likewise. (match_binding_attributes): Likewise. * f95-lang.c (gfc_init): Likewise. * interface.c (gfc_check_typebound_override): Likewise. * intrinsic.c (make_generic): Likewise. * module.c (dump_module): Likewise. (gfc_use_module): Likewise. * primary.c (gfc_convert_to_structure_constructor): Likewise. * resolve.c (resolve_entries): Likewise. (check_generic_tbp_ambiguity): Likewise. (get_checked_tb_operator_target): Likewise. * scanner.c (load_file): Likewise. * trans-expr.c (gfc_conv_intrinsic_to_class): Likewise. 2019-03-12 Martin Liska <mliska@suse.cz> * config/i386/i386.c: Reword an error message. 2019-03-12 Martin Liska <mliska@suse.cz> * gfortran.dg/abstract_type_3.f03: Amend test-case scan patterns. * gfortran.dg/binding_label_tests_4.f03: Likewise. * gfortran.dg/c_f_pointer_tests_6.f90: Likewise. * gfortran.dg/c_funloc_tests_6.f90: Likewise. * gfortran.dg/c_loc_tests_17.f90: Likewise. * gfortran.dg/constructor_9.f90: Likewise. * gfortran.dg/dec_structure_8.f90: Likewise. * gfortran.dg/entry_4.f90: Likewise. * gfortran.dg/init_char_with_nonchar_ctr.f90: Likewise. * gfortran.dg/initialization_23.f90: Likewise. * gfortran.dg/logical_assignment_1.f90: Likewise. * gfortran.dg/pr80752.f90: Likewise. * gfortran.dg/pr88116_1.f90: Likewise. * gfortran.dg/pr88467.f90: Likewise. * gfortran.dg/typebound_call_7.f03: Likewise. * gfortran.dg/typebound_generic_1.f03: Likewise. * gfortran.dg/typebound_operator_2.f03: Likewise. * gfortran.dg/typebound_operator_4.f03: Likewise. * gfortran.dg/typebound_proc_9.f03: Likewise. * gfortran.dg/unlimited_polymorphic_2.f03: Likewise. From-SVN: r269616
2019-01-29re PR fortran/57048 (Handling of C_PTR and C_FUNPTR leads to reject valid)Thomas Koenig1-0/+10
2019-01-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/57048 * interface.c (gfc_compare_types): If a derived type and an integer both have a derived type, and they are identical, this is a C binding type and compares equal. 2019-01-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/57048 * gfortran.dg/c_funptr_1.f90: New file. * gfortran.dg/c_funptr_1_mod.f90: New file. From-SVN: r268372
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-09-20gfortran.h (gfc_str_startswith): New macro.Janus Weil1-2/+2
2018-09-20 Janus Weil <janus@gcc.gnu.org> * gfortran.h (gfc_str_startswith): New macro. * decl.c (variable_decl, gfc_match_end): Use it. * iresolve.c (is_trig_resolved): Ditto. * module.c (load_omp_udrs, read_module): Ditto. * options.c (gfc_handle_runtime_check_option): Ditto. * primary.c (match_arg_list_function): Ditto. * trans-decl.c (gfc_get_symbol_decl): Ditto. * trans-expr.c (gfc_conv_procedure_call): Ditto. * interface.c (dtio_op): Replace strncmp by strcmp. * resolve.c (resolve_actual_arglist, resolve_function): Ditto. * trans-expr.c (conv_arglist_function): Ditto. * trans-intrinsic.c (gfc_conv_ieee_arithmetic_function): Replace macro STARTS_WITH by gfc_str_startswith. From-SVN: r264448
2018-08-14re PR fortran/86116 (Ambiguous generic interface not recognised)Janus Weil1-3/+11
2018-08-14 Janus Weil <janus@gcc.gnu.org> PR fortran/86116 * interface.c (compare_type): Remove a CLASS/TYPE check. (compare_type_characteristics): New function that behaves like the old 'compare_type'. (gfc_check_dummy_characteristics, gfc_check_result_characteristics): Call 'compare_type_characteristics' instead of 'compare_type'. 2018-08-14 Janus Weil <janus@gcc.gnu.org> PR fortran/86116 * gfortran.dg/generic_34.f90: New test case. From-SVN: r263540
2018-08-04re PR fortran/45521 ([F08] GENERIC resolution with ALLOCATABLE/POINTER and ↵Janus Weil1-1/+10
PROCEDURE) 2018-08-04 Janus Weil <janus@gcc.gnu.org> PR fortran/45521 * interface.c (gfc_compare_interfaces): Apply additional distinguishability criteria of F08 to operator interfaces. 2018-08-04 Janus Weil <janus@gcc.gnu.org> PR fortran/45521 * gfortran.dg/interface_assignment_6.f90: New test case. From-SVN: r263308
2018-06-24re PR fortran/85983 (ICE in check_dtio_interface1, at fortran/interface.c:4748)Jerry DeLisle1-1/+0
2018-06-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/85983 * interface.c (check_dtio_interface1): Delete assert. From-SVN: r261994
2018-06-11re PR fortran/45521 ([F08] GENERIC resolution with ALLOCATABLE/POINTER and ↵Janus Weil1-4/+22
PROCEDURE) 2018-06-11 Janus Weil <janus@gcc.gnu.org> PR fortran/45521 * interface.c (compare_ptr_alloc): New function. (generic_correspondence): Call it. 2018-06-11 Janus Weil <janus@gcc.gnu.org> PR fortran/45521 * gfortran.dg/generic_32.f90: New test. * gfortran.dg/generic_33.f90: New test. From-SVN: r261448
2018-03-21re PR fortran/85001 (ICE in gfc_build_array_type, at fortran/trans-types.c:1420)Steven G. Kargl1-1/+1
2018-03-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85001 * interface.c (symbol_rank): Remove bogus null pointer check that crept in when translating a ternary operator into an if-else constructor. 2018-03-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85001 * gfortran.dg/interface_41.f90: New test. From-SVN: r258698
2018-02-23re PR fortran/84346 (Statement functions should not accept keywords)Steven G. Kargl1-0/+7
2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/84346 * interface.c (compare_actual_formal): Issue error if keyword is used in a statement function. 2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/84346 * gfortran.dg/statement_function_1.f90: Update test. From-SVN: r257942
2018-02-15re PR fortran/84409 ([F03] check DTIO arguments for character len)Janus Weil1-1/+5
2018-02-15 Janus Weil <janus@gcc.gnu.org> PR fortran/84409 * interface.c (check_dtio_arg_TKR_intent): Add a check for character length. 2018-02-15 Janus Weil <janus@gcc.gnu.org> PR fortran/84409 * gfortran.dg/dtio_21.f03: Add an error message. * gfortran.dg/dtio_22.f90: Fix invalid test case. From-SVN: r257711
2018-02-11re PR fortran/54223 (Statement function statement with dummy arguments that ↵Steven G. Kargl1-10/+15
are also OPTIONAL may crash in wrong calls) 2018-02-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/54223 PR fortran/84276 * interface.c (compare_actual_formal): Add in_statement_function bool parameter. Skip check of INTENT attribute for statement functions. Arguments to a statement function cannot be optional, issue error for missing argument. (gfc_procedure_use, gfc_ppc_use, gfc_arglist_matches_symbol): Use in_statement_function. 2018-02-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/54223 PR fortran/84276 * gfortran.dg/statement_function_1.f90: New test. * gfortran.dg/statement_function_2.f90: New test. From-SVN: r257565
2018-01-16re PR fortran/82257 (f951: Internal compiler error segmentation fault)Louis Krupp1-2/+6
2018-01-15 Louis Krupp <louis.krupp@zoho.com> PR fortran/82257 * interface.c (compare_rank): Don't try to retrieve CLASS_DATA from symbol marked unlimited polymorphic. * resolve.c (resolve_structure_cons): Likewise. * misc.c (gfc_typename): Don't dereference derived->components if it's NULL. 2018-01-15 Louis Krupp <louis.krupp@zoho.com> PR fortran/82257 * gfortran.dg/unlimited_polymorphic_28.f90: New test. From-SVN: r256720
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-12-17Support -std=f2018Janne Blomqvist1-1/+1
The Fortran committee has decided to rename the upcoming Fortran 2015 standard to Fortran 2018. This is not a reflection of a three year delay in the process, but rather they are following other standards in adopting the year of publication for the name. For more details see N2144. This patch renames GFC_STD_F2015 to GFC_STD_F2018, and makes it a separate flag rather than an alias for GFC_STD_GNU. Also, it adds a -std=f2018 argument, and documents it. Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2017-12-17 Janne Blomqvist <jb@gcc.gnu.org> * decl.c (gfc_match_implicit_none): Use GFC_STD_F2018 instead of GFC_STD_F2015. * error.c (gfc_notify_std): Add GFC_STD_F2018{_DEL,_OBS} to switch. * gfortran.texi: Document -std=f2018. * interface.c (compare_parameter): Fix comment. * invoke.texi: Document -std=f2018. * lang.opt: Add -std=f2018 argumnet. * libgfortran.h (GFC_STD_F2015): Rename to GFC_STD_F0218, use separate flag bit. (GFC_STD_F2018_DEL): New macro. (GFC_STD_F2018_OBS): Likewise. * match.c (gfc_match_stopcode): Use GFC_STD_F2018. * options.c (set_default_std_flags): Add F2018 flags to defaults. (gfc_handle_option): Set options for -std=f2018. gcc/testsuite/ChangeLog: 2017-12-17 Janne Blomqvist <jb@gcc.gnu.org> * gfortran.dg/error_stop_3.f90: Update -std= option, fix comments. * gfortran.dg/error_stop_4.f90: Update error message. * gfortran.dg/implicit_14.f90: Likewise. * gfortran.dg/spellcheck-procedure_2.f90: Don't warn for F2018 features. From-SVN: r255761
2017-11-09re PR fortran/78814 (ICE in symbol_rank, at fortran/interface.c:1265)Steven G. Kargl1-2/+7
2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78814 * interface.c (symbol_rank): Check for NULL pointer. 2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78814 * gfortran.dg/interface_40.f90: New testcase. From-SVN: r254604
2017-10-19Derive interface buffers from max name lengthBernhard Reutner-Fischer1-3/+3
2017-10-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * interface.c (check_sym_interfaces, check_uop_interfaces, gfc_check_interfaces): Base interface_name buffer off GFC_MAX_SYMBOL_LEN. From-SVN: r253881
2017-10-19Use Levenshtein spelling suggestions in Fortran FEBernhard Reutner-Fischer1-9/+63
gcc/fortran/ChangeLog 2017-10-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * gfortran.h (gfc_lookup_function_fuzzy): New declaration. (gfc_closest_fuzzy_match): New declaration. (vec_push): New definition. * misc.c (gfc_closest_fuzzy_match): New definition. * resolve.c: Include spellcheck.h. (lookup_function_fuzzy_find_candidates): New static function. (lookup_uop_fuzzy_find_candidates): Likewise. (lookup_uop_fuzzy): Likewise. (resolve_operator) <INTRINSIC_USER>: Call lookup_uop_fuzzy. (gfc_lookup_function_fuzzy): New definition. (resolve_unknown_f): Call gfc_lookup_function_fuzzy. * interface.c (check_interface0): Likewise. (lookup_arg_fuzzy_find_candidates): New static function. (lookup_arg_fuzzy ): Likewise. (compare_actual_formal): Call lookup_arg_fuzzy. * symbol.c: Include spellcheck.h. (lookup_symbol_fuzzy_find_candidates): New static function. (lookup_symbol_fuzzy): Likewise. (gfc_set_default_type): Call lookup_symbol_fuzzy. (lookup_component_fuzzy_find_candidates): New static function. (lookup_component_fuzzy): Likewise. (gfc_find_component): Call lookup_component_fuzzy. gcc/testsuite/ChangeLog 2017-10-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * gfortran.dg/spellcheck-operator.f90: New testcase. * gfortran.dg/spellcheck-procedure_1.f90: New testcase. * gfortran.dg/spellcheck-procedure_2.f90: New testcase. * gfortran.dg/spellcheck-structure.f90: New testcase. * gfortran.dg/spellcheck-parameter.f90: New testcase. From-SVN: r253877
2017-09-29re PR fortran/25071 (dummy argument larger than actual argument)Dominique d'Humieres1-5/+14
2017-09-29 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/25071 * interface.c (compare_actual_formal): Change warnings to errors when "Actual argument contains too few elements for dummy argument", unless -std=legacy is used. From-SVN: r253286
2017-09-09decl.c: Add decl_type_param_list...Paul Thomas1-1/+2
2017-09-09 Paul Thomas <pault@gcc.gnu.org> * decl.c : Add decl_type_param_list, type_param_spec_list as static variables to hold PDT spec lists. (build_sym): Copy 'type_param_spec_list' to symbol spec_list. (build_struct): Copy the 'saved_kind_expr' to the component 'kind_expr'. Check that KIND or LEN components appear in the decl_type_param_list. These should appear as symbols in the f2k_derived namespace. If the component is itself a PDT type, copy the decl_type_param_list to the component param_list. (gfc_match_kind_spec): If the KIND expression is parameterized set KIND to zero and store the expression in 'saved_kind_expr'. (insert_parameter_exprs): New function. (gfc_insert_kind_parameter_exprs): New function. (gfc_insert_parameter_exprs): New function. (gfc_get_pdt_instance): New function. (gfc_match_decl_type_spec): Match the decl_type_spec_list if it is present. If it is, call 'gfc_get_pdt_instance' to obtain the specific instance of the PDT. (match_attr_spec): Match KIND and LEN attributes. Check for the standard and for type/kind of the parameter. They are also not allowed outside a derived type definition. (gfc_match_data_decl): Null the decl_type_param_list and the type_param_spec_list on entry and free them on exit. (gfc_match_formal_arglist): If 'typeparam' is true, add the formal symbol to the f2k_derived namespace. (gfc_match_derived_decl): Register the decl_type_param_list if this is a PDT. If this is a type extension, gather up all the type parameters and put them in the right order. *dump-parse-tree.c (show_attr): Signal PDT templates and the parameter attributes. (show_components): Output parameter atrributes and component parameter list. (show_symbol): Show variable parameter lists. * expr.c (expr.c): Copy the expression parameter list. (gfc_is_constant_expr): Pass on symbols representing PDT parameters. (gfc_check_init_expr): Break on PDT KIND parameters and PDT parameter expressions. (gfc_check_assign): Assigning to KIND or LEN components is an error. (derived_parameter_expr): New function. (gfc_derived_parameter_expr): New function. (gfc_spec_list_type): New function. * gfortran.h : Add enum gfc_param_spec_type. Add the PDT attrs to the structure symbol_attr. Add the 'kind_expr' and 'param_list' field to the gfc_component structure. Comment on the reuse of the gfc_actual_arglist structure as storage for type parameter spec lists. Add the new field 'spec_type' to this structure. Add 'param_list' fields to gfc_symbol and gfc_expr. Add prototypes for gfc_insert_kind_parameter_exprs, gfc_insert_parameter_exprs, gfc_add_kind, gfc_add_len, gfc_derived_parameter_expr and gfc_spec_list_type. * interface.c (gfc_compare_derived_types): Treat PDTs in the same way as sequence types. * match.c : Add variable 'type_param_spec_list'. (gfc_op2string, gfc_match_member_sep, gfc_match_label): Remove trailing whitespace. (match_derived_type_spec): Match PDTs and find specific instance. (gfc_match_type_spec): Remove more trailing whitespace. (gfc_match_allocate): Assumed or deferred parameters cannot appear here. Copy the type parameter spec list to the expr for the allocatable entity. Free 'type_param_spec_list'. (gfc_match_common, gfc_match_namelist, gfc_match_module): Still more trailing whitespace to remove. (gfc_match_type_is): Allow PDT typespecs. * match.h : Modify prototypes for gfc_match_formal_arglist and gfc_match_actual_arglist. * module.c (ab_attribute, mstring attr_bits): PDT attributes added. (mio_symbol_attribute): PDT attributes handled. (mio_component): Deal with 'kind_expr' field. (mio_full_f2k_derived): For PDT templates, transfer the formal namespace symroot to the f2k_derived namespace. *primary.c (match_keyword_arg, gfc_match_actual_arglist): Add modifications to handle PDT spec lists. These are flagged in both cases by new boolean arguments, whose prototype defaults are false. (gfc_match_structure_constructor, match_variable): Remove yet more trailing whitespace. * resolve.c (get_pdt_spec_expr, get_pdt_constructor): New functions. (resolve_structure_cons): If the constructor is a PDT template, call get_pdt_constructor to build it using the parameter lists and then get the specific instance of the PDT. (resolve_component): PDT strings need a hidden string length component like deferred characters. (resolve_symbol): Dummy PDTs cannot have deferred parameters. * symbol.c (gfc_add_kind, gfc_add_len): New functions. (free_components): Free 'kind_expr' and 'param_list' fields. (gfc_free_symbol): Free the 'param_list' field. (gfc_find_sym_tree): If the current state is a PDT template, look for the symtree in the f2k_derived namspaces. trans-array.c (structure_alloc_comps): Allocate and deallocate PDTs. Check dummy arguments for compliance of LEN parameters. Add the new functions to the preceeding enum. (gfc_allocate_pdt_comp, gfc_deallocate_pdt_comp and gfc_check_pdt_dummy): New functions calling above. * trans-array.h : Add prototypes for these functions. trans-decl.c (gfc_get_symbol_decl): Call gfc_defer_symbol_init as appropriate for PDT symbols. (gfc_trans_deferred_vars): Allocate/deallocate PDT entities as they come into and out of scope. Exclude pdt_types from being 'gcc_unreachable'. (gfc_trans_subcomponent_assign): PDT array components must be handles as if they are allocatable. * trans-stmt.c (gfc_trans_allocate): Handle initialization of PDT entities. (gfc_trans_deallocate): Likewise. * trans-types.c (gfc_get_derived_type): PDT templates must not arrive here. PDT string components are handles as if deferred. Similarly, PDT arrays are treated as if allocatable. PDT strings are pointer types. * trans.c (gfc_deferred_strlen): Handle PDT strings in the same way as deferred characters. 2017-09-09 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/pdt_1.f03 : New test. * gfortran.dg/pdt_2.f03 : New test. * gfortran.dg/pdt_3.f03 : New test. * gfortran.dg/pdt_4.f03 : New test. * gfortran.dg/pdt_5.f03 : New test. From-SVN: r251925
2017-07-23fortran: fix pair_cmp qsort comparatorAlexander Monakov1-1/+3
* interface.c (pair_cmp): Fix gfc_symbol comparison. Adjust comment. From-SVN: r250463
2017-03-22re PR fortran/79602 (translation: globally replace '%s' with %qs)Dominique d'Humieres1-3/+3
2017-03-22 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79602 * decl.c: Replace '%s' with %qs. * expr.c: Likewise. * interface.c: Likewise. * match.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. PR fortran/79844 PR fortran/80011 * io.c: Remove trailing spaces. * match.c: Likewise. * openmp.c: Likewise. * resolve.c: Likewise. * trans-intrinsic.c: Likewise. PR fortran/79853 * expr.c: Remove a double spaces. PR fortran/79859 * primary.c: Remove spurious quotes around %qs. From-SVN: r246391
2017-02-25re PR fortran/79597 (Incomplete error message "Expecting %<END INTERFACE ↵Dominique d'Humieres1-3/+3
OPERATOR") 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79597 * interface.c (gfc_match_end_interface): Remove spurious comma and space, replace 'got %s' with 'got %qs'. 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79597 * gfortran.dg/dtio_6.f90: Update test. 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79601 * interface.c (check_dtio_arg_TKR_intent): Change 'intent' to 'INTENT'. 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79601 * gfortran.dg/interface_operator_2.f90: New test. From-SVN: r245729