aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-03PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913Harald Anlauf1-0/+2
Add checks for NULL pointers before dereferencing them. gcc/fortran/ChangeLog: PR fortran/95342 * decl.c (gfc_match_function_decl): Avoid NULL pointer dereference. (gfc_match_subroutine): Likewise. gcc/testsuite/ChangeLog: PR fortran/95342 * gfortran.dg/pr95342.f90: New test.
2020-11-03Fortran: Add !GCC$ attributes DEPRECATEDTobias Burnus1-0/+1
gcc/fortran/ChangeLog: * decl.c (ext_attr_list): Add EXT_ATTR_DEPRECATED. * gfortran.h (ext_attr_id_t): Ditto. * gfortran.texi (GCC$ ATTRIBUTES): Document it. * resolve.c (resolve_variable, resolve_function, resolve_call, resolve_values): Show -Wdeprecated-declarations warning. * trans-decl.c (add_attributes_to_decl): Skip those with no middle_end_name. gcc/testsuite/ChangeLog: * gfortran.dg/attr_deprecated.f90: New test.
2020-10-14Fortran : ICE in build_field PR95614Mark Eggleston1-2/+2
Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier is not a module or a program. The original patch was modified to reject global identifiers that represent a module or a program. 2020-10-14 Steven G. Kargl <kargl@gcc.gnu.org> Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran/ChangeLog: PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is a module or a program. 2020-10-14 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ChangeLog: PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test. * gfortran.dg/pr95614_3.f90: New test. * gfortran.dg/pr95614_4.f90: New test.
2020-10-12Fortran : ICE in gfc_validate_kind PR96099Mark Eggleston1-1/+1
Only check for kind if the type supports kind. 2020-10-12 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran/ChangeLog: PR fortran/96099 * decl.c (gfc_match_implicit): Check for numeric and logical types. 2020-10-12 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ChangeLog: PR fortran/96099 * gfortran.dg/pr96099_1.f90: New test. * gfortran.dg/pr96099_2.f90: New test.
2020-09-28Revert "Fortran : ICE in build_field PR95614"Mark Eggleston1-2/+2
This reverts commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc.
2020-09-27Fortran : ICE in build_field PR95614Mark Eggleston1-2/+2
Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl <kargl@gcc.gnu.org> Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test.
2020-09-17Fortran: Avoid double-free with parse error (PR96041, PR93423)Tobias Burnus1-0/+9
gcc/fortran/ PR fortran/96041 PR fortran/93423 * decl.c (gfc_match_submod_proc): Avoid later double-free in the error case.
2020-08-27Fortran : ICE for division by zero in declaration PR95882Mark Eggleston1-0/+3
A length expression containing a divide by zero in a character declaration will result in an ICE if the constant is anymore complicated that a contant divided by a constant. The cause was that char_len_param_value can return MATCH_YES even if a divide by zero was seen. Prior to returning check whether a divide by zero was seen and if so set it to MATCH_ERROR. 2020-08-27 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran PR fortran/95882 * decl.c (char_len_param_value): Check gfc_seen_div0 and if it is set return MATCH_ERROR. 2020-08-27 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/95882 * gfortran.dg/pr95882_1.f90: New test. * gfortran.dg/pr95882_2.f90: New test. * gfortran.dg/pr95882_3.f90: New test. * gfortran.dg/pr95882_4.f90: New test. * gfortran.dg/pr95882_5.f90: New test.
2020-07-14Fortran : Implicitly type parameter causes an invalid error PR96038Mark Eggleston1-6/+9
If a paramter to declared and initialised before its type is declared a bogus error is output at the type declaration idicating that initialisation is missing. 2020-07-14 Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran/ PR fortran/96038 * decl.c (add_init_expr_sym): For a symbol that is a parameter accept an initialisation if it does not have a value otherwise output a error and reject. 2020-07-14 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/96038 * gfortran.dg/pr96038.f90: New test.
2020-07-01Fortran : Fortran translation issues PR52279Mark Eggleston1-4/+4
Mark strings for translation by enclosing in G_() and _(). 2020-06-24 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran/ PR fortran/52279 * arith.c (reduce_binary_aa): Mark for translation the string parameter to gfc_check_conformance with G_(). * check.c (gfc_invalid_boz): Mark hint for translation using _(). (gfc_check_achar): Mark for translation the message parameter to gfc_invalid_boz using G_(). (gfc_check_char): Mark for translation the message parameter to gfc_invalid_boz using G_(). (gfc_check_complex): Mark for translation the message parameter to gfc_invalid_boz using G_(). (gfc_check_float): Mark for translation the message parameter to gfc_invalid_boz using G_(). (check_rest): Mark for translation the string parameter to gfc_check_conformance with _(). (gfc_check_minloc_maxloc): Mark for translation the string parameter to gfc_check_conformance with _(). (gfc_check_findloc): Mark for translation the string parameter to gfc_check_conformance with _(). (check_reduction): Mark for translation the string parameter to gfc_check_conformance with _(). (gfc_check_pack): Mark for translation the string parameter to gfc_check_conformance with _(). * decl.c (match_old_style_init): Mark for translation the message parameter to gfc_invalid_boz using G_(). * expr.c (gfc_check_assign): Mark for translation the string parameter to gfc_check_conformance with _(). * intrinsic.c (check_specific): Mark for translation the string parameter to gfc_check_conformance with _(). (gfc_check_intrinsic_standard): Mark symstd_msg strings for translation using G_(). No need to mark symstd_msg for translation in call to gfc_warning or when setting symstd. * io.c (check_open_constraints): Mark strings for translation using G_() in all calls to warn_or_error. (match_io_element): Mark for translation the message parameter to gfc_invalid_boz using G_(). * primary.c (match_boz_constant): Mark for translation the message parameter to gfc_invalid_boz using G_(). * resolve.c (resolve_elemental_actual): Mark for translation the string parameter to gfc_check_conformance with _(). (resolve_operator): Mark for translation the string parameter to gfc_check_conformance with _(). Mark translation strings assigned to msg using G_() for use in a call to cfg_warning.
2020-07-01Fortran : Bogus error with additional blanks in type(*) PR95829Mark Eggleston1-1/+1
Checking for "* ) " instead of "*)" clears the bogus error. 2020-07-01 Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran/ PR fortran/95829 * decl.c (gfc_match_decl_type_spec): Compare with "* ) " instead of "*)". 2020-07-01 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/95829 * gfortran.dg/pr95829.f90: New test.
2020-06-29PR fortran/95978 - ICE in gfc_match_data, at fortran/decl.c:731Harald Anlauf1-1/+1
Catch NULL pointer dereference on invalid DATA statement. gcc/fortran/ PR fortran/95978 * decl.c (gfc_match_data): Avoid NULL pointer dereference.
2020-06-25PR fortran/95826 - Buffer overflows with PDTs and long symbolsHarald Anlauf1-3/+5
With PDTs (parameterized derived types), name mangling results in variably long internal symbols. Use a dynamic buffer instead of a fixed-size one. gcc/fortran/ PR fortran/95826 * decl.c (gfc_match_decl_type_spec): Replace a fixed size buffer by a pointer and reallocate if necessary.
2020-06-23Fortran : ICE in gfc_validate_kind PR95586Mark Eggleston1-1/+1
Report syntax error for invalid letter-spec in IMPLICIT statements for derived types and not an ICE. Original patch by Steve Kargl. Added test cases based on those provided by G. Steinmetz in the PR. 2020-06-23 Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran/ PR fortran/95586 * decl.c (gfc_match_implicit): Only perform else branch if the type spect is not BT_DERIVED. 2020-06-23 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/95586 * gfortran.dg/pr95586_1.f90: New test. * gfortran.dg/pr95586_2.f90: New test.
2020-06-11PR fortran/95611 - ICE in access_attr_decl, at fortran/decl.c:9075Harald Anlauf1-1/+1
When reporting a duplicate access specification of an operator, refer to the proper symbol. 2020-06-11 Harald Anlauf <anlauf@gmx.de> gcc/fortran/ PR fortran/95611 * decl.c (access_attr_decl): Use correct symbol in error message. Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
2020-06-05PR fortran/95530, PR fortran/95537 - Buffer overflows with long symbolsHarald Anlauf1-2/+7
The testcases for PR95090 and PR95106 trigger buffer overflows with long symbols that were found with an instrumented compiler. Enlarge the affected buffers, and add checks that the buffers will suffice. 2020-06-05 Harald Anlauf <anlauf@gmx.de> gcc/fortran/ PR fortran/95530 PR fortran/95537 * decl.c (gfc_match_decl_type_spec): Enlarge buffer, and enhance string copy to detect buffer overflow. * gfortran.h (gfc_common_head): Enlarge buffer. * trans-common.c (finish_equivalences): Enhance string copy to detect buffer overflow.
2020-05-18PR fortran/95053 - division by zero constantsHarald Anlauf1-1/+16
Partially revert the fix for PR93499. Replace by checks for valid expressions in the declaration of array shape and PDT KIND and LEN expressions at a later stage. gcc/fortran/ 2020-05-18 Harald Anlauf <anlauf@gmx.de> PR fortran/95053 * arith.c (gfc_divide): Revert hunk introduced by patch for PR93499. * decl.c (variable_decl): Generate error for array shape not being an INTEGER constant. (gfc_get_pdt_instance): Generate error if KIND or LEN expressions in declaration of a PDT instance do not simplify to INTEGER constants. gcc/testsuite/ 2020-05-18 Harald Anlauf <anlauf@gmx.de> PR fortran/95053 * gfortran.dg/dec_structure_23.f90: Adjust to new error messages. * gfortran.dg/pr93499.f90: Adjust to new error messages. * gfortran.dg/pr95053_2.f90: New test. * gfortran.dg/pr95053_3.f90: New test.
2020-05-13Fortran : ICE in gfc_conv_array_constructor_expr PR93497Mark Eggleston1-0/+5
Invalid expressions, such as those involving array constructors, used for the length of character types will cause an ICE. 2020-05-13 Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran/ PR fortran/93497 * decl.c (char_len_param_value): Check whether character length expression is of type EXPR_OP and if so simplify it. * resolve.c (resolve_charlen): Reject length if it has a rank. 2020-05-13 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/93497 * gfortran.dg/pr88025.f90: Change in wording of error. * gfortran.dg/pr93497.f90: New test. * gfortran.dg/pr93714_1.f90: Change in wording of errors. * gfortran.dg/pr93714_2.f90: Change in wording of errors.
2020-04-20PR 91800 - reject Hollerith constants as type initializer.Steve Kargl1-0/+9
2020-04-20 Steve Kargl <kargl@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91800 * decl.c (variable_decl): Reject Hollerith constants as type initializer. 2020-04-20 Steve Kargl <kargl@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91800 * gfortran.dg/hollerith_9.f90: New test.
2020-04-06Fix fortran/93686 -- ICE matching data statements with derived-type pointers.Fritz Reese1-0/+4
gcc/fortran/ChangeLog: 2020-04-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/93686 * decl.c (gfc_match_data): Handle data matching for derived type pointers. gcc/testsuite/ChangeLog: 2020-04-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/93686 * gfortran.dg/pr93686_1.f90: New test. * gfortran.dg/pr93686_2.f90: Likewise. * gfortran.dg/pr93686_3.f90: Likewise. * gfortran.dg/pr93686_4.f90: Likewise.
2020-04-02Fix fortran/85982 ICE in resolve_component.Fritz Reese1-9/+21
2020-04-01 Fritz Reese <foreese@gcc.gnu.org> PR fortran/85982 * fortran/decl.c (match_attr_spec): Lump COMP_STRUCTURE/COMP_MAP into attribute checking used by TYPE. 2020-04-01 Fritz Reese <foreese@gcc.gnu.org> PR fortran/85982 * gfortran.dg/dec_structure_28.f90: New test.
2020-03-28[Fortran] Fix result-variable handling of MODULE PROCEDURE (PR94348)Tobias Burnus1-5/+12
PR fortran/94348 * decl.c (gfc_match_submod_proc): Add result var to the proc's namespace. PR fortran/94348 * gfortran.dg/module_procedure_3.f90: New.
2020-03-05Fortran: ICE in gfc_code2string PR93792Steven G. Kargl1-1/+10
A BOZ constant can not appear as a component inialiser for a derived type. gcc/fortran/ChangeLog: PR93792 * decl.c (variable_decl): If param and initializer check for BOZ, if found, output an error, set m to MATCH_ERROR and goto cleanup. gcc/testsuite/ChangeLog: PR93792 * gfortran.dg/pr93792.f90: New test.
2020-02-24fortran: ICE in gfc_conv_constant_to_tree PR93604Mark Eggleston1-0/+16
Using a BOZ constant in a structure constructor in a data statement resulted in an ICE. Output a "BOZ literal constant cannot appear in a structure constructor" error message instead. Original patch provided by Steven G. Kargl <kargl@gcc.gnu.org>. Test case added later. gcc/fortran/ChangeLog PR fortran/93604 * decl.c (gfc_match_data) : Check whether the data expression is a derived type and is a constructor. If a BOZ constant is encountered in the constructor output an error and return MATCH_ERROR. gcc/testsuite/ChangeLog PR fortran/93604 * gfortran.dg/pr93604.f90 : New test.
2020-01-09Fortran] PR84135 fix merging dimension into codimension array specTobias Burnus1-11/+10
PR fortran/84135 * array.c (gfc_set_array_spec): Fix shifting of codimensions when adding a dimension. * decl.c (merge_array_spec): Ditto. Fix using correct codimensions. PR fortran/84135 * gfortran.dg/coarray/codimension_3.f90: New. From-SVN: r280046
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-30Catch division by zero errors in array sizes.Thomas Koenig1-4/+27
2019-12-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/92961 * gfortran.h (gfc_seen_div0): Add declaration. * arith.h (gfc_seen_div0): Add definition. (eval_intrinsic): For integer division by zero, set gfc_seen_div0. * decl.c (variable_decl): If resolution resp. simplification fails for array spec and a division of zero error has been seen, return MATCH_ERROR. 2019-12-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/92961 * gfortran.dg/arith_divide_2.f90: New test. From-SVN: r279762
2019-11-10re PR fortran/92123 ([F2018/array-descriptor] Scalar allocatable/pointer ↵Paul Thomas1-11/+2
with array descriptor (via bind(C)): ICE with select rank or error scalar variable with POINTER or ALLOCATABLE in procedure with BIND(C) is not yet supported) 2019-11-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/92123 *decl.c (gfc_verify_c_interop_param): Remove error asserting that pointer or allocatable variables in a bind C procedure are not supported. Delete some trailing spaces. * trans-stmt.c (trans_associate_var): Correct the attempt to treat scalar pointer or allocatable temporaries as if they are array descriptors. 2019-11-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/92123 * gfortran.dg/bind_c_procs_3.f90 : New test. * gfortran.dg/ISO_Fortran_binding_15.c : New test. * gfortran.dg/ISO_Fortran_binding_15.f90 : Additional source. From-SVN: r278025
2019-11-01decl.c (match_byte_typespec): New function.Steven G. Kargl1-16/+36
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> * decl.c (match_byte_typespec): New function. Match BYTE type-spec. (gfc_match_decl_type_spec): Use it. 2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/byte_3.f: New test. * gfortran.dg/byte_4.f90: Ditto. From-SVN: r277715
2019-11-01re PR fortran/90988 (Wrong error message with variables named "PUBLIC*")Steven G. Kargl1-11/+16
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90988 * decl.c (gfc_match_private, gfc_match_public): Fixed-form source code does not require whitespace between PRIVATE (or PUBLIC) and an entity. 2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90988 * gfortran.dg/pr90988_4.f: New test. From-SVN: r277714
2019-10-22re PR fortran/92174 (runtime error: index 15 out of bounds for type ↵Steven G. Kargl1-9/+0
'gfc_expr *[15]) 2019-10-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/92174 * decl.c (attr_decl1): Move check for F2018:C822 from here ... * array.c (gfc_set_array_spec): ... to here. From-SVN: r277297
2019-10-15re PR fortran/89943 (Submodule functions are not allowed to have C binding)Steven G. Kargl1-22/+64
2019-10-14 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/89943 decl.c (gfc_match_function_decl): Ignore duplicate BIND(C) for function declaration in submodule. Implement at check for F2018 C1550. (gfc_match_entry): Use temporary for locus, which allows removal of one gfc_error_now(). (gfc_match_subroutine): Ignore duplicate BIND(C) for subroutine declaration in submodule. Implement at check for F2018 C1550. 2019-10-14 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/89943 * gfortran.dg/pr89943_1.f90: New test. * gfortran.dg/pr89943_2.f90: Ditto. * gfortran.dg/pr89943_3.f90: Ditto. * gfortran.dg/pr89943_4.f90: Ditto. From-SVN: r276983
2019-10-11re PR fortran/91715 (ICE in resolve_fntype, at fortran/resolve.c:16884)Steven G. Kargl1-6/+10
2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91715 * decl.c (gfc_match_prefix): If matching a type-spec returns an error, it's an error so re-act correctly. 2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91715 * gfortran.dg/function_kinds_5.f90: Prune run-on error. * gfortran.dg/pr85543.f90: Ditto. * gfortran.dg/pr91715.f90: New test. From-SVN: r276899
2019-10-05re PR fortran/47054 (Compilation error when cray pointers are declared in ↵Steven G. Kargl1-1/+1
both host and internal subroutines) 2019-10-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/47045 * decl.c (variable_decl): Do not search parent namespace for symbol. 2019-10-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/47045 * gfortran.dg/pr47054_1.f90: New test * gfortran.dg/pr47054_2.f90: Ditto. From-SVN: r276627
2019-10-04PR fortran.91959Steven G. Kargl1-27/+33
2019-10-04 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran.91959 * fortran/decl.c (variable_decl): Re-arrange code for matching %FILL. 2019-10-04 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran.91959 * gfortran.dg/pr91959.f90: New test. From-SVN: r276601
2019-10-03Character typenames in errors and warningsMark Eggleston1-1/+1
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-29re PR fortran/91714 (Accepts type statement without delimiter in free form)Steven G. Kargl1-2/+20
2019-09-29 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91714 * decl.c (gfc_match_decl_type_spec): Issue errors for a few mangled types. 2019-09-29 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91714 * gfortran.dg/dec_type_print_3.f90: Update dg-error regex. * gfortran.dg/pr91714.f90: New test. From-SVN: r276270
2019-09-29re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)Jerry DeLisle1-1/+1
2019-09-28 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/91802 * decl.c (attr_decl1): Return MATCH_ERROR without free to avoid bad expression type in free_expr0() ICE in rank+corank check. From-SVN: r276265
2019-09-28re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)Steven G. Kargl1-0/+9
2019-09-28 Steven G. Kargl <kargl@gcc.ngu.org> PR fortran/91802 * decl.c (attr_decl1): Check if rank+corank > 15. 2019-09-28 Steven G. Kargl <kargl@gcc.ngu.org> PR fortran/91802 * gfortran.dg/pr91802.f90: New test. From-SVN: r276254
2019-09-05re PR fortran/91660 (Missing error on invalid type declaration)Steven G. Kargl1-5/+20
2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91660 * decl.c (gfc_match_decl_type_spec): Improve and restore error message for malformed types-spec. 2019-09-05 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91660 * gfortran.dg/pdt_4.f03: Fix invalid code. * gfortran.dg/pr91660_1.f90: New test. * gfortran.dg/pr91660_2.f90: Ditto. From-SVN: r275426
2019-09-01array.c (spec_dimen_size): Check for the presence of expressions for the bounds.Paul Thomas1-0/+1
2019-09-01 Paul Thomas <pault@gcc.gnu.org> * array.c (spec_dimen_size): Check for the presence of expressions for the bounds. * decl.c (gfc_match_end): Add case COMP_SELECT_RANK. * dump-parse-tree.c(show_symbol): Show the arrayspec of class entities. (show_code_node): Show the code for SELECT_RANK. * expr.c (gfc_check_vardef_context): Omit the context of variable definition for select rank associate names since the ASSUMED RANK throws. * gfortran.h : Add ST_SELECT_RANK and ST_RANK to enum gfc_statement. Add select_rank_temporary to symbol attribute structure. Add EXEC_SELECT_RANK to enum gfc_exec_op. * match.c (match_exit_cycle): Add COMP_SELECT_RANK. (copy_ts_from_selector_to_associate): Add as special case for assumed rank class variables. (select_intrinsic_set_tmp): Clean up the code by using symbols for references to the temporary and the selector. (select_type_set_tmp): Ditto. (select_rank_set_tmp): New function. (gfc_match_select_rank): New function. (gfc_match_rank_is): New function. * match.h : Add prototypes for gfc_match_select_rank and gfc_match_rank_is. * parse.c (decode_statement): Attempt to match select_rank and rank statements. (next_statement, gfc_ascii_statement): Add ST_SELECT_RANK. (parse_select_rank_block): New function. (parse_executable): Parse select rank block for ST_SELECT_RANK. * parse.h : Add COMP_SELECT_RANK to enum gfc_compile_state. * resolve.c (resolve_variable): Exclude select_rank_temporaries from the check on use of ASSUMED RANK. (gfc_resolve_expr): Make sure that unlimited polymorphic select rank temporaries expressions are not resolved again after being successfully resolved. (resolve_assoc_var): Do not do the rank check for select rank temporaries. (resolve_select_rank): New function. (gfc_resolve_blocks): Deal with case EXEC_SELECT_RANK. (resolve_symbol): Exclude select rank temporaries for check on use of ASSUMED RANK. * st.c (gfc_free_statement): Include EXEC_SELECT_RANK. * trans-array.c (gfc_conv_array_ref): Select rank temporaries may have dimen == 0. (gfc_conv_expr_descriptor): Zero the offset of select rank temporaries. * trans-stmt.c (copy_descriptor): New function. (trans_associate_var): Add code to associate select rank temps. (gfc_trans_select_rank_cases): New function. (gfc_trans_select_rank): New function. * trans-stmt.h : Add prototype for gfc_trans_select_rank. trans.c (trans_code): Add select rank case. 2019-09-01 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/select_rank_1.f90 : New test. * gfortran.dg/select_rank_2.f90 : New test. From-SVN: r275269
2019-08-27re PR fortran/91496 (!GCC$ directives error if mistyped or unknown)Harald Anlauf1-0/+55
2019-08-27 Harald Anlauf <anlauf@gmx.de> PR fortran/91496 * gfortran.h: Extend struct gfc_iterator for loop annotations. * array.c (gfc_copy_iterator): Copy loop annotations by IVDEP, VECTOR, and NOVECTOR pragmas. * decl.c (gfc_match_gcc_ivdep, gfc_match_gcc_vector) (gfc_match_gcc_novector): New matcher functions handling IVDEP, VECTOR, and NOVECTOR pragmas. * match.h: Declare prototypes of matcher functions handling IVDEP, VECTOR, and NOVECTOR pragmas. * parse.c (decode_gcc_attribute, parse_do_block) (parse_executable): Decode IVDEP, VECTOR, and NOVECTOR pragmas; emit warning for unrecognized pragmas instead of error. * trans-stmt.c (gfc_trans_simple_do, gfc_trans_do): Add code to emit annotations for IVDEP, VECTOR, and NOVECTOR pragmas. * gfortran.texi: Document IVDEP, VECTOR, and NOVECTOR pragmas. PR fortran/91496 * gfortran.dg/pr91496.f90: New testcase. From-SVN: r274966
2019-08-17re PR fortran/78719 ([F03] ICE in gfc_get_symbol_decl, at ↵Steven G. Kargl1-3/+3
fortran/trans-decl.c:1438) 2019-08-17 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78719 * decl.c (get_proc_name): Check for a CLASS entity when trying to add attributes to an entity that already has an explicit interface. 2019-08-17 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78719 * gfortran.dg/pr78719_1.f90: New test. * gfortran.dg/pr78719_2.f90: Ditto. * gfortran.dg/pr78719_3.f90: Ditto. From-SVN: r274604
2019-08-10decl.c (match_old_style_init): Use a clearer error message.Steven G. Kargl1-3/+4
2019-08-10 Steven G. Kargl <kargl@gcc.gnu.org> * decl.c (match_old_style_init): Use a clearer error message. * expr.c (gfc_check_assign): Update BOZ checking to provide a stricter adherence to the Fortran standard. Use gfc_invalid_boz () to relax errors into warnings. * gfortran.h (gfc_isym_id): Add new ids GFC_ISYM_DFLOAT, GFC_ISYM_FLOAT, GFC_ISYM_REALPART, and GFC_ISYM_SNGL * intrinsic.c (add_functions): Use new ids to split REAL generic into REAL, FLOAT, DFLOAT, SNGL, and REALPART generics. (gfc_intrinsic_func_interface): Allow new intrinsics in an initialization expression * resolve.c (resolve_operator): Deal with BOZ as operands. Use gfc_invalid_boz to allow for errors or warnings via the -fallow-invalid-boz option. A BOZ cannot be an operand to an unary operator. Both operands of a binary operator cannot be BOZ. For binary operators, convert a BOZ operand into the type and kind of the other operand for REAL or INTEGER operand. * trans-intrinsic.c: Use new ids to cause conversions to happen. 2019-08-10 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/boz_8.f90: Adjust error messages. * gfortran.dg/nan_4.f90: Ditto. * gfortran.dg/boz_1.f90: Add -fallow-invalid-boz to dg-options, and test for warnings. * gfortran.dg/boz_3.f90: Ditto. * gfortran.dg/boz_4.f90: Ditto. * gfortran.dg/dec_structure_6.f90: Ditto. * gfortran.dg/ibits.f90: Ditto. From-SVN: r274257
2019-08-05re PR fortran/91372 (Error: Unclassifiable statement)Steven G. Kargl1-2/+3
2019-08-05 Steven g. Kargl <kargl@gcc.gnu.org> PR fortran/91372 * decl.c (gfc_match_data): Allow an implied do-loop to nestle against DATA. 2019-08-05 Steven g. Kargl <kargl@gcc.gnu.org> PR fortran/91372 * gfortran.dg/pr91372.f90: New test. From-SVN: r274122
2019-08-02re PR fortran/90985 (Wrong error message with variables named "DATA*")Steven G. Kargl1-0/+7
2019-08-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90985 * decl.c (gfc_match_data): In free-form code, DATA be followed by whitespace. 2019-08-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90985 * gfortran.dg/pr90985.f90: New test. From-SVN: r274033
2019-07-23arith.c (gfc_convert_integer, [...]): Move to ...Steven G. Kargl1-1/+20
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-07-03Remove another bunch of dead assignment.Martin Liska1-1/+0
2019-07-03 Martin Liska <mliska@suse.cz> * lra-eliminations.c (eliminate_regs_in_insn): Remove dead assignemts. * reg-stack.c (check_asm_stack_operands): Likewise. * tree-ssa-structalias.c (create_function_info_for): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Likewise. * config/i386/i386-expand.c (ix86_expand_sse2_mulvxdi3): Use force_expand_binop. 2019-07-03 Martin Liska <mliska@suse.cz> * c-common.c (try_to_locate_new_include_insertion_point): Remove dead assignemts. 2019-07-03 Martin Liska <mliska@suse.cz> * call.c (build_new_op_1): Remove dead assignemts. * typeck.c (cp_build_binary_op): Likewise. 2019-07-03 Martin Liska <mliska@suse.cz> * check.c (gfc_check_c_funloc): Remove dead assignemts. * decl.c (variable_decl): Likewise. * resolve.c (resolve_typebound_function): Likewise. * simplify.c (gfc_simplify_matmul): Likewise. (gfc_simplify_scan): Likewise. * trans-array.c (gfc_could_be_alias): Likewise. * trans-common.c (add_equivalences): Likewise. * trans-expr.c (trans_class_vptr_len_assignment): Likewise. (gfc_trans_array_constructor_copy): Likewise. (gfc_trans_assignment_1): Likewise. * trans-intrinsic.c (conv_intrinsic_atomic_op): Likewise. * trans-openmp.c (gfc_omp_finish_clause): Likewise. * trans-types.c (gfc_get_array_descriptor_base): Likewise. * trans.c (gfc_build_final_call): Likewise. 2019-07-03 Martin Liska <mliska@suse.cz> * line-map.c (linemap_get_expansion_filename): Remove dead assignemts. * mkdeps.c (make_write): Likewise. From-SVN: r272994
2019-06-26re PR fortran/90988 (Wrong error message with variables named "PUBLIC*")Steven G. Kargl1-51/+68
2019-06-24 Steven G. Kargl <kargl@gcc.gnu.org> PR Fortran/90988 * decl.c (access_attr_decl): Use temporary variable to reduce unreadability of code. Normalize jumping to return. (gfc_match_protected): Fix parsing error. Add comments to explain code. Remove dead code. (gfc_match_private): Use temporary variable to reduce unreadability of code. Fix parsing error. Move code to test for blank PRIVATE. Remove dead code. (gfc_match_public): Move code to test for blank PUBLIC. Fix parsing error. Remove dead code. 2019-06-24 Steven G. Kargl <kargl@gcc.gnu.org> PR Fortran/90988 * gfortran.dg/pr90988_1.f90: New test. * gfortran.dg/pr90988_2.f90: Ditto. * gfortran.dg/pr90988_3.f90: Ditto. From-SVN: r272667
2019-06-21re PR fortran/51991 (Wrong error message with variables named "SAVE*")Steven G. Kargl1-2/+7
2019-06-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/51991 * decl.c (gfc_match_save): If SAVE was not seen, return MATCH_NO instead issuing an error message and returning MATCH_ERROR. 2019-06-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/51991 gfortran.dg/pr51991.f90 From-SVN: r272556