aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-14Fortran : ICE in build_field PR95614Mark Eggleston1-2/+3
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-09-28Revert "Fortran : ICE in build_field PR95614"Mark Eggleston1-3/+2
This reverts commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc.
2020-09-27Fortran : ICE in build_field PR95614Mark Eggleston1-2/+3
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-07-10PR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645Harald Anlauf1-2/+3
Handle NULL pointer dereference on SELECT RANK with an invalid assumed-rank array declaration. gcc/fortran/ PR fortran/96086 * match.c (gfc_match_select_rank): Catch NULL pointer dereference. * resolve.c (resolve_assoc_var): Catch NULL pointer dereference that may occur after an illegal declaration.
2020-07-06PR fortran/95980 - ICE on using sync images with -fcheck=boundsHarald Anlauf1-3/+8
In SELECT TYPE, the argument may be an incorrectly specified unlimited polymorphic variable. Avoid a NULL pointer dereference for clean error recovery. gcc/fortran/ PR fortran/95980 * match.c (copy_ts_from_selector_to_associate, build_class_sym): Distinguish between unlimited polymorphic and ordinary variables to avoid NULL pointer dereference. * resolve.c (resolve_select_type): Distinguish between unlimited polymorphic and ordinary variables to avoid NULL pointer dereference.
2020-06-28PR fortran/95340 - ICE in gfc_match_select_rank, at fortran/match.c:6690Harald Anlauf1-1/+2
Do not dereference NULL pointer when querying array shape of possibly improperly delared variable. gcc/fortran/ PR fortran/95340 * match.c (gfc_match_select_rank): Do not dereference NULL pointer.
2020-06-25PR fortran/95828 - Buffer overflows with SELECT RANKHarald Anlauf1-1/+1
With SELECT RANK, name mangling results in long internal symbols that overflows internal buffers. Fix that. gcc/fortran/ PR fortran/95828 * match.c (select_rank_set_tmp): Enlarge internal buffer used in generating a mangled name. * resolve.c (resolve_select_rank): Likewise.
2020-06-20PR fortran/95587 - ICE in gfc_target_encode_expr, at fortran/target-memory.c:362Harald Anlauf1-0/+5
EQUIVALENCE objects are subject to constraints listed in the Fortran 2018 standard, section 8.10.1.1. These constraints are to be checked also for CLASS variables. gcc/fortran/ PR fortran/95587 * match.c (gfc_match_equivalence): Check constraints on EQUIVALENCE objects also for CLASS variables.
2020-05-28Fortran : "type is( real(kind(1.)) )" spurious syntax error PR94397Mark Eggleston1-1/+4
Based on a patch in the comments of the PR. That patch fixed this problem but caused the test cases for PR93484 to fail. It has been changed to reduce initialisation expressions if the expression is not EXPR_VARIABLE and not EXPR_CONSTANT. 2020-05-28 Steven G. Kargl <kargl@gcc.gnu.org> Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran/ PR fortran/94397 * match.c (gfc_match_type_spec): New variable ok initialised to true. Set ok with the return value of gfc_reduce_init_expr called only if the expression is not EXPR_CONSTANT and is not EXPR_VARIABLE. Add !ok to the check for type not being integer or the rank being greater than zero. 2020-05-28 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/94397 * gfortran.dg/pr94397.F90: New test.
2020-04-02[Fortran] Fix error cleanup of select rank (PR93522)Tobias Burnus1-0/+1
PR fortran/93522 * match.c (gfc_match_select_rank): Fix error cleanup. PR fortran/93522 * gfortran.dg/select_rank_4.f90: New.
2020-03-25fortran: ICE using undeclared symbol in array constructor PR93484Mark Eggleston1-2/+2
Using undeclared symbol k in an expression in the following array constructor results in an ICE: print *, [real(x(k))] If the call to the intrinsic is not in a constructor a no IMPLICIT type error is reported and the ICE does not occur. Matching on an expression instead of an initialisation express an and not converting a MATCH_ERROR return value into MATCH_NO results in the no IMPLICIT error and no ICE. Note: Steven G. Kargl <kargl@gcc.gnu.org> is the author of the changes except for the test cases. gcc/fortran/ChangeLog: PR fortran/93484 * match.c (gfc_match_type_spec): Replace gfc_match_init_expr with gfc_match_expr. Return m if m is MATCH_NO or MATCH_ERROR. gcc/testsuite PR fortran/93484 * gfortran.dg/pr93484_1.f90: New test. * gfortran.dg/pr93484_2.f90: New test.
2020-03-23fortran: ICE in gfc_match_assignment PR93600Mark Eggleston1-0/+8
This patch builds on the original patch by Steve Kargl that fixed the ICE and produced an "Unclassifiable statement at (1)" error. The processing of parameter variables now correctly handles zero length arrays used with %kind and %len. A side affect is that "Unclassifiable" error now says "Assignment to constant expression at (1)". It also fixes PR93365. gcc/fortran/ChangeLog: PR fortran/93600 * expr.c (simplify_parameter_variable): Check whether the ref chain contains INQUIRY_LEN or INQUIRY_KIND and set inquiry boolean. When an empty array has been identified and a new new EXPR_ARRAY expression has been created only return that expression if inquiry is not set. This allows the new expression to drop through to be simplified into a EXPR_CONSTANT representing %kind or %len. * match.c (gfc_match_assignment): If lvalue doesn't have a symtree free both lvalue and rvalue expressions and return an error. * resolv.c (gfc_resolve_ref): Ensure that code to handle INQUIRY_LEN is only performed for arrays with deferred types. gcc/testsuite/ChangeLog: PR fortran/93365 PR fortran/93600 * gfortran.dg/pr93365.f90: New test. * gfortran.dg/pr93600_1.f90: New test. * gfortran.dg/pr93600_2.f90: New test.
2020-03-01Patch and ChangeLogs for PR92976Paul Thomas1-2/+8
2020-02-24OpenACC tile clause – apply exit/cycle checks (PR 93552)Tobias Burnus1-5/+20
PR fortran/93552 * match.c (match_exit_cycle): With OpenACC, check the kernels loop directive and tile clause as well. PR fortran/93552 * gfortran.dg/goacc/tile-4.f90: New.
2020-02-18[Fortran] ICE: Invalid expression in gfc_element_size PR93601Mark Eggleston1-0/+10
ICE occurs when assigning a BOZ constant to an class(*) variable with the allocatable attribute. Use of BOZ constants outside data statements and int/real/dble/cmplx intrinsics is not allowed. Original patch provided by Steven G. Kargl <kargl@gcc.gnu.org>. gcc/fortran/ChangeLog PR fortran/93601 * match.c (gfc_match_assignment) : Reject assignment if the lhs stype is BT_CLASS and the rhs type is BT_BOZ. gcc/testsuite/ChangeLog PR fortran/93601 * gfortran.dg/pr93601.f90 : New test.
2020-02-18[Fortran] ICE in gfc_typenode_for_spec PR93603Mark Eggleston1-0/+8
Associating a symbol with a BOZ constant caused an ICE. Output an error message as an association target cannot be a BOZ constant. Original patch provided by Steven G. Kargl <kargl@gcc.gnu.org>. gcc/fortran/ChangeLog PR fortran/93603 * match.c (gfc_match_associate) : If target expression has the type BT_BOZ output an error and goto assocListError. gcc/testsuite/ChangeLog PR fortran/93603 * gfortran.dg/pr93603.f90 : New test.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-21re PR fortran/92990 (INVALID code with NULLIFY – partially misleading ↵Harald Anlauf1-0/+17
error message "If bounds remapping is specified at (1), the pointer target shall not be NULL") 2019-12-21 Harald Anlauf <anlauf@gmx.de> PR fortran/92990 * match.c (gfc_match_nullify): Check for valid pointer object. Reject bounds remapping. PR fortran/92990 * gfortran.dg/pr92990.f90: New test. From-SVN: r279698
2019-12-20Fortran] PR 92996 – fix rank resolution EXPR_ARRAYTobias Burnus1-3/+2
PR fortran/92996 gcc/fortran/ * expr.c (simplify_parameter_variable): Call gfc_resolve_ref and gfc_expression_rank; fix location info. * gfortran.h (gfc_resolve_ref, gfc_expression_rank): Declare. * match.c (gfc_match_stopcode): Remove redundant setting of gfc_init_expr_flag; early return if gfc_simplify_expr has an error. * resolve.c (gfc_expression_rank): Renamed from expression_rank; minor cleanup. (gfc_resolve_ref): Removed static and renamed from resolve_ref. (resolve_variable, resolve_typebound_function, resolve_typebound_subroutine, resolve_ppc_call, resolve_expr_ppc, gfc_resolve_expr, resolve_procedure): Update calls. PR fortran/92996 gcc/testsuite/ * gfortran.dg/array_simplify_4.f90: New. * gfortran.dg/pr91565.f90: Update dg-error. * gfortran.dg/pr91801.f90: Likewise. From-SVN: r279638
2019-11-12Add OpenACC 2.6 `serial' construct supportMaciej W. Rozycki1-1/+2
The `serial' construct (cf. section 2.5.3 of the OpenACC 2.6 standard) is equivalent to a `parallel' construct with clauses `num_gangs(1) num_workers(1) vector_length(1)' implied. These clauses are therefore not supported with the `serial' construct. All the remaining clauses accepted with `parallel' are also accepted with `serial'. The `serial' construct is implemented like `parallel', except for hardcoding dimensions rather than taking them from the relevant clauses, in `expand_omp_target'. Separate codes are used to denote the `serial' construct throughout the middle end, even though the mapping of `serial' to an equivalent `parallel' construct could have been done in the individual language frontends. In particular, this allows to distinguish between compute constructs in warnings, error messages, dumps etc. 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> Frederik Harwath <frederik@codesourcery.com> Thomas Schwinge <thomas@codesourcery.com> gcc/ * gimple.h (gf_mask): Add GF_OMP_TARGET_KIND_OACC_SERIAL enumeration constant. (is_gimple_omp_oacc): Handle GF_OMP_TARGET_KIND_OACC_SERIAL. (is_gimple_omp_offloaded): Likewise. * gimplify.c (omp_region_type): Add ORT_ACC_SERIAL enumeration constant. Adjust the value of ORT_NONE accordingly. (is_gimple_stmt): Handle OACC_SERIAL. (oacc_default_clause): Handle ORT_ACC_SERIAL. (gomp_needs_data_present): Likewise. (gimplify_adjust_omp_clauses): Likewise. (gimplify_omp_workshare): Handle OACC_SERIAL. (gimplify_expr): Likewise. * omp-expand.c (expand_omp_target): Handle GF_OMP_TARGET_KIND_OACC_SERIAL. (build_omp_regions_1, omp_make_gimple_edges): Likewise. * omp-low.c (is_oacc_parallel): Rename function to... (is_oacc_parallel_or_serial): ... this. Handle GF_OMP_TARGET_KIND_OACC_SERIAL. (scan_sharing_clauses): Adjust accordingly. (scan_omp_for): Likewise. (lower_oacc_head_mark): Likewise. (convert_from_firstprivate_int): Likewise. (lower_omp_target): Likewise. (check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_OACC_SERIAL. (lower_oacc_reductions): Likewise. (lower_omp_target): Likewise. * tree.def (OACC_SERIAL): New tree code. * tree-pretty-print.c (dump_generic_node): Handle OACC_SERIAL. * doc/generic.texi (OpenACC): Document OACC_SERIAL. gcc/c-family/ * c-pragma.h (pragma_kind): Add PRAGMA_OACC_SERIAL enumeration constant. * c-pragma.c (oacc_pragmas): Add "serial" entry. gcc/c/ * c-parser.c (OACC_SERIAL_CLAUSE_MASK): New macro. (c_parser_oacc_kernels_parallel): Rename function to... (c_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL. (c_parser_omp_construct): Update accordingly. gcc/cp/ * constexpr.c (potential_constant_expression_1): Handle OACC_SERIAL. * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro. (cp_parser_oacc_kernels_parallel): Rename function to... (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL. (cp_parser_omp_construct): Update accordingly. (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic order. * pt.c (tsubst_expr): Handle OACC_SERIAL. gcc/fortran/ * gfortran.h (gfc_statement): Add ST_OACC_SERIAL_LOOP, ST_OACC_END_SERIAL_LOOP, ST_OACC_SERIAL and ST_OACC_END_SERIAL enumeration constants. (gfc_exec_op): Add EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL enumeration constants. * match.h (gfc_match_oacc_serial): New prototype. (gfc_match_oacc_serial_loop): Likewise. * dump-parse-tree.c (show_omp_node, show_code_node): Handle EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL. * match.c (match_exit_cycle): Handle EXEC_OACC_SERIAL_LOOP. * openmp.c (OACC_SERIAL_CLAUSES): New macro. (gfc_match_oacc_serial_loop): New function. (gfc_match_oacc_serial): Likewise. (oacc_is_loop): Handle EXEC_OACC_SERIAL_LOOP. (resolve_omp_clauses): Handle EXEC_OACC_SERIAL. (oacc_code_to_statement): Handle EXEC_OACC_SERIAL and EXEC_OACC_SERIAL_LOOP. (gfc_resolve_oacc_directive): Likewise. * parse.c (decode_oacc_directive) <'s'>: Add case for "serial" and "serial loop". (next_statement): Handle ST_OACC_SERIAL_LOOP and ST_OACC_SERIAL. (gfc_ascii_statement): Likewise. Handle ST_OACC_END_SERIAL_LOOP and ST_OACC_END_SERIAL. (parse_oacc_structured_block): Handle ST_OACC_SERIAL. (parse_oacc_loop): Handle ST_OACC_SERIAL_LOOP and ST_OACC_END_SERIAL_LOOP. (parse_executable): Handle ST_OACC_SERIAL_LOOP and ST_OACC_SERIAL. (is_oacc): Handle EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Likewise. * st.c (gfc_free_statement): Likewise. * trans-openmp.c (gfc_trans_oacc_construct): Handle EXEC_OACC_SERIAL. (gfc_trans_oacc_combined_directive): Handle EXEC_OACC_SERIAL_LOOP. (gfc_trans_oacc_directive): Handle EXEC_OACC_SERIAL_LOOP and EXEC_OACC_SERIAL. * trans.c (trans_code): Likewise. gcc/testsuite/ * c-c++-common/goacc/parallel-dims.c: New test. * gfortran.dg/goacc/parallel-dims.f90: New test. libgomp/ * testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: New test. * testsuite/libgomp.oacc-fortran/parallel-dims-aux.c: New test. * testsuite/libgomp.oacc-fortran/parallel-dims.f89: New test. * testsuite/libgomp.oacc-fortran/parallel-dims-2.f90: New test. Reviewed-by: Thomas Schwinge <thomas@codesourcery.com> Co-Authored-By: Frederik Harwath <frederik@codesourcery.com> Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com> Co-Authored-By: Tobias Burnus <tobias@codesourcery.com> From-SVN: r278082
2019-10-02re PR fortran/91943 (ICE in gfc_conv_constant_to_tree, at ↵Steven G. Kargl1-0/+10
fortran/trans-const.c:370) 2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91943 * match.c (gfc_match_call): BOZ cannot be an actual argument in a subroutine reference. * resolve.c (resolve_function): BOZ cannot be an actual argument in a function reference. 2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91943 gfortran.dg/pr91943.f90 From-SVN: r276471
2019-09-28re PR fortran/91864 (ICE in gfc_check_do_variable, at fortran/parse.c:4405)Steven G. Kargl1-0/+18
2019-09-28 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91864 * gcc/fortran/io.c (match_io_element): An inquiry parameter cannot be read into. * gcc/fortran/match.c (gfc_match_allocate): An inquiry parameter can be neither an allocate-object nor stat variable. (gfc_match_deallocate): An inquiry parameter cannot be deallocated. 2019-09-28 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91864 * gcc/testsuite/gfortran.dg/pr91864.f90 From-SVN: r276253
2019-09-23re PR fortran/91729 (ICE in gfc_match_select_rank, at fortran/match.c:6586)Paul Thomas1-9/+25
2019-09-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/91729 * match.c (gfc_match_select_rank): Initialise 'as' to NULL. Check for a symtree in the selector expression before trying to assign a value to 'as'. Revert to gfc_error and go to cleanup after setting a MATCH_ERROR. 2019-09-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/91729 * gfortran.dg/select_rank_2.f90 : Add two more errors in foo2. * gfortran.dg/select_rank_3.f90 : New test. From-SVN: r276051
2019-09-01array.c (spec_dimen_size): Check for the presence of expressions for the bounds.Paul Thomas1-41/+386
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-17re PR fortran/78739 (ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1477)Steven G. Kargl1-0/+29
2019-08-17 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78739 * match.c (gfc_match_st_function): When matching a statement function, need to check if the statement function name shadows the function name. 2019-08-17 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78739 * fortran.dg/pr78739.f90: New test. From-SVN: r274605
2019-08-02re PR fortran/90297 (gcc/fortran/resolve.c: 2 * possibly redundant code ?)Steven G. Kargl1-0/+9
2019-08-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90297 * match.c (gfc_match_equivalence): Check that EQUIVALENCE is followed by '('. 2019-08-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90297 * gfortran.dg/equiv_10.f90: New test. From-SVN: r274031
2019-06-27re PR fortran/90987 (Wrong error message with variables named "COMMON*")Steven G. Kargl1-3/+25
2019-06-27 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90987 * match.c (gfc_match_common): Adjust parsing of fixed and free form source code containing, e.g., COMMONI. 2019-06-27 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90987 * gfortran.dg/common_1.f: new test. * gfortran.dg/common_26.f90: Ditto. From-SVN: r272756
2019-06-19re PR fortran/69499 ([F03] ICE-on-invalid on combining select type with ↵Steven G. Kargl1-0/+7
wrong statement) 2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69499 * match.c (gfc_match_select_type): SELECT TYPE is an executable statement, and cannot appear in MODULE or SUBMODULE scope. 2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69499 * gfortran.dg/pr69499.f90: New test. * gfortran.dg/module_error_1.f90: Update dg-error string. From-SVN: r272482
2019-05-06re PR fortran/90290 (-std=f2008 should reject non-constant stop and error ↵Steven G. Kargl1-3/+14
stop codes) 2019-05-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90290 * match.c (gfc_match_stopcode): Check F2008 condition on stop code. 2019-05-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90290 * gfortran.dg/pr90290.f90: New test. From-SVN: r270928
2019-05-01re PR fortran/60144 (Misleading error message when missing "then" after "if" ↵Dominique d'Humieres1-31/+53
and "else if") 2019-05-01 Dominique d'Humieres <dominiq@gcc.gnu.org> PR fortran/60144 * match.c (gfc_match_parens): Change the location for missing ')'. (gfc_match_if): Detect a missing '('. Remove the spurious named constant error. Change the wording of some errors. (gfc_match_else): Change the wording of an error. (gfc_match_elseif): Detect a missing '('. Improve the matching process to get a better syntax analysis. PR fortran/60144 * gfortran.dg/block_name_2.f90: Adjust dg-error. * gfortran.dg/dec_type_print_3.f90.f90: Likewise * gfortran.dg/pr60144.f90: New test. From-SVN: r270776
2019-03-12re PR fortran/87673 (Errors caused by using function for character length in ↵Thomas Koenig1-2/+0
allocate with typespec) 2019-03-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87673 * match.c (gfc_match_type_spec): Remove call to gfc_resolve_expr for character length. 2019-03-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87673 * gfortran.dg/charlen_17.f90: New test. From-SVN: r269624
2019-01-09PR other/16615 [1/5]Sandra Loosemore1-1/+1
2019-01-09 Sandra Loosemore <sandra@codesourcery.com> PR other/16615 [1/5] contrib/ * mklog: Mechanically replace "can not" with "cannot". gcc/ * Makefile.in: Mechanically replace "can not" with "cannot". * alias.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * common/config/i386/i386-common.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/sync.md: Likewise. * config/arc/arc.c: Likewise. * config/arc/predicates.md: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/cortex-r4f.md: Likewise. * config/csky/csky.c: Likewise. * config/csky/csky.h: Likewise. * config/darwin-f.c: Likewise. * config/epiphany/epiphany.md: Likewise. * config/i386/i386.c: Likewise. * config/i386/sol2.h: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/mips/20kc.md: Likewise. * config/mips/sb1.md: Likewise. * config/nds32/nds32.c: Likewise. * config/nds32/predicates.md: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/e300c2c3.md: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.h: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh.md: Likewise. * config/spu/vmx2spu.h: Likewise. * cprop.c: Likewise. * dbxout.c: Likewise. * df-scan.c: Likewise. * doc/cfg.texi: Likewise. * doc/extend.texi: Likewise. * doc/fragments.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/lto.texi: Likewise. * doc/md.texi: Likewise. * doc/objc.texi: Likewise. * doc/rtl.texi: Likewise. * doc/tm.texi: Likewise. * dse.c: Likewise. * emit-rtl.c: Likewise. * emit-rtl.h: Likewise. * except.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * genautomata.c: Likewise. * gimple-fold.c: Likewise. * hard-reg-set.h: Likewise. * ifcvt.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-fnsummary.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * ira.h: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-streamer-out.c: Likewise. * postreload-gcse.c: Likewise. * predict.c: Likewise. * profile-count.h: Likewise. * profile.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * symtab.c: Likewise. * target.def: Likewise. * toplev.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-core.h: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-profile.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phionlycprop.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssanames.c: Likewise. * tree-streamer-out.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * vr-values.c: Likewise. gcc/ada/ * exp_ch9.adb: Mechanically replace "can not" with "cannot". * libgnat/s-regpat.ads: Likewise. * par-ch4.adb: Likewise. * set_targ.adb: Likewise. * types.ads: Likewise. gcc/cp/ * cp-tree.h: Mechanically replace "can not" with "cannot". * parser.c: Likewise. * pt.c: Likewise. gcc/fortran/ * class.c: Mechanically replace "can not" with "cannot". * decl.c: Likewise. * expr.c: Likewise. * gfc-internals.texi: Likewise. * intrinsic.texi: Likewise. * invoke.texi: Likewise. * io.c: Likewise. * match.c: Likewise. * parse.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * symbol.c: Likewise. * trans-array.c: Likewise. * trans-decl.c: Likewise. * trans-intrinsic.c: Likewise. * trans-stmt.c: Likewise. gcc/go/ * go-backend.c: Mechanically replace "can not" with "cannot". * go-gcc.cc: Likewise. gcc/lto/ * lto-partition.c: Mechanically replace "can not" with "cannot". * lto-symtab.c: Likewise. * lto.c: Likewise. gcc/objc/ * objc-act.c: Mechanically replace "can not" with "cannot". libbacktrace/ * backtrace.h: Mechanically replace "can not" with "cannot". libgcc/ * config/c6x/libunwind.S: Mechanically replace "can not" with "cannot". * config/tilepro/atomic.h: Likewise. * config/vxlib-tls.c: Likewise. * generic-morestack-thread.c: Likewise. * generic-morestack.c: Likewise. * mkmap-symver.awk: Likewise. libgfortran/ * caf/single.c: Mechanically replace "can not" with "cannot". * io/unit.c: Likewise. libobjc/ * class.c: Mechanically replace "can not" with "cannot". * objc/runtime.h: Likewise. * sendmsg.c: Likewise. liboffloadmic/ * include/coi/common/COIResult_common.h: Mechanically replace "can not" with "cannot". * include/coi/source/COIBuffer_source.h: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h: Mechanically replace "can not" with "cannot". From-SVN: r267783
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-12-09re PR fortran/88206 (ICE in gfc_match_type_spec, at fortran/match.c:2229)Steven G. Kargl1-0/+5
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88206 * match.c (gfc_match_type_spec): REAL can be an intrinsic function. 2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88206 * gfortran.dg/pr88206.f90: New test. From-SVN: r266930
2018-11-01re PR fortran/40196 ([F03] [F08] Type parameter inquiry (str%len, a%kind) ↵Paul Thomas1-0/+8
and Complex parts (z%re, z%im)) 2018-11-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/40196 * dependency.c (are_identical_variables): Return false if the inquiry refs are not the same. (gfc_ref_needs_temporary_p): Break on an inquiry ref. * dump_parse_tree.c (show_ref): Show the inquiry ref type. * expr.c (gfc_free_ref_list): Break on an inquiry ref. (gfc_copy_ref): Copy the inquiry ref types. (find_inquiry_ref): New function. (simplify_const_ref, simplify_ref_chain): Call it. Add new arg to simplify_ref_chain. (gfc_simplify_expr): Use the new arg in call to simplify_ref_chain. (gfc_get_full_arrayspec_from_expr, gfc_is_coarray): Break on inquiry ref. (gfc_traverse_expr): Return true for inquiry ref. * frontend-passes.c (gfc_expr_walker): Break on inquiry ref. * gfortran.h : Add enums and union member in gfc_ref to implement inquiry refs. * intrinsic.c : Fix white nois. * match.c (gfc_match_assignment): A constant lavlue is an error. * module.c : Add DECL_MIO_NAME for inquiry_type and the mstring for inquiry_types. (mio_ref): Handle inquiry refs. * primary.c (is_inquiry_ref): New function. (gfc_match_varspec): Handle inquiry refs calling new function. (gfc_variable_attr): Detect inquiry ref for disambiguation with components. (caf_variable_attr): Treat inquiry and substring refs in the same way. * resolve.c (find_array_spec): ditto. (gfc_resolve_substring_charlen): If there is neither a charlen ref not an inquiry ref, return. (resolve_ref): Handle inqiry refs as appropriate. (resolve_allocate_expr): Entities with an inquiry ref cannot be allocated. * simplify.c (simplify_bound, simplify_cobound): Punt on inquiry refs. * trans-array.c (get_array_ctor_var_strlen): Break on inquiry ref. *trans-expr.c (conv_inquiry): New function. (gfc_conv_variable): Retain the last typespec to pass to conv_inquiry on detecting an inquiry ref. 2018-11-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/40196 * gfortran.dg/inquiry_part_ref_1.f08: New test. * gfortran.dg/inquiry_part_ref_2.f90: New test. * gfortran.dg/inquiry_part_ref_3.f90: New test. From-SVN: r265729
2018-09-16fix PR 86484 and PR 84543Janus Weil1-0/+3
2018-09-16 Janus Weil <janus@gcc.gnu.org> PR fortran/86484 PR fortran/84543 * match.c (gfc_match_assignment): For a polymorphic assignment, make sure that the vtab for the rhs type is generated. 2018-09-16 Janus Weil <janus@gcc.gnu.org> PR fortran/86484 PR fortran/84543 * gfortran.dg/class_assign_2.f90: New test case. * gfortran.dg/class_assign_3.f90: New test case. From-SVN: r264350
2018-08-22re PR fortran/86935 (Bad locus in ASSOCIATE statement)Janus Weil1-8/+12
fix PR 86935 2018-08-22 Janus Weil <janus@gcc.gnu.org> PR fortran/86935 * match.c (gfc_match_associate): Improve diagnostics for the ASSOCIATE statement. 2018-08-22 Janus Weil <janus@gcc.gnu.org> PR fortran/86935 * gfortran.dg/associate_3.f90: Update error message. * gfortran.dg/associate_39.f90: New test case. From-SVN: r263787
2018-05-25re PR fortran/85839 ([F2018] warn for obsolescent features)Janus Weil1-0/+7
2018-05-25 Janus Weil <janus@gcc.gnu.org> PR fortran/85839 * match.c (gfc_match_block_data): Call gfc_notify_std to warn about an obsolescent feature in Fortran 2018. (gfc_match_equivalence): Ditto. * resolve.c (resolve_common_blocks): Ditto. (gfc_resolve_forall): Ditto. * symbol.c (gfc_define_st_label): Ditto. 2018-05-25 Janus Weil <janus@gcc.gnu.org> PR fortran/85839 * gfortran.dg/f2018_obs.f90: New test case. From-SVN: r260705
2018-05-22re PR fortran/85841 ([F2018] reject deleted features)Janus Weil1-7/+7
2018-05-22 Janus Weil <janus@gcc.gnu.org> PR fortran/85841 * libgfortran.h: Remove the macros GFC_STD_F2008_TS and GFC_STD_OPT_F08TS. * error.c (notify_std_msg): Remove GFC_STD_F2008_TS. * options.c (set_default_std_flags): Ditto. (gfc_handle_option): Make -std=f2008ts an alias for -std=f2018. * array.c (gfc_match_array_spec): Replace GFC_STD_F2008_TS by GFC_STD_F2018. * check.c (gfc_check_atomic, gfc_check_event_query, gfc_check_c_f_pointer, gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc, gfc_check_num_images, gfc_check_this_image): Ditto. * decl.c (gfc_verify_c_interop_param, gfc_match_decl_type_spec): Ditto. * intrinsic.c (add_functions, add_subroutines, gfc_check_intrinsic_standard): Ditto. * iso-c-binding.def: Ditto. * iso-fortran-env.def: Ditto. * match.c (gfc_match_event_post, gfc_match_event_wait, gfc_match_fail_image, gfc_match_form_team, gfc_match_change_team, gfc_match_end_team, gfc_match_sync_team): Ditto. * gfortran.texi: Remove mention of -std=f2008ts. Move TSs into F2018 section. * invoke.texi: Update documentation of -std=f2008ts. 2018-05-22 Janus Weil <janus@gcc.gnu.org> PR fortran/85841 * gfortran.dg/assumed_rank_5.f90: Update error message. * gfortran.dg/assumed_type_4.f90: Ditto. * gfortran.dg/bind_c_array_params.f03: Ditto. * gfortran.dg/bind_c_usage_28.f90: Ditto. * gfortran.dg/c_funloc_tests_5.f03: Ditto. * gfortran.dg/c_funloc_tests_6.f90: Ditto. * gfortran.dg/c_loc_tests_11.f03: Ditto. * gfortran.dg/coarray_atomic_2.f90: Ditto. * gfortran.dg/coarray_collectives_2.f90: Ditto. * gfortran.dg/coarray_collectives_10.f90: Ditto. * gfortran.dg/coarray_collectives_13.f90: Ditto. * gfortran.dg/rank_3.f90: Ditto. * gfortran.dg/error_stop_4.f90: Replace -std=f2008ts by -std=f2008. * gfortran.dg/implicit_14.f90: Ditto. From-SVN: r260499
2018-05-21re PR fortran/85841 ([F2018] reject deleted features)Janus Weil1-6/+6
2018-05-21 Janus Weil <janus@gcc.gnu.org> PR fortran/85841 * libgfortran.h: New macros GFC_STD_OPT_*. * error.c (notify_std_msg): New function. (gfc_notify_std): Adjust such that it can handle combinations of GFC_STD_* flags in the 'std' argument, not just a single one. * match.c (match_arithmetic_if, gfc_match_if): Reject arithmetic if in Fortran 2018. (gfc_match_stopcode): Use GFC_STD_OPT_* macros. * options.c (set_default_std_flags): Warn for F2018 deleted features by default. (gfc_handle_option): F2018 deleted features are allowed in earlier standards. * symbol.c (gfc_define_st_label, gfc_reference_st_label): Reject nonblock do constructs in Fortran 2018. 2018-05-21 Janus Weil <janus@gcc.gnu.org> PR fortran/85841 * gfortran.dg/g77/19990826-3.f: Add option "-std=legacy". * gfortran.dg/g77/20020307-1.f: Ditto. * gfortran.dg/g77/980310-3.f: Ditto. * gfortran.dg/goacc/loop-1-2.f95: Ditto. * gfortran.dg/goacc/loop-1.f95: Ditto. * gfortran.dg/gomp/appendix-a/a.6.1.f90: Ditto. * gfortran.dg/gomp/appendix-a/a.6.2.f90: Ditto. * gfortran.dg/gomp/do-1.f90: Ditto. * gfortran.dg/gomp/omp_do1.f90: Ditto. * gfortran.dg/pr17229.f: Ditto. * gfortran.dg/pr37243.f: Ditto. * gfortran.dg/pr49721-1.f: Ditto. * gfortran.dg/pr58484.f: Ditto. * gfortran.dg/pr81175.f: Ditto. * gfortran.dg/pr81723.f: Ditto. * gfortran.dg/predcom-2.f: Ditto. * gfortran.dg/vect/Ofast-pr50414.f90: Ditto. * gfortran.dg/vect/cost-model-pr34445a.f: Ditto. * gfortran.dg/vect/fast-math-mgrid-resid.f: Ditto. * gfortran.dg/vect/pr52580.f: Ditto. From-SVN: r260433
2018-05-20re PR fortran/82923 (Automatic allocation of deferred length character using ↵Paul Thomas1-6/+21
function result) 2018-05-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/82923 PR fortran/66694 PR fortran/82617 * trans-array.c (gfc_alloc_allocatable_for_assignment): Set the charlen backend_decl of the rhs expr to ss->info->string_length so that the value in the current scope is used. 2018-05-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/82923 * gfortran.dg/allocate_assumed_charlen_4.f90: New test. Note that the patch fixes PR66694 & PR82617, although the testcases are not explicitly included. From-SVN: r260413
2018-02-14re PR fortran/84385 ([F03] Reject invalid SELECT TYPE selector ↵Janus Weil1-1/+2
(allocate_with_source_22.f03)) 2018-02-14 Janus Weil <janus@gcc.gnu.org> PR fortran/84385 * match.c (gfc_match_select_type): Fix check for selector in SELECT TYPE statement. 2018-02-14 Janus Weil <janus@gcc.gnu.org> PR fortran/84385 * gfortran.dg/allocate_with_source_22.f03: Fix invalid test case. * gfortran.dg/allocate_with_source_23.f90: Ditto. * gfortran.dg/select_type_1.f03: Extend test case. From-SVN: r257673
2018-02-07re PR fortran/82994 (ICE in gfc_match_deallocate, at fortran/match.c:4478)Steven G. Kargl1-2/+2
2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82994 * match.c (gfc_match_deallocate): Check for NULL pointer. 2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82994 * gfortran.dg/deallocate_error_3.f90: New test. * gfortran.dg/deallocate_error_4.f90: New test. From-SVN: r257465
2018-02-07re PR fortran/82049 (ICE with character(*),parameter array constructor)Steven G. Kargl1-1/+9
2018-02-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82049 * match.c (gfc_match_type_spec): If the charlen is non-NULL, then try to resolve it. While here return early if possible. 2018-02-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82049 * gfortran.dg/assumed_charlen_parameter.f90: New test. From-SVN: r257459
2018-01-26Partial Failed Images patchDamian Rouson1-0/+129
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> Co-Authored-By: Soren Rasmussen <s.c.rasmussen@gmail.com> From-SVN: r257105
2018-01-09match.c (gfc_match_allocate): Check for NULL pointer.Steven G. Kargl1-1/+1
2018-01-08 Steven G. Kargl <kargl@gcc.gnu.org> * match.c (gfc_match_allocate): Check for NULL pointer. From-SVN: r256364
2018-01-05PR 78534 Change character length from int to size_tJanne Blomqvist1-4/+4
In order to handle large character lengths on (L)LP64 targets, switch the GFortran character length from an int to a size_t. This is an ABI change, as procedures with character arguments take hidden arguments with the character length. I also changed the _size member in vtables from int to size_t, as there were some cases where character lengths and sizes were apparently mixed up and caused regressions otherwise. Although I haven't tested, this might enable very large derived types as well. Also, as there are some places in the frontend were negative character lengths are used as special flag values, in the frontend the character length is handled as a signed variable of the same size as a size_t, although in the runtime library it really is size_t. I haven't changed the character length variables for the co-array intrinsics, as this is something that may need to be synchronized with OpenCoarrays. This is v5 of the patch. v4 was applied but caused breakage on big endian targets. These have been fixed and tested, thanks to access to the GCC compile farm. Overview of v4 of the patch: v3 was applied but had to reverted due to breaking bootstrap. The fix is in resolve.c:resolve_charlen, where it's necessary to check that an expression is constant before using mpz_sgn. Overview of v3 of the patch: All the issues pointed out by FX's review of v2 have been fixed. In particular, there are now new functions gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT instead of a long value. Similarly, gfc_get_int_expr now takes a HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by gfc_extract_hwi. Also, the preliminary work to handle gfc_charlen_type_node being unsigned has been removed. Regtested on x86_64-pc-linux-gnu, i686-pc-linux-gnu and powerpc64-unknown-linux-gnu. Also regtested all three targets by modifying gfortran-dg.exp to also test with "-g -flto", no new failures observed. frontend: 2018-01-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * array.c (got_charlen): Use gfc_charlen_int_kind. * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of hardcoded kind. (find_intrinsic_vtab): Likewise. * decl.c (match_char_length): Use gfc_charlen_int_kind. (add_init_expr_to_sym): Use gfc_charlen_t and gfc_charlen_int_kind. (gfc_match_implicit): Use gfc_charlen_int_kind. * dump-parse-tree.c (show_char_const): Use gfc_charlen_t and size_t. (show_expr): Use HOST_WIDE_INT_PRINT_DEC. * expr.c (gfc_get_character_expr): Length parameter of type gfc_charlen_t. (gfc_get_int_expr): Value argument of type HOST_WIDE_INT. (gfc_extract_hwi): New function. (simplify_const_ref): Make string_len of type gfc_charlen_t. (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs. * frontend-passes.c (optimize_trim): Use gfc_charlen_int_kind. * gfortran.h (gfc_mpz_get_hwi): New prototype. (gfc_mpz_set_hwi): Likewise. (gfc_charlen_t): New typedef. (gfc_expr): Use gfc_charlen_t for character lengths. (gfc_size_kind): New extern variable. (gfc_extract_hwi): New prototype. (gfc_get_character_expr): Use gfc_charlen_t for character length. (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument. * gfortran.texi: Update description of hidden string length argument. * iresolve.c (check_charlen_present): Use gfc_charlen_int_kind. (gfc_resolve_char_achar): Likewise. (gfc_resolve_repeat): Pass string length directly without temporary, use gfc_charlen_int_kind. (gfc_resolve_transfer): Use gfc_charlen_int_kind. * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen. * misc.c (gfc_mpz_get_hwi): New function. (gfc_mpz_set_hwi): New function. * module.c (atom_int): Change type from int to HOST_WIDE_INT. (parse_integer): Don't complain about large integers. (write_atom): Use HOST_WIDE_INT for integers. (mio_integer): Handle integer type mismatch. (mio_hwi): New function. (mio_intrinsic_op): Use HOST_WIDE_INT. (mio_array_ref): Likewise. (mio_expr): Likewise. * primary.c (match_substring): Use gfc_charlen_int_kind. * resolve.c (resolve_substring_charlen): Use gfc_charlen_int_kind. (resolve_character_operator): Likewise. (resolve_assoc_var): Likewise. (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf. (resolve_charlen): Use mpz_sgn to determine sign. * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t instead of long. * symbol.c (generate_isocbinding_symbol): Use gfc_charlen_int_kind. * target-memory.c (size_character): Length argument of type gfc_charlen_t. (gfc_encode_character): Likewise. (gfc_interpret_character): Use gfc_charlen_t. * target-memory.h (gfc_encode_character): Modify prototype. * trans-array.c (gfc_trans_array_ctor_element): Use existing type. (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type. (trans_array_constructor): Use existing type. (get_array_charlen): Likewise. * trans-const.c (gfc_conv_mpz_to_tree_type): New function. * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype. * trans-decl.c (gfc_trans_deferred_vars): Use existing type. (add_argument_checking): Likewise. * trans-expr.c (gfc_class_len_or_zero_get): Build const of type gfc_charlen_type_node. (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of 4, fold_convert to correct type. (gfc_conv_class_to_class): Build const of type size_type_node for size. (gfc_copy_class_to_class): Likewise. (gfc_conv_string_length): Use same type in expression. (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen. (gfc_conv_string_tmp): Make sure len is of the right type. (gfc_conv_concat_op): Use same type in expression. (gfc_conv_procedure_call): Likewise. (fill_with_spaces): Comment out memset() block due to spurious -Wstringop-overflow warnings. (gfc_trans_string_copy): Use gfc_charlen_type_node. (alloc_scalar_allocatable_for_subcomponent_assignment): fold_convert to right type. (gfc_trans_subcomponent_assign): Likewise. (trans_class_vptr_len_assignment): Build const of correct type. (gfc_trans_pointer_assignment): Likewise. (alloc_scalar_allocatable_for_assignment): fold_convert to right type in expr. (trans_class_assignment): Build const of correct type. * trans-intrinsic.c (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_repeat): Do calculation in sizetype. * trans-io.c (gfc_build_io_library_fndecls): Use gfc_charlen_type_node for character lengths. (set_string): Convert to right type in assignment. * trans-stmt.c (gfc_trans_label_assign): Build const of gfc_charlen_type_node. (trans_associate_var): Likewise. (gfc_trans_character_select): Likewise. (gfc_trans_allocate): Likewise, don't typecast strlen result. (gfc_trans_deallocate): Don't typecast strlen result. * trans-types.c (gfc_size_kind): New variable. (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind from size_type_node. * trans-types.h: Fix comment. testsuite: 2018-01-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * gfortran.dg/char_cast_1.f90: Update scan pattern. * gfortran.dg/dependency_49.f90: Likewise. * gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T. * gfortran.dg/repeat_7.f90: New test for PR 66310. * gfortran.dg/scan_2.f90: Handle potential cast in assignment. * gfortran.dg/string_1.f90: Limit to ilp32 targets. * gfortran.dg/string_1_lp64.f90: New test. * gfortran.dg/string_3.f90: Limit to ilp32 targets. * gfortran.dg/string_3_lp64.f90: New test. libgfortran: 2019-01-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 * intrinsics/args.c (getarg_i4): Use gfc_charlen_type. (get_command_argument_i4): Likewise. (get_command_i4): Likewise. * intrinsics/chmod.c (chmod_internal): Likewise. * intrinsics/env.c (get_environment_variable_i4): Likewise. * intrinsics/extends_type_of.c (struct vtype): Use size_t for size member. * intrinsics/gerror.c (gerror): Use gfc_charlen_type. * intrinsics/getlog.c (getlog): Likewise. * intrinsics/hostnm.c (hostnm_0): Likewise. * intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to work if gfc_charlen_type is unsigned. (string_scan): Likewise. * io/transfer.c (transfer_character): Modify prototype. (transfer_character_write): Likewise. (transfer_character_wide): Likewise. (transfer_character_wide_write): Likewise. (transfer_array): Typecast to avoid signed-unsigned comparison. * io/unit.c (is_trim_ok): Use gfc_charlen_type. * io/write.c (namelist_write): Likewise. * libgfortran.h (gfc_charlen_type): Change typedef to size_t. From-SVN: r256284
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-12-28re PR fortran/83548 (Compilation Error using logical function in parameter)Steven G. Kargl1-13/+17
2017-12-28 Steven G. Kargl <kargl@gcc.gnu.org> PR Fortran/83548 * match.c (gfc_match_type_spec): Check for LOGICAL conflict in type-spec versus LOGICAL intrinsic subprogram. 2017-12-28 Steven G. Kargl <kargl@gcc.gnu.org> PR Fortran/83548 * gfortran.dg/array_constructor_type_22.f03: New test. From-SVN: r256022
2017-12-22extend.texi (Loop-Specific Pragmas): Document pragma GCC unroll.Eric Botcazou1-1/+1
* doc/extend.texi (Loop-Specific Pragmas): Document pragma GCC unroll. c-family/ * c-pragma.c (init_pragma): Register pragma GCC unroll. * c-pragma.h (enum pragma_kind): Add PRAGMA_UNROLL. c/ * c-parser.c (c_parser_while_statement): Add unroll parameter and build ANNOTATE_EXPR if present. Add 3rd operand to ANNOTATE_EXPR. (c_parser_do_statement): Likewise. (c_parser_for_statement): Likewise. (c_parser_statement_after_labels): Adjust calls to above. (c_parse_pragma_ivdep): New static function. (c_parser_pragma_unroll): Likewise. (c_parser_pragma) <PRAGMA_IVDEP>: Add support for pragma Unroll. <PRAGMA_UNROLL>: New case. cp/ * constexpr.c (cxx_eval_constant_expression) <ANNOTATE_EXPR>: Remove assertion on 2nd operand. (potential_constant_expression_1): Likewise. * cp-tree.def (RANGE_FOR_STMT): Take a 5th operand. * cp-tree.h (RANGE_FOR_UNROLL): New macro. (cp_convert_range_for): Adjust prototype. (finish_while_stmt_cond): Likewise. (finish_do_stmt): Likewise. (finish_for_cond): Likewise. * init.c (build_vec_init): Adjut call to finish_for_cond. * parser.c (cp_parser_statement): Adjust call to cp_parser_iteration_statement. (cp_parser_for): Add unroll parameter and pass it in calls to cp_parser_range_for and cp_parser_c_for. (cp_parser_c_for): Add unroll parameter and pass it in call to finish_for_cond. (cp_parser_range_for): Add unroll parameter, set in on RANGE_FOR_STMT and pass it in call to cp_convert_range_for. (cp_convert_range_for): Add unroll parameter and pass it in call to finish_for_cond. (cp_parser_iteration_statement): Add unroll parameter and pass it in calls to finish_while_stmt_cond, finish_do_stmt and cp_parser_for. (cp_parser_pragma_ivdep): New static function. (cp_parser_pragma_unroll): Likewise. (cp_parser_pragma) <PRAGMA_IVDEP>: Add support for pragma Unroll. <PRAGMA_UNROLL>: New case. * pt.c (tsubst_expr) <FOR_STMT>: Adjust call to finish_for_cond. <RANGE_FOR_STMT>: Pass unrolling factor to cp_convert_range_for. <WHILE_STMT>: Adjust call to finish_while_stmt_cond. <DO_STMT>: Adjust call to finish_do_stmt. * semantics.c (finish_while_stmt_cond): Add unroll parameter and build ANNOTATE_EXPR if present. (finish_do_stmt): Likewise. (finish_for_cond): Likewise. (begin_range_for_stmt): Build RANGE_FOR_STMT with 5th operand. fortran/ * array.c (gfc_copy_iterator): Copy unroll field. * decl.c (directive_unroll): New global variable. (gfc_match_gcc_unroll): New function. * gfortran.h (gfc_iterator]): Add unroll field. (directive_unroll): Declare: * match.c (gfc_match_do): Use memset to initialize the iterator. * match.h (gfc_match_gcc_unroll): New prototype. * parse.c (decode_gcc_attribute): Match "unroll". (parse_do_block): Set iterator's unroll. (parse_executable): Diagnose misplaced unroll directive. * trans-stmt.c (gfc_trans_simple_do) Annotate loop condition with annot_expr_unroll_kind. (gfc_trans_do): Likewise. * gfortran.texi (GNU Fortran Compiler Directives): Split section into subections 'ATTRIBUTES directive' and 'UNROLL directive'. From-SVN: r255973