aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/array.c
AgeCommit message (Collapse)AuthorFilesLines
2020-04-20PR fortran/93364 - ICE in gfc_set_array_spec, at fortran/array.c:879Harald Anlauf1-0/+4
Add missing check in gfc_set_array_spec for sum of rank and corank to not exceed GFC_MAX_DIMENSIONS. 2020-04-20 Harald Anlauf <anlauf@gmx.de> PR fortran/93364 * array.c (gfc_set_array_spec): Check for sum of rank and corank not exceeding GFC_MAX_DIMENSIONS. 2020-04-20 Harald Anlauf <anlauf@gmx.de> PR fortran/93364 * gfortran.dg/pr93364.f90: New test.
2020-03-17Fix up duplicated duplicated words mostly in commentsJakub Jelinek1-1/+1
In the r10-7197-gbae7b38cf8a21e068ad5c0bab089dedb78af3346 commit I've noticed duplicated word in a message, which lead me to grep for those and we have a tons of them. I've used grep -v 'long long\|optab optab\|template template\|double double' *.[chS] */*.[chS] *.def config/*/* 2>/dev/null | grep ' \([a-zA-Z]\+\) \1 ' Note, the command will not detect the doubled words at the start or end of line or when one of the words is at the end of line and the next one at the start of another one. Some of it is fairly obvious, e.g. all the "the the" cases which is something I've posted and committed patch for already e.g. in 2016, other cases are often valid, e.g. "that that" seems to look mostly ok to me. Some cases are quite hard to figure out, I've left out some of them from the patch (e.g. "and and" in some cases isn't talking about bitwise/logical and and so looks incorrect, but in other cases it is talking about those operations). In most cases the right solution seems to be to remove one of the duplicated words, but not always. I think most important are the ones with user visible messages (in the patch 3 of the first 4 hunks), the rest is just comments (and internal documentation; for that see the doc/tm.texi changes). 2020-03-17 Jakub Jelinek <jakub@redhat.com> * lra-spills.c (remove_pseudos): Fix up duplicated word issue in a dump message. * tree-sra.c (create_access_replacement): Fix up duplicated word issue in a comment. * read-rtl-function.c (find_param_by_name, function_reader::parse_enum_value, function_reader::get_insn_by_uid): Likewise. * spellcheck.c (get_edit_distance_cutoff): Likewise. * tree-data-ref.c (create_ifn_alias_checks): Likewise. * tree.def (SWITCH_EXPR): Likewise. * selftest.c (assert_str_contains): Likewise. * ipa-param-manipulation.h (class ipa_param_body_adjustments): Likewise. * tree-ssa-math-opts.c (convert_expand_mult_copysign): Likewise. * tree-ssa-loop-split.c (find_vdef_in_loop): Likewise. * langhooks.h (struct lang_hooks_for_decls): Likewise. * ipa-prop.h (struct ipa_param_descriptor): Likewise. * tree-ssa-strlen.c (handle_builtin_string_cmp, handle_store): Likewise. * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Likewise. * tree-ssa-reassoc.c (reassociate_bb): Likewise. * tree.c (component_ref_size): Likewise. * hsa-common.c (hsa_init_compilation_unit_data): Likewise. * gimple-ssa-sprintf.c (get_string_length, format_string, format_directive): Likewise. * omp-grid.c (grid_process_kernel_body_copy): Likewise. * input.c (string_concat_db::get_string_concatenation, test_lexer_string_locations_ucn4): Likewise. * cfgexpand.c (pass_expand::execute): Likewise. * gimple-ssa-warn-restrict.c (builtin_memref::offset_out_of_bounds, maybe_diag_overlap): Likewise. * rtl.c (RTX_CODE_HWINT_P_1): Likewise. * shrink-wrap.c (spread_components): Likewise. * tree-ssa-dse.c (initialize_ao_ref_for_dse, valid_ao_ref_for_dse): Likewise. * tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds): Likewise. * dwarf2out.c (dwarf2out_early_finish): Likewise. * gimple-ssa-store-merging.c: Likewise. * ira-costs.c (record_operand_costs): Likewise. * tree-vect-loop.c (vectorizable_reduction): Likewise. * target.def (dispatch): Likewise. (validate_dims, gen_ccmp_first): Fix up duplicated word issue in documentation text. * doc/tm.texi: Regenerated. * config/i386/x86-tune.def (X86_TUNE_PARTIAL_FLAG_REG_STALL): Fix up duplicated word issue in a comment. * config/i386/i386.c (ix86_test_loading_unspec): Likewise. * config/i386/i386-features.c (remove_partial_avx_dependency): Likewise. * config/msp430/msp430.c (msp430_select_section): Likewise. * config/gcn/gcn-run.c (load_image): Likewise. * config/aarch64/aarch64-sve.md (sve_ld1r<mode>): Likewise. * config/aarch64/aarch64.c (aarch64_gen_adjusted_ldpstp): Likewise. * config/aarch64/falkor-tag-collision-avoidance.c (single_dest_per_chain): Likewise. * config/nvptx/nvptx.c (nvptx_record_fndecl): Likewise. * config/fr30/fr30.c (fr30_arg_partial_bytes): Likewise. * config/rs6000/rs6000-string.c (expand_cmp_vec_sequence): Likewise. * config/rs6000/rs6000-p8swap.c (replace_swapped_load_constant): Likewise. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. * config/rs6000/rs6000-logue.c (rs6000_emit_probe_stack_range_stack_clash): Likewise. * config/nds32/nds32-md-auxiliary.c (nds32_split_ashiftdi3): Likewise. Fix various other issues in the comment. c-family/ * c-common.c (resolve_overloaded_builtin): Fix up duplicated word issue in a diagnostic message. cp/ * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message. (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue in a comment. * parser.c (cp_parser_statement, cp_parser_linkage_specification, cp_parser_placeholder_type_specifier, cp_parser_constraint_requires_parens): Likewise. * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise. fortran/ * array.c (gfc_check_iter_variable): Fix up duplicated word issue in a comment. * arith.c (gfc_arith_concat): Likewise. * resolve.c (gfc_resolve_ref): Likewise. * frontend-passes.c (matmul_lhs_realloc): Likewise. * module.c (gfc_match_submodule, load_needed): Likewise. * trans-expr.c (gfc_init_se): Likewise.
2020-02-10Fix bogus duplicate attribute errors for submodule functions.Andrew Benson1-2/+9
PR fortran/83113 * array.c: Do not attempt to set the array spec for a submodule function symbol (as it has already been set in the corresponding module procedure interface). * symbol.c: Do not reject duplicate POINTER, ALLOCATABLE, or DIMENSION attributes in declarations of a submodule function. * gfortran.h: Add a macro that tests for a module procedure in a submodule. * gfortran.dg/pr83113.f90: New test.
2020-01-09Save typespec for empty array constructor.Thomas Koenig1-0/+18
2020-01-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/65428 * array.c (empty_constructor): New variable. (empty_ts): New variable. (expand_constructor): Save typespec in empty_ts. Unset empty_constructor if there is an element. (gfc_expand_constructor): Initialize empty_constructor and empty_ts. If there was no explicit constructor type and the constructor is empty, take the type from empty_ts. 2020-01-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/65428 * gfortran.dg/zero_sized_11.f90: New test. From-SVN: r280063
2020-01-09Fortran] PR84135 fix merging dimension into codimension array specTobias Burnus1-1/+1
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-02Fortran] PR68020 – Fix implied-shape handling for rank > 2Tobias Burnus1-1/+1
PR fortran/68020 * array.c (gfc_match_array_spec): Fix implied-type matching for rank > 2. PR fortran/68020 * gfortran.dg/implied_shape_4.f90: New. * gfortran.dg/implied_shape_5.f90: New. From-SVN: r279835
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-19Prevent conversion of character data in array constructors.Mark Eggleston1-3/+4
Fix for PR fortran/92896 [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283. This was caused by an unintended side affect of "Allow CHARACTER literals in assignments and data statements" (revision 277975). If the conversion occurs in a array constructor it is rejected. From-SVN: r279583
2019-12-11re PR fortran/92897 ([Coarray] ICE in gfc_set_array_spec, at ↵Steven G. Kargl1-4/+0
fortran/array.c:864) 2019-12-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/92897 * array.c (gfc_set_array_spec): Remove invalid assert() triggered by invalid Fortran code. 2019-12-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/92897 * gfortran.dg/pr92897.f90: New test. From-SVN: r279247
2019-10-24Fix another UBSAN in Fortran coarray.Martin Liska1-0/+3
2019-10-24 Martin Liska <mliska@suse.cz> PR fortran/92174 * array.c (gfc_resolve_array_spec): Break the loop for out of bounds index. * resolve.c (is_non_constant_shape_array): Likewise. From-SVN: r277367
2019-10-22re PR fortran/92174 (runtime error: index 15 out of bounds for type ↵Steven G. Kargl1-0/+14
'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-14re PR fortran/92004 (Rejection of different ranks for dummy array argument ↵Thomas Koenig1-0/+1
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-11re PR fortran/92019 (ICE in find_inquiry_ref, at expr.c:1790)Steven G. Kargl1-1/+20
2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/92019 * array.c (match_subscript): BOZ cannot be an array subscript. 2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/92019 * gfortran.dg/pr92019.f90: New test. From-SVN: r276897
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-02re PR fortran/91552 (ICE with valid array constructor)Steven G. Kargl1-6/+30
2019-09-02 Steven G. Kargl <kargl@gc.gnu.org> PR fortran/91552 * array.c (walk_array_constructor): New function. (gfc_match_array_constructor): Use it. 2019-09-02 Steven G. Kargl <kargl@gc.gnu.org> PR fortran/91552 * gfortran.dg/pr91552.f90: New test. From-SVN: r275322
2019-09-01array.c (spec_dimen_size): Check for the presence of expressions for the bounds.Paul Thomas1-1/+5
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/+3
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-07-23arith.c (gfc_convert_integer, [...]): Move to ...Steven G. Kargl1-4/+14
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-06-12re PR fortran/90002 (ICE: free_expr0(): Bad expr type)Steven G. Kargl1-3/+15
2019-06-12 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90002 * array.c (gfc_free_array_spec): When freeing an array-spec, avoid an ICE for assumed-shape coarrays 2019-06-12 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/90002 * gfortran.dg/pr90002.f90: New test. From-SVN: r272201
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-12-16re PR fortran/88116 (ICE in gfc_convert_constant(): Unexpected type)Steven G. Kargl1-1/+3
2018-12-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88116 PR fortran/88467 * array.c (gfc_match_array_constructor): Check return value of gfc_convert_type(). Skip constructor elements with BT_UNKNOWN, which need to go through resolution. * intrinsic.c (gfc_convert_type_warn): Return early if the types martch (i.e., no conversion is required). * simplify.c (gfc_convert_constant): Remove a gfc_internal_error, and return gfc_bad_expr. 2018-12-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88116 * gfortran.dg/pr88116_1.f90: New test. * gfortran.dg/pr88116_2.f90: Ditto. PR fortran/88467 * gfortran.dg/pr88467.f90: New test. From-SVN: r267189
2018-06-13re PR fortran/86110 (ICE in gfc_resolve_character_array_constructor, at ↵Steven G. Kargl1-0/+2
fortran/array.c:2044) 2018-06-13 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/86110 * array.c (gfc_resolve_character_array_constructor): Avoid NULL pointer dereference. 2018-06-13 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/86110 * gfortran.dg/pr86110.f90: New test. From-SVN: r261561
2018-06-08re PR fortran/86059 (ICE in reduce_binary_ac, at fortran/arith.c:1308 (and ↵Steven G. Kargl1-0/+9
others)) 2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/86059 * array.c (match_array_cons_element): NULL() cannot be in an array constructor. 2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/86059 * gfortran.dg/associate_30.f90: Remove code tested ... * gfortran.dg/pr67803.f90: Ditto. * gfortran.dg/pr67805.f90: Ditto. * gfortran.dg/pr86059.f90: ... here. New test. From-SVN: r261344
2018-05-22re PR fortran/85841 ([F2018] reject deleted features)Janus Weil1-1/+1
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-10re PR fortran/85521 (ICE in gfc_resolve_character_array_constructor, at ↵Steven G. Kargl1-1/+2
fortran/array.c:2049) 2018-05-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85521 * array.c (gfc_resolve_character_array_constructor): Substrings with upper bound smaller than lower bound are zero length strings. 2018-05-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85521 * gfortran.dg/pr85521_1.f90: New test. * gfortran.dg/pr85521_2.f90: New test. From-SVN: r260139
2018-03-30re PR fortran/85111 (ICE in min_max_choose, at fortran/simplify.c:4884 (and ↵Thomas Koenig1-0/+14
others)) 2017-03-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/85111 * array.c (gfc_resolve_character_array_constructor): Early exit for zero-size arrays. * simplify.c (simplify_transformation_to_array): Exit early if the result size is zero. (simplify_minmaxloc_to_array): Likewise. 2017-03-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/85111 * gfortran.dg/zero_sized_10.f90: New test. From-SVN: r258973
2018-01-30re PR fortran/84134 (ICE: Floating point exception)Thomas Koenig1-1/+4
2017-01-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84134 * array.c (gfc_ref_dimen_size): Whitespace fixes. If stride is zero, return false. 2017-01-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84134 * gfortran.dg/data_implied_do_2.f90: New test. From-SVN: r257211
2018-01-26Partial Failed Images patchDamian Rouson1-1/+15
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> Co-Authored-By: Soren Rasmussen <s.c.rasmussen@gmail.com> From-SVN: r257105
2018-01-25re PR fortran/37577 ([meta-bug] change internal array descriptor format for ↵Paul Thomas1-0/+5
better syntax, C interop TR, rank 15) 2018-25-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/37577 * array.c (gfc_match_array_ref): If standard earlier than F2008 it is an error if the reference dimension is greater than 7. libgfortran.h : Increase GFC_MAX_DIMENSIONS to 15. Change the dtype masks and shifts accordingly. * trans-array.c (gfc_conv_descriptor_dtype): Use the dtype type node to check the field. (gfc_conv_descriptor_dtype): Access the rank field of dtype. (duplicate_allocatable_coarray): Access the rank field of the dtype descriptor rather than the dtype itself. * trans-expr.c (get_scalar_to_descriptor_type): Store the type of 'scalar' on entry and use its TREE_TYPE if it is ARRAY_TYPE (ie. a character). (gfc_conv_procedure_call): Pass TREE_OPERAND (tmp,0) to get_scalar_to_descriptor_type if the actual expression is a constant. (gfc_trans_structure_assign): Assign the rank directly to the dtype rank field. * trans-intrinsic.c (gfc_conv_intrinsic_rank): Cast the result to default integer kind. (gfc_conv_intrinsic_sizeof): Obtain the element size from the 'elem_len' field of the dtype. * trans-io.c (gfc_build_io_library_fndecls): Replace gfc_int4_type_node with dtype_type_node where necessary. (transfer_namelist_element): Use gfc_get_dtype_rank_type for scalars. * trans-types.c : Provide 'get_dtype_type_node' to acces the dtype_type_node and, if necessary, build it. The maximum size of an array element is now determined by the maximum value of size_t. Update the description of the array descriptor, including the type def for the dtype_type. (gfc_get_dtype_rank_type): Build a constructor for the dtype. Distinguish RECORD_TYPEs that are BT_DERIVED or BT_CLASS. (gfc_get_array_descriptor_base): Change the type of the dtype field to dtype_type_node. (gfc_get_array_descr_info): Get the offset to the rank field of the dtype. * trans-types.h : Add a prototype for 'get_dtype_type_node ()'. * trans.h : Define the indices of the dtype fields. 2018-25-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/37577 * gfortran.dg/coarray_18.f90: Allow dimension 15 for F2008. * gfortran.dg/coarray_lib_this_image_2.f90: Change 'array1' to 'array01' in the tree dump comparison. * gfortran.dg/coarray_lib_token_4.f90: Likewise. * gfortran.dg/inline_sum_1.f90: Similar - allow two digits. * gfortran.dg/rank_1.f90: Allow dimension 15 for F2008. 2018-25-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/37577 * caf/single.c (_gfortran_caf_failed_images): Access the 'type' and 'elem_len' fields of the dtype instead of the shifts. (_gfortran_caf_stopped_images): Likewise. * intrinsics/associated.c (associated): Compare the 'type' and 'elem_len' fields instead of the dtype. * caf/date_and_time.c : Access the dtype fields rather using shifts and masks. * io/transfer.c (transfer_array ): Comment on item count. (set_nml_var,st_set_nml_var): Change dtype type and use fields. (st_set_nml_dtio_var): Likewise. * libgfortran.h : Change definition of GFC_ARRAY_DESCRIPTOR and add a typedef for the dtype_type. Change the GFC_DTYPE_* macros to access the dtype fields. From-SVN: r257065
2018-01-22PR 78534, 83704 Large character lengthsJanne Blomqvist1-19/+11
This patch fixes various parts of the code to use a larger type than int for the character length. Depending on the situation, HOST_WIDE_INT, size_t, or gfc_charlen_t is appropriate. Regtested on x86_64-pc-linux-gnu and i686-pc-linux-gnu. gcc/fortran/ChangeLog: 2018-01-22 Janne Blomqvist <jb@gcc.gnu.org> PR 78534 PR 83704 * arith.c (gfc_arith_concat): Use size_t for string length. (gfc_compare_string): Likewise. (gfc_compare_with_Cstring): Likewise. * array.c (gfc_resolve_character_array_constructor): Use HOST_WIDE_INT, gfc_mpz_get_hwi. * check.c (gfc_check_fe_runtime_error): Use size_t. * data.c (create_character_initializer): Use HOST_WIDE_INT, gfc_extract_hwi. * decl.c (gfc_set_constant_character_len): Use gfc_charlen_t. (add_init_expr_to_sym): Use HOST_WIDE_INT. * expr.c (gfc_build_init_expr): Use HOST_WIDE_INT, gfc_extract_hwi. (gfc_apply_init): Likewise. * match.h (gfc_set_constant_character_len): Update prototype. * primary.c (match_string_constant): Use size_t. * resolve.c (resolve_ordinary_assign): Use HOST_WIDE_INT, gfc_mpz_get_hwi. * simplify.c (init_result_expr): Likewise. (gfc_simplify_len_trim): Use size_t. * target-memory.c (gfc_encode_character): Use size_t. (gfc_target_encode_expr): Use HOST_WIDE_INT, gfc_mpz_get_hwi. (interpret_array): Use size_t. (gfc_interpret_character): Likewise. * target-memory.h (gfc_encode_character): Update prototype. (gfc_interpret_character): Likewise. (gfc_target_interpret_expr): Likewise. * trans-const.c (gfc_build_string_const): Use size_t for length argument. (gfc_build_wide_string_const): Likewise. * trans-const.h (gfc_build_string_const): Likewise. (gfc_build_wide_string_const): Likewise. 2018-01-22 Janne Blomqvist <jb@gcc.gnu.org> PR 78534 PR 83704 * gfortran.dg/string_1.f90: Remove printing the length. From-SVN: r256944
2018-01-05PR 78534 Change character length from int to size_tJanne Blomqvist1-1/+1
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-22extend.texi (Loop-Specific Pragmas): Document pragma GCC unroll.Eric Botcazou1-0/+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
2017-07-06re PR fortran/70071 (ICE on wrong usage of a subscript triplet)Harald Anlauf1-1/+7
2017-07-06 Harald Anlauf <anlauf@gmx.de> PR fortran/70071 * array.c (gfc_ref_dimen_size): Handle bad subscript triplets. 2017-07-06 Harald Anlauf <anlauf@gmx.de> PR fortran/70071 * gfortran.dg/coarray_44.f90: New testcase. From-SVN: r250039
2017-05-13re PR fortran/80442 (Rejects DATA statement with array slice)Nicolas Koenig1-2/+7
2017-05-09 Nicolas Koenig <koenigni@student.ethz.ch> PR fortran/80442 * array.c (gfc_ref_dimen_size): Simplify stride expression * data.c (gfc_advance_section): Simplify start, end and stride expressions (gfc_advance_section): Simplify start and end expressions (gfc_get_section_index): Simplify start expression 2017-05-09 Nicolas Koenig <koenigni@student.ethz.ch> PR fortran/80442 * gfortran.dg/impl_do_var_data.f90: New Test From-SVN: r248012
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-14re PR fortran/78672 (Gfortran test suite failures with a sanitized compiler)Andre Vehreschild1-2/+7
gcc/fortran/ChangeLog: 2016-12-14 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78672 * array.c (gfc_find_array_ref): Add flag to return NULL when no ref is found instead of erroring out. * data.c (gfc_assign_data_value): Only constant expressions are valid for initializers. * gfortran.h: Reflect change of gfc_find_array_ref's signature. * interface.c (compare_actual_formal): Access the non-elemental array-ref. Prevent taking a REF_COMPONENT for a REF_ARRAY. Correct indentation. * module.c (load_omp_udrs): Clear typespec before reading into it. * trans-decl.c (gfc_build_qualified_array): Prevent accessing the array when it is a coarray. * trans-expr.c (gfc_conv_cst_int_power): Use wi::abs()-function instead of crutch preventing sanitizer's bickering here. * trans-stmt.c (gfc_trans_deallocate): Only get data-component when it is a descriptor-array here. From-SVN: r243647
2016-12-13re PR fortran/78798 ([cleanup] some int-valued functions should be bool)Janus Weil1-7/+5
2016-12-13 Janus Weil <janus@gcc.gnu.org> PR fortran/78798 * gfortran.h (gfc_is_constant_expr, gfc_is_formal_arg, gfc_is_compile_time_shape): Return bool instead of int. * array.c (gfc_is_compile_time_shape): Ditto. * expr.c (gfc_is_constant_expr): Ditto. * resolve.c (gfc_is_formal_arg): Ditto. Make formal_arg_flag bool. From-SVN: r243621
2016-10-23re PR fortran/54730 (ICE in gfc_typenode_for_spec, at ↵Steven G. Kargl1-21/+7
fortran/trans-types.c:1066) 2016-10-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/54730 PR fortran/78033 * array.c (gfc_match_array_constructor): Remove checkpointing introduced in r196416 (original fix for PR fortran/54730). Move initialization to top of function. * match.c (gfc_match_type_spec): Special case matching for REAL. 2016-10-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/54730 PR fortran/78033 * gfortran.dg/pr78033.f90: New test. From-SVN: r241451
2016-10-20array.c (gfc_match_array_constructor): Remove set, but unused variable.Steven G. Kargl1-2/+2
2016-10-20 Steven G. Kargl <kargl@gcc.gnu.org> * array.c (gfc_match_array_constructor): Remove set, but unused variable. From-SVN: r241388
2016-09-09re PR fortran/77506 (F2008 Standard does not allow CHARACTER(LEN=*) in array ↵Steven G. Kargl1-0/+9
constructor) 2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77506 * array.c (gfc_match_array_constructor): CHARACTER(len=*) cannot appear in an array constructor. 2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77506 * gfortran.dg/pr77506.f90: New test. From-SVN: r240052
2016-09-08re PR fortran/69514 (ICE with nested array constructor)Steven G. Kargl1-2/+9
2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69514 * array.c (gfc_match_array_constructor): If type-spec is present, walk the array constructor performing possible conversions for numeric types. 2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org> Louis Krupp <lkrupp@gcc.gnu.org> PR fortran/69514 * gfortran.dg/pr69514_1.f90: New test. * gfortran.dg/pr69514_2.f90: New test. Co-Authored-By: Louis Krupp <lkrupp@gcc.gnu.org> From-SVN: r240039
2016-07-05Second review of STAT= patch + testsAlessandro Fanfarillo1-0/+17
From-SVN: r238007
2016-04-09re PR fortran/68566 (ICE on using unusable array in reshape (double free or ↵Jerry DeLisle1-7/+17
corruption)) 2016-04-09 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/68566 * array.c (match_array_element_spec): Add check for non-integer. * simplify.c (gfc_simplify_reshape): If source shape is NULL return. PR fortran/68566 * gfortran.dg/pr36192.f90: Update test. * gfortran.dg/pr36192_1.f90: Update test. * gfortran.dg/real_dimension_1.f: Update test. * gfortran.dg/parameter_array_init_7.f90: New test. From-SVN: r234864
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-11-14re PR fortran/67803 (ICE on concatenating wrong character array constructor)Steven G. Kargl1-0/+30
2015-11-14 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67803 * array.c (gfc_match_array_constructor): If array constructor included a CHARACTER typespec, check array elements for compatible type. 2015-11-14 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67803 * gfortran.dg/pr67803.f90: New test. From-SVN: r230379
2015-11-11decl.c: Remove unused header files.Andrew MacLeod1-1/+0
ada * gcc-interface/decl.c: Remove unused header files. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c * c-array-notation.c: Remove unused header files. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * gccspec.c: Likewise. c-family * array-notation-common.c: Remove unused header files. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp * call.c: Remove unused header files. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * g++spec.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. Fortran * array.c: Remove unused header files. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go * go-backend.c: Remove unused header files. * go-gcc.cc: Likewise. * go-lang.c: Likewise. * gospec.c: Likewise. Java * boehm.c: Remove unused header files. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. * zextract.c: Likewise. jit * dummy-frontend.c: Remove unused header files. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * jit-spec.c: Likewise. * libgccjit.c: Likewise. lto * lto-lang.c: Remove unused header files. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc * objc-act.c: Remove unused header files. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp * objcp-decl.c: Remove unused header files. * objcp-lang.c: Likewise. From-SVN: r230166
2015-11-08re PR fortran/68224 (ICE on referencing parameter array with dimension null)Steven G. Kargl1-5/+19
2015-11-08 Steven G. Kargl <kargl@gc.gnu.org> PR fortran/68224 * array.c (match_array_element_spec): Check of invalid NULL(). While here, fix nearby comments. 2015-11-08 Steven G. Kargl <kargl@gc.gnu.org> PR fortran/68224 * gfortran.dg/pr68224.f90: New test. From-SVN: r229955
2015-10-29decl.c: Reorder #include's and remove duplicates.Andrew MacLeod1-1/+1
ada 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/decl.c: Reorder #include's and remove duplicates. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Reorder #include's and remove duplicates. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Reorder #include's and remove duplicates. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * call.c: Reorder #include's and remove duplicates. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. fortran 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array.c: Reorder #include's and remove duplicates. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * resolve.c: Likewise. * simplify.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Reorder #include's and remove duplicates. * go-lang.c: Likewise. java 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Reorder #include's and remove duplicates. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. jit 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Reorder #include's and remove duplicates. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * libgccjit.c: Likewise. lto 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Reorder #include's and remove duplicates. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objc-lang.c: Reorder #include's and remove duplicates. * objc-map.c: Likewise. objcp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Reorder #include's and remove duplicates. * objcp-lang.c: Likewise. From-SVN: r229533
2015-10-26re PR fortran/36192 (ICE with wrong index types and bad parens)Steven G. Kargl1-2/+4
2015-10-26 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/36192 * array.c (gfc_ref_dimen_size): Check for BT_INTEGER before calling mpz_set. 2015-10-26 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/36192 * gfortran.dg/pr36192.f90: New test. From-SVN: r229387