aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.c
AgeCommit message (Collapse)AuthorFilesLines
2009-04-22re PR fortran/39735 (procedure pointer assignments: return value is not checked)Janus Weil1-1/+1
2009-04-22 Janus Weil <janus@gcc.gnu.org> PR fortran/39735 * decl.c (add_hidden_procptr_result): Bugfix for procptr results. (match_procedure_decl): Set if_source. * expr.c (gfc_check_pointer_assign): Bugfix: Return after error. And: Check interface also for IFSRC_UNKNOWN (return type may be known). * gfortran.h (typedef enum ifsrc): Remove IFSRC_USAGE, add documentation. Rename copy_formal_args and copy_formal_args_intr. * interface.c (gfc_compare_interfaces): Check for return types, handle IFSRC_UNKNOWN. (compare_intr_interfaces,compare_actual_formal_intr): Obsolete, removed. (gfc_procedure_use): Modified handling of intrinsics. * intrinsic.c (add_functions): Bugfix for "dim". * resolve.c (resolve_intrinsic): New function to resolve intrinsics, which copies the interface from isym to sym. (resolve_procedure_expression,resolve_function): Use new function 'resolve_intrinsic'. (resolve_symbol): Add function attribute for externals with return type and use new function 'resolve_intrinsic'. * symbol.c (ifsrc_types): Remove string for IFSRC_USAGE. (copy_formal_args): Renamed to gfc_copy_formal_args. (copy_formal_args_intr): Renamed to gfc_copy_formal_args_intr. * trans-const.c (gfc_conv_const_charlen): Handle cl==NULL. 2009-04-22 Janus Weil <janus@gcc.gnu.org> PR fortran/39735 * gfortran.dg/assumed_charlen_function_5.f90: Modified. * gfortran.dg/external_initializer.f90: Modified. * gfortran.dg/interface_26.f90: Modified. * gfortran.dg/intrinsic_subroutine.f90: Modified. * gfortran.dg/proc_ptr_3.f90: Modified. * gfortran.dg/proc_ptr_15.f90: New. * gfortran.dg/proc_ptr_result_1.f90: Modified. From-SVN: r146554
2009-01-09check.c: Update copyright year.Paul Thomas1-1/+1
2009-01-10 Paul Thomas <pault@gcc.gnu.org> * check.c : Update copyright year. * dependency.c : Update copyright year. * interface.c : ditto. * intrinsic.c : ditto. * intrinsic.h : ditto. * module.c : ditto. * simplify.c : ditto. * symbol.c : ditto. * trans-stmt.c : ditto. * trans-types.c : ditto. From-SVN: r143236
2009-01-04intrinsic.c (do_simplify): Removed already implemented TODO.Daniel Franke1-3/+0
2009-01-04 Daniel Franke <franke.daniel@gmail.com> * intrinsic.c (do_simplify): Removed already implemented TODO. From-SVN: r143054
2009-01-04re PR fortran/38718 (some simplifiers for elemental intrinsics missing; ↵Daniel Franke1-1/+1
required for init expressions) gcc/fortran: 2009-01-04 Daniel Franke <franke.daniel@gmail.com> PR fortran/38718 * simplify.c (gfc_simplify_merge): New. * intrinsic.h (gfc_simplify_merge): New prototype. * intrinsic.c (add_functions): Added simplification for MERGE. gcc/testsuite: 2009-01-04 Daniel Franke <franke.daniel@gmail.com> PR fortran/38718 * gfortran.dg/merge_init_expr.f90: New. From-SVN: r143053
2008-11-09re PR fortran/37836 (ICE in gfc_trans_auto_array_allocation)Paul Thomas1-2/+2
2008-11-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/37836 * intrinsic.c (add_functions): Reference gfc_simplify._minval and gfc_simplify_maxval. * intrinsic.h : Add prototypes for gfc_simplify._minval and gfc_simplify_maxval. * simplify.c (min_max_choose): New function extracted from simplify_min_max. (simplify_min_max): Call it. (simplify_minval_maxval, gfc_simplify_minval, gfc_simplify_maxval): New functions. 2008-11-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/37836 * gfortran.dg/minmaxval_1.f90: New test. From-SVN: r141717
2008-11-01re PR fortran/35681 (wrong result for vector subscripted array expression in ↵Daniel Kraft1-0/+1
MVBITS) 2008-11-01 Daniel Kraft <d@domob.eu> PR fortran/35681 * gfortran.h (struct gfc_code): New field `resolved_isym'. * trans.h (gfc_build_memcpy_call): Made public. * trans-array.h (gfc_trans_create_temp_array): New argument `initial'. * intrinsic.c (gfc_intrinsic_sub_interface): Set resolved_isym. * iresolve.c (create_formal_for_intents): New helper method. (gfc_resolve_mvbits): Put dummy formal arglist on resolved_sym. * resolve.c (resolve_call): Initialize resolved_isym to NULL. * trans-array.c (gfc_trans_allocate_array_storage): New argument `initial' to allow initializing the allocated storage to some initial value copied from another array. (gfc_trans_create_temp_array): Allow initialization of the temporary with a copy of some other array by using the new extension. (gfc_trans_array_constructor): Pass NULL_TREE for initial argument. (gfc_conv_loop_setup): Ditto. * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): Ditto. * trans-expr.c (gfc_conv_function_call): Ditto. (gfc_build_memcpy_call): Made public. * trans-stmt.c (gfc_conv_elemental_dependencies): Initialize created temporary for INTENT(INOUT) arguments to the value of the mirrored array and clean up the temporary as very last intructions in the created block. * trans.c (gfc_trans_code): For EXEC_CALL, see if we have a MVBITS call and enable elemental dependency checking if we have. 2008-11-01 Daniel Kraft <d@domob.eu> PR fortran/35681 * gfortran.dg/mvbits_4.f90: New test. From-SVN: r141516
2008-10-09re PR fortran/35723 (Can't use run-time array element in character declaration)Daniel Kraft1-12/+28
2008-10-09 Daniel Kraft <d@domob.eu> PR fortran/35723 * gfortran.h (gfc_suppress_error): Removed from header. (gfc_push_suppress_errors), (gfc_pop_suppress_errors): New methods. * array.c (gfc_array_size): Use new gfc_push/pop_suppress_errors instead of directly changing gfc_suppress_error. * intrinsic.c (gfc_intrinsic_func_interface): Ditto. (gfc_intrinsic_sub_interface): Ditto. * error.c (suppress_errors): Made static from `gfc_suppress_error'. (gfc_push_suppress_errors), (gfc_pop_suppress_errors): New methods. (gfc_notify_std), (gfc_error): Use new static name of global. * expr.c (check_arglist), (check_references): New methods. (check_restricted): Check arglists and references of EXPR_FUNCTIONs and EXPR_VARAIBALEs, respectively. Allow PARAMETER symbols. 2008-10-09 Daniel Kraft <d@domob.eu> PR fortran/35723 * gfortran.dg/restricted_expression_1.f90: New test. * gfortran.dg/restricted_expression_2.f90: New test. * gfortran.dg/restricted_expression_3.f90: New test. From-SVN: r141001
2008-10-02re PR fortran/37635 (Fortran 2008: Support LEADZ / TRAILZ)Steven Bosscher1-0/+14
testsuite * gfortran.fortran-torture/execute/intrinsic_leadz.f90: New test. * gfortran.fortran-torture/execute/intrinsic_trailz.f90: New test. fortran/ PR fortran/37635 * intrinsic.c (add_functions): Add LEADZ and TRAILZ as generics. * intrinsic.h (gfc_simplify_leadz, gfc_simplify_trailz): New protos. * gfortran.h <enum gfc_isym_id>: (GFC_ISYM_LEADZ, GFC_ISYM_TRAILZ): New. * f95-lang (gfc_init_builtin_functions): Add BUILT_IN_CLZ, BUILT_IN_CLZL, BUILT_IN_CLZLL, BUILT_IN_CTZ, BUILT_IN_CTZL, and BUILT_IN_CTZLL. * trans-intrinsic.c (gfc_conv_intrinsic_leadz, gfc_conv_intrinsic_trails): New code-generation functions for LEADZ and TRAILZ intrinsics. (gfc_conv_intrinsic_function): Use them * intrinsic.texi: Add documentation for LEADZ and TRAILZ. * simplify.c (gfc_simplify_leadz, gfc_simplify_trailz): New functions. From-SVN: r140837
2008-07-29gfortran.h (try): Remove macro.Kaveh R. Ghazi1-23/+23
* gfortran.h (try): Remove macro. Replace try with gfc_try throughout. * array.c: Likewise. * check.c: Likewise. * cpp.c: Likewise. * cpp.h: Likewise. * data.c: Likewise. * data.h: Likewise. * decl.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * intrinsic.h: Likewise. * io.c: Likewise. * match.h: Likewise. * parse.c: Likewise. * parse.h: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * symbol.c: Likewise. * trans-openmp.c: Likewise. * trans-types.c: Likewise. From-SVN: r138226
2008-07-24re PR fortran/33141 (Intrinsic procedures: Improve warning/error with -std=*)Daniel Kraft1-23/+149
2008-07-24 Daniel Kraft <d@domob.eu> PR fortran/33141 * lang.opt (Wnonstd-intrinsics): Removed option. (Wintrinsics-std), (Wintrinsic-shadow): New options. * invoke.texi (Option Summary): Removed -Wnonstd-intrinsics from the list and added -Wintrinsics-std and -Wintrinsic-shadow. (Error and Warning Options): Documented the new options and removed the documentation for -Wnonstd-intrinsics. * gfortran.h (gfc_option_t): New members warn_intrinsic_shadow and warn_intrinsics_std, removed warn_nonstd_intrinsics. (gfc_is_intrinsic): Renamed from gfc_intrinsic_name. (gfc_warn_intrinsic_shadow), (gfc_check_intrinsic_standard): New. * decl.c (match_procedure_decl): Replaced gfc_intrinsic_name by the new name gfc_is_intrinsic. (warn_intrinsic_shadow): New helper method. (gfc_match_function_decl), (gfc_match_subroutine): Call the new method warn_intrinsic_shadow to check the just-parsed procedure. * expr.c (check_init_expr): Call new gfc_is_intrinsic to check whether the function called is really an intrinsic in the selected standard. * intrinsic.c (gfc_is_intrinsic): Renamed from gfc_intrinsic_name and extended to take into account the selected standard settings when trying to find out whether a symbol is an intrinsic or not. (gfc_check_intrinsic_standard): Made public and extended. (gfc_intrinsic_func_interface), (gfc_intrinsic_sub_interface): Removed the calls to check_intrinsic_standard, this check now happens inside gfc_is_intrinsic. (gfc_warn_intrinsic_shadow): New method defined. * options.c (gfc_init_options): Initialize new warning flags to false and removed intialization of Wnonstd-intrinsics flag. (gfc_post_options): Removed logic for Wnonstd-intrinsics flag. (set_Wall): Set new warning flags and removed Wnonstd-intrinsics flag. (gfc_handle_option): Handle the new flags and removed handling of the old Wnonstd-intrinsics flag. * primary.c (gfc_match_rvalue): Replaced call to gfc_intrinsic_name by the new name gfc_is_intrinsic. * resolve.c (resolve_actual_arglist): Ditto. (resolve_generic_f), (resolve_unknown_f): Ditto. (is_external_proc): Ditto. (resolve_generic_s), (resolve_unknown_s): Ditto. (resolve_symbol): Ditto and ensure for symbols declared INTRINSIC that they are really available in the selected standard setting. 2008-07-24 Daniel Kraft <d@domob.eu> PR fortran/33141 * gfortran.dg/intrinsic_shadow_1.f03: New test for -Wintrinsic-shadow. * gfortran.dg/intrinsic_shadow_2.f03: Ditto. * gfortran.dg/intrinsic_shadow_3.f03: Ditto. * gfortran.dg/intrinsic_std_1.f90: New test for -Wintrinsics-std. * gfortran.dg/intrinsic_std_2.f90: Ditto. * gfortran.dg/intrinsic_std_3.f90: Ditto. * gfortran.dg/intrinsic_std_4.f90: Ditto. * gfortran.dg/warn_std_1.f90: Removed option -Wnonstd-intrinsics. * gfortran.dg/warn_std_2.f90: Replaced -Wnonstd-intrinsics by -Wintrinsics-std and adapted expected errors/warnings. * gfortran.dg/warn_std_3.f90: Ditto. * gfortran.dg/c_sizeof_2.f90: Adapted expected error/warning message. * gfortran.dg/gamma_2.f90: Ditto. * gfortran.dg/selected_char_kind_3.f90: Ditto. * gfortran.dg/fmt_g0_2.f08: Call with -fall-intrinsics to allow abort. From-SVN: r138122
2008-07-19gfortran.h (new): Remove macro.Kaveh R. Ghazi1-43/+43
* gfortran.h (new): Remove macro. * array.c (gfc_append_constructor, match_array_list, gfc_match_array_constructor): Likewise. * bbt.c (insert, gfc_insert_bbt): Likewise. * decl.c (var_element, top_var_list, top_val_list, gfc_match_data, get_proc_name): Likewise. * expr.c (gfc_copy_actual_arglist): Likewise. * interface.c (compare_actual_formal, check_new_interface, gfc_add_interface): Likewise. * intrinsic.c gfc_convert_type_warn, gfc_convert_chartype): Likewise. * io.c (match_io_iterator, match_io_list): Likewise. * match.c (match_forall_header): Likewise. * matchexp.c (build_node): Likewise. * module.c (gfc_match_use): Likewise. * scanner.c (load_file): Likewise. * st.c (gfc_append_code): Likewise. * symbol.c (save_symbol_data, gfc_get_sym_tree, gfc_undo_symbols, gfc_commit_symbols): Likewise. * trans-common.c (build_field): Likewise. * trans-decl.c (gfc_finish_var_decl): Likewise. * trans-expr.c (gfc_free_interface_mapping, gfc_get_interface_mapping_charlen, gfc_add_interface_mapping, gfc_finish_interface_mapping, gfc_apply_interface_mapping_to_expr): Likewise. * trans.h (gfc_interface_sym_mapping): Likewise. From-SVN: r137982
2008-07-19gfortran.h (protected): Remove macro.Kaveh R. Ghazi1-15/+15
* gfortran.h (protected): Remove macro. * dump-parse-tree.c (show_attr): Avoid C++ keywords. * expr.c (gfc_check_pointer_assign): Likewise. * interface.c (compare_parameter_protected): Likewise. * intrinsic.c (enum class, add_sym, add_sym_0, add_sym_1, add_sym_1s, add_sym_1m, add_sym_2, add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s, add_sym_4, add_sym_4s, add_sym_5s): Likewise. * match.c (gfc_match_assignment, gfc_match_pointer_assignment): Likewise. * module.c (mio_symbol_attribute): Likewise. * primary.c (match_variable): Likewise. * resolve.c (resolve_equivalence): Likewise. * symbol.c (check_conflict, gfc_add_protected, gfc_copy_attr): Likewise. * trans-types.c (gfc_get_array_type_bounds): Likewise. From-SVN: r137980
2008-06-20arith.c (hollerith2representation): Fix for -Wc++-compat.Kaveh R. Ghazi1-4/+5
* arith.c (hollerith2representation): Fix for -Wc++-compat. * array.c (gfc_get_constructor): Likewise. * decl.c (gfc_get_data_variable, gfc_get_data_value, gfc_get_data, create_enum_history, gfc_match_final_decl): Likewise. * error.c (error_char): Likewise. * expr.c (gfc_get_expr, gfc_copy_expr): Likewise. * gfortran.h (gfc_get_charlen, gfc_get_array_spec, gfc_get_component, gfc_get_formal_arglist, gfc_get_actual_arglist, gfc_get_namelist, gfc_get_omp_clauses, gfc_get_interface, gfc_get_common_head, gfc_get_dt_list, gfc_get_array_ref, gfc_get_ref, gfc_get_equiv, gfc_get_case, gfc_get_iterator, gfc_get_alloc, gfc_get_wide_string): Likewise. * interface.c (count_types_test): Likewise. * intrinsic.c (add_char_conversions, gfc_intrinsic_init_1): Likewise. * io.c (gfc_match_open, gfc_match_close, match_filepos, match_io, gfc_match_inquire, gfc_match_wait): Likewise. * match.c (gfc_match, match_forall_iterator): Likewise. * module.c (gfc_get_pointer_info, gfc_get_use_rename, add_fixup, add_true_name, parse_string, write_atom, quote_string, mio_symtree_ref, mio_gmp_real, write_common_0): Likewise. * options.c (gfc_post_options): Likewise. * primary.c (match_integer_constant, match_hollerith_constant, match_boz_constant, match_real_constant, gfc_get_structure_ctor_component, gfc_match_structure_constructor): Likewise. * scanner.c (gfc_widechar_to_char, add_path_to_list, add_file_change, load_line, get_file, preprocessor_line, load_file, unescape_filename, gfc_read_orig_filename): Likewise. * simplify.c (gfc_simplify_ibits, gfc_simplify_ishft, gfc_simplify_ishftc): Likewise. * symbol.c (gfc_get_st_label, gfc_get_namespace, gfc_new_symtree, gfc_get_uop, gfc_new_symbol, save_symbol_data, gfc_get_gsymbol): Likewise. * target-memory.c (gfc_target_interpret_expr): Likewise. * trans-const.c (gfc_build_wide_string_const): Likewise. * trans-expr.c (gfc_add_interface_mapping): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_conversion, gfc_conv_intrinsic_int, gfc_conv_intrinsic_lib_function, gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_ctime, gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam, gfc_conv_intrinsic_minmax, gfc_conv_intrinsic_minmax_char, gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_index_scan_verify, gfc_conv_intrinsic_merge, gfc_conv_intrinsic_trim): Likewise. * trans.c (gfc_get_backend_locus): Likewise. * trans.h (gfc_get_ss): Likewise. From-SVN: r136982
2008-06-07re PR fortran/36437 (Simplify argument to [c_]sizeof)Tobias Burnus1-1/+2
2008-06-04 Tobias Burnus <burnus@net-b.de> PR fortran/36437 * intrinsic.c (add_functions): Implement c_sizeof. * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Do not create unneeded variable in the scalar case. 2008-06-04 Tobias Burnus <burnus@net-b.de> PR fortran/36437 * gfortran.dg/c_sizeof_1.f90: New. * gfortran.dg/c_sizeof_2.f90: New. From-SVN: r136536
2008-05-28re PR fortran/36319 (Segfault with wide characters in DATA)Francois-Xavier Coudert1-1/+0
PR fortran/36319 * intrinsic.c (gfc_convert_chartype): Don't mark conversion function as pure. * trans-array.c (gfc_trans_array_ctor_element): Divide element size by the size of one character to obtain length. * iresolve.c (gfc_resolve_cshift): Call the _char4 variant when appropriate. (gfc_resolve_eoshift): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Minor beautification. (gfc_conv_intrinsic_fdate): Minor beautification. (gfc_conv_intrinsic_ttynam): Minor beautification. (gfc_conv_intrinsic_minmax_char): Allow all character kinds. (size_of_string_in_bytes): New function. (gfc_conv_intrinsic_size): Call size_of_string_in_bytes for character expressions. (gfc_conv_intrinsic_sizeof): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_intrinsic_trim): Allow all character kinds. Minor beautification. (gfc_conv_intrinsic_repeat): Fix comment typo. * simplify.c (gfc_convert_char_constant): Take care of conversion of array constructors. * intrinsics/string_intrinsics_inc.c (string_index): Return correct value for zero-length substring. * intrinsics/cshift0.c: Add _char4 variant. * intrinsics/eoshift0.c (eoshift0): Allow filler to be a pattern wider than a single byte. Add _char4 variant and use above functionality. * intrinsics/eoshift2.c (eoshift2): Likewise. * m4/eoshift1.m4: Likewise. * m4/eoshift3.m4: Likewise. * m4/cshift1.m4: Add _char4 variants. * gfortran.map (GFORTRAN_1.1): Add _gfortran_cshift0_1_char4, _gfortran_cshift0_2_char4, _gfortran_cshift0_4_char4, _gfortran_cshift0_8_char4, _gfortran_cshift1_16_char4, _gfortran_cshift1_4_char4, _gfortran_cshift1_8_char4, _gfortran_eoshift0_1_char4, _gfortran_eoshift0_2_char4, _gfortran_eoshift0_4_char4, _gfortran_eoshift0_8_char4, _gfortran_eoshift1_16_char4, _gfortran_eoshift1_4_char4, _gfortran_eoshift1_8_char4, _gfortran_eoshift2_1_char4, _gfortran_eoshift2_2_char4, _gfortran_eoshift2_4_char4, _gfortran_eoshift2_8_char4, _gfortran_eoshift3_16_char4, _gfortran_eoshift3_4_char4 and _gfortran_eoshift3_8_char4. * generated/eoshift3_4.c: Regenerate. * generated/eoshift1_8.c: Regenerate. * generated/eoshift1_16.c: Regenerate. * generated/cshift1_4.c: Regenerate. * generated/eoshift1_4.c: Regenerate. * generated/eoshift3_8.c: Regenerate. * generated/eoshift3_16.c: Regenerate. * generated/cshift1_8.c: Regenerate. * generated/cshift1_16.c: Regenerate. * gfortran.dg/widechar_5.f90: New file. * gfortran.dg/widechar_6.f90: New file. * gfortran.dg/widechar_7.f90: New file. * gfortran.dg/widechar_intrinsics_5.f90: Uncomment the lines testing the SPREAD intrinsic. * gfortran.dg/widechar_intrinsics_6.f90: New file. * gfortran.dg/widechar_intrinsics_7.f90: New file. * gfortran.dg/widechar_intrinsics_8.f90: New file. * gfortran.dg/widechar_intrinsics_9.f90: New file. * gfortran.dg/widechar_intrinsics_10.f90: New file. From-SVN: r136129
2008-05-18intrinsic.c (char_conversions, ncharconv): New static variables.Francois-Xavier Coudert1-20/+159
* intrinsic.c (char_conversions, ncharconv): New static variables. (find_char_conv): New function. (add_functions): Add simplification functions for ADJUSTL and ADJUSTR. Don't check the kind of their argument. Add checking for LGE, LLE, LGT and LLT. (add_subroutines): Fix argument type for SLEEP. Fix argument name for SYSTEM. (add_char_conversions): New function. (gfc_intrinsic_init_1): Call add_char_conversions. (gfc_intrinsic_done_1): Free char_conversions. (check_arglist): Use kind == 0 as a signal that we don't want the kind value to be checked. (do_simplify): Also simplify character functions. (gfc_convert_chartype): New function * trans-array.c (gfc_trans_array_ctor_element): Don't force the use of default character type. (gfc_trans_array_constructor_value): Likewise. (get_array_ctor_var_strlen): Use integer kind to build an integer instead of a character kind! (gfc_build_constant_array_constructor): Don't force the use of default character type. (gfc_conv_loop_setup): Likewise. * trans-expr.c (gfc_conv_string_tmp): Don't force the use of default character type. Allocate enough memory for wide strings. (gfc_conv_concat_op): Make sure operand kind are the same. (string_to_single_character): Remove gfc_ prefix. Reindent. Don't force the use of default character type. (gfc_conv_scalar_char_value): Likewise. (gfc_build_compare_string): Call string_to_single_character. (fill_with_spaces): New function (gfc_trans_string_copy): Add kind arguments. Use them to deal with wide character kinds. (gfc_conv_statement_function): Whitespace fix. Call gfc_trans_string_copy with new kind arguments. (gfc_conv_substring_expr): Call gfc_build_wide_string_const instead of using gfc_widechar_to_char. (gfc_conv_string_parameter): Don't force the use of default character type. (gfc_trans_scalar_assign): Pass kind args to gfc_trans_string_copy. * intrinsic.h (gfc_check_lge_lgt_lle_llt, gfc_convert_char_constant, gfc_resolve_adjustl, gfc_resolve_adjustr): New prototypes. * decl.c (gfc_set_constant_character_len): Don't assert the existence of a single character kind. * trans-array.h (gfc_trans_string_copy): New prototype. * gfortran.h (gfc_check_character_range, gfc_convert_chartype): New prototypes. * error.c (print_wide_char_into_buffer): New function lifting code from gfc_print_wide_char. Fix order to output '\x??' instead of 'x\??'. (gfc_print_wide_char): Call print_wide_char_into_buffer. (show_locus): Call print_wide_char_into_buffer with buffer local to this function. * trans-const.c (gfc_build_wide_string_const): New function. (gfc_conv_string_init): Deal with wide characters strings constructors. (gfc_conv_constant_to_tree): Call gfc_build_wide_string_const. * trans-stmt.c (gfc_trans_label_assign): Likewise. (gfc_trans_character_select): Deal with wide strings. * expr.c (gfc_check_assign): Allow conversion between character kinds on assignment. * trans-const.h (gfc_build_wide_string_const): New prototype. * trans-types.c (gfc_get_character_type_len_for_eltype, gfc_get_character_type_len): Create too variants of the old gfc_get_character_type_len, one getting kind argument and the other one directly taking a type tree. * trans.h (gfor_fndecl_select_string_char4, gfor_fndecl_convert_char1_to_char4, gfor_fndecl_convert_char4_to_char1): New prototypes. * trans-types.h (gfc_get_character_type_len_for_eltype): New prototype. * resolve.c (resolve_operator): Exit early when kind mismatches are detected, because that makes us issue an error message later. (validate_case_label_expr): Fix wording of error message. * iresolve.c (gfc_resolve_adjustl, gfc_resolve_adjustr): New functions. (gfc_resolve_pack): Call _char4 variants of library function when dealing with wide characters. (gfc_resolve_reshape): Likewise. (gfc_resolve_spread): Likewise. (gfc_resolve_transpose): Likewise. (gfc_resolve_unpack): Likewise. * target-memory.c (size_character): Take character kind bit size correctly into account (not that it changes anything for now, but it's more generic). (gfc_encode_character): Added gfc_ prefix. Encoding each character of a string by calling native_encode_expr for the corresponding unsigned integer. (gfc_target_encode_expr): Add gfc_ prefix to encode_character. * trans-decl.c (gfc_build_intrinsic_function_decls): Build gfor_fndecl_select_string_char4, gfor_fndecl_convert_char1_to_char4 and gfor_fndecl_convert_char4_to_char1. * target-memory.h (gfc_encode_character): New prototype. * arith.c (gfc_check_character_range): New function. (eval_intrinsic): Allow non-default character kinds. * check.c (gfc_check_access_func): Only allow default character kind arguments. (gfc_check_chdir): Likewise. (gfc_check_chdir_sub): Likewise. (gfc_check_chmod): Likewise. (gfc_check_chmod_sub): Likewise. (gfc_check_lge_lgt_lle_llt): New function. (gfc_check_link): Likewise. (gfc_check_link_sub): Likewise. (gfc_check_symlnk): Likewise. (gfc_check_symlnk_sub): Likewise. (gfc_check_rename): Likewise. (gfc_check_rename_sub): Likewise. (gfc_check_fgetputc_sub): Likewise. (gfc_check_fgetput_sub): Likewise. (gfc_check_stat): Likewise. (gfc_check_stat_sub): Likewise. (gfc_check_date_and_time): Likewise. (gfc_check_ctime_sub): Likewise. (gfc_check_fdate_sub): Likewise. (gfc_check_gerror): Likewise. (gfc_check_getcwd_sub): Likewise. (gfc_check_getarg): Likewise. (gfc_check_getlog): Likewise. (gfc_check_hostnm): Likewise. (gfc_check_hostnm_sub): Likewise. (gfc_check_ttynam_sub): Likewise. (gfc_check_perror): Likewise. (gfc_check_unlink): Likewise. (gfc_check_unlink_sub): Likewise. (gfc_check_system_sub): Likewise. * primary.c (got_delim): Perform correct character range checking for all kinds. * trans-intrinsic.c (gfc_conv_intrinsic_conversion): Generate calls to library functions convert_char4_to_char1 and convert_char1_to_char4 for character conversions. (gfc_conv_intrinsic_char): Allow all character kings. (gfc_conv_intrinsic_strcmp): Fix whitespace. (gfc_conv_intrinsic_repeat): Take care of all character kinds. * intrinsic.texi: For all GNU intrinsics accepting character arguments, mention that they're restricted to the default kind. * simplify.c (simplify_achar_char): New function. (gfc_simplify_achar, gfc_simplify_char): Call simplify_achar_char. gfc_simplify_ichar): Don't error out for wide characters. (gfc_convert_char_constant): New function. * gfortran.dg/achar_3.f90: Adjust error messages. * gfortran.dg/achar_5.f90: New test. * gfortran.dg/achar_6.F90: New test. * gfortran.dg/widechar_1.f90: New test. * gfortran.dg/widechar_2.f90: New test. * gfortran.dg/widechar_3.f90: New test. * gfortran.dg/widechar_4.f90: New test. * gfortran.dg/widechar_intrinsics_1.f90: New test. * gfortran.dg/widechar_intrinsics_2.f90: New test. * gfortran.dg/widechar_intrinsics_3.f90: New test. * gfortran.dg/widechar_intrinsics_4.f90: New test. * gfortran.dg/widechar_intrinsics_5.f90: New test. * gfortran.dg/widechar_select_1.f90: New test. * gfortran.dg/widechar_select_2.f90: New test. From-SVN: r135515
2008-05-17intrinsic.c (add_functions): Change FLUSH(C) to FLUSH(UNIT).Tobias Burnus1-1/+1
2008-05-16 Tobias Burnus <burnus@net-b.de> * intrinsic.c (add_functions): Change FLUSH(C) to FLUSH(UNIT). * intrinsic.texi: Change INTEGER(*) to INTEGER; fix keyword= name for ABS, ADJUSTL, AINT, ALLOCATED, ANINT, ASSOCIATED, C_ASSOCIATED, CEILING, DBLE, DFLOAT, DOT_PRODUCT, DREAL, FLOAT, FLOOR, GET_COMMAND. From-SVN: r135471
2008-05-06re PR fortran/36117 (Use MPFR for bessel function (optimization, rejects ↵Tobias Burnus1-12/+12
valid F2008)) 2008-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/36117 * intrinsic.c (add_functions): Call gfc_simplify_bessel_*. * intrinsic.h: Add prototypes for gfc_simplify_bessel_*. * simplify.c (gfc_simplify_bessel_j0,gfc_simplify_bessel_j1, gfc_simplify_bessel_jn,gfc_simplify_bessel_y0, gfc_simplify_bessel_y1,gfc_simplify_bessel_yn): New. 2008-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/36117 * gfortran.dg/bessel_2.f90: New. From-SVN: r134988
2008-04-30intrinsic.c (add_functions): Add SELECTED_CHAR_KIND intrinsic.François-Xavier Coudert1-0/+7
* intrinsic.c (add_functions): Add SELECTED_CHAR_KIND intrinsic. * intrinsic.h (gfc_check_selected_char_kind, gfc_simplify_selected_char_kind): New prototypes. * gfortran.h (gfc_isym_id): Add GFC_ISYM_SC_KIND. * trans.h (gfor_fndecl_sc_kind): New function decl. * trans-decl.c (gfor_fndecl_sc_kind): Build new decl. * arith.c (gfc_compare_with_Cstring): New function. * arith.h (gfc_compare_with_Cstring): New prototype. * check.c (gfc_check_selected_char_kind): New function. * primary.c (match_string_constant, match_kind_param): Mark symbols used as literal constant kind param as referenced. * trans-intrinsic.c (gfc_conv_intrinsic_sc_kind): New function. (gfc_conv_intrinsic_function): Call gfc_conv_intrinsic_sc_kind. * intrinsic.texi (SELECTED_CHAR_KIND): Document new intrinsic. * simplify.c (gfc_simplify_selected_char_kind): New function. * intrinsics/selected_char_kind.c: New file. * Makefile.am: Add intrinsics/selected_char_kind.c. * Makefile.in: Regenerate. * gfortran.dg/selected_char_kind_1.f90: New test. * gfortran.dg/selected_char_kind_2.f90: New test. * gfortran.dg/selected_char_kind_3.f90: New test. From-SVN: r134839
2008-03-06re PR fortran/33197 (Fortran 2008: math functions)Francois-Xavier Coudert1-10/+10
PR fortran/33197 * intrinsic.c (add_functions): Add simplification routines for ERF, DERF, ERFC and DERFC. * decl.c (gfc_match_suffix, gfc_match_subroutine): Change GNU extensions into Fortran 2008 features. * intrinsic.h (gfc_simplify_erf, gfc_simplify_erfc): New prototypes. * simplify.c (gfc_simplify_erf, gfc_simplify_erfc): New functions. From-SVN: r132970
2008-03-03re PR fortran/33197 (Fortran 2008: math functions)François-Xavier Coudert1-30/+58
PR fortran/33197 gcc/fortran/ * intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH, ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N}, ERFC_SCALED, LOG_GAMMA and HYPOT. * intrinsic.h (gfc_check_hypot, gfc_simplify_hypot, gfc_resolve_hypot): New prototypes. * mathbuiltins.def: Add HYPOT builtin. Make complex versions of ACOSH, ASINH and ATANH available. * gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values. * lang.opt: Add -std=f2008 option. * libgfortran.h: Define GFC_STD_F2008. * lang-specs.h: Add .f08 and .F08 file suffixes. * iresolve.c (gfc_resolve_hypot): New function. * parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008. * check.c (gfc_check_hypot): New function. * trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin. * options.c (set_default_std_flags): Allow Fortran 2008 by default. (form_from_filename): Add .f08 suffix. (gfc_handle_option): Handle -std=f2008 option. * simplify.c (gfc_simplify_hypot): New function. * gfortran.texi: Document Fortran 2008 status and file extensions. * intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics, as well as HYPOT and ERFC_SCALED. Update documentation of ERF, ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH. * invoke.texi: Document the new -std=f2008 option. libgomp/ * testsuite/libgomp.fortran/fortran.exp: Add .f08 and .F08 file suffixes. gcc/testsuite/ * gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes. * gfortran.dg/dg.exp: Likewise. * gfortran.dg/vect/vect.exp: Likewise. * gfortran.fortran-torture/execute/execute.exp: Likewise. * gfortran.fortran-torture/compile/compile.exp: Likewise. * gfortran.dg/gamma_1.f90: Also check log_gamma. * gfortran.dg/invalid_contains_1.f90: Remove warning about empty CONTAINS. * gfortran.dg/gamma_2.f90: Add a few error messages. * gfortran.dg/invalid_contains_2.f90: Remove warning about empty CONTAINS. * gfortran.dg/gamma_3.f90: Adjust error message. * gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma. * gfortran.dg/bind_c_usage_9.f03: Adjust error messages. * gfortran.dg/bessel_1.f90: New test. * gfortran.dg/recursive_check_3.f90: Remove warnings. * gfortran.dg/besxy.f90: Also check for new F2008 intrinsics. * gfortran.dg/derived_function_interface_1.f90: Remove warning. * gfortran.dg/contains_empty_1.f03: New test. * gfortran.dg/erfc_scaled_1.f90: New test. * gfortran.dg/hypot_1.f90: New test. * gfortran.dg/contains_empty_2.f03: New test. libgfortran/ * intrinsics/erfc_scaled_inc.c: New file. * intrinsics/erfc_scaled.c: New file. * gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*. * Makefile.am: Add intrinsics/erfc_scaled.c. * config.h.in: Regenerate. * configure: Regenerate. * Makefile.in: Regenerate. From-SVN: r132846
2008-02-24arith.c: Update copyright years.Tobias Schlüter1-1/+1
* arith.c: Update copyright years. * arith.h: Likewise. * array.c: Likewise. * bbt.c: Likewise. * check.c: Likewise. * data.c: Likewise. * data.h: Likewise. * decl.c: Likewise. * dependency.c: Likewise. * dependency.h: Likewise. * dump-parse-tree.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * gfc-internals.texi: Likewise. * gfortran.h: Likewise. * gfortran.texi: Likewise. * gfortranspec.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * intrinsic.h: Likewise. * intrinsic.texi: Likewise. * invoke.texi: Likewise. * io.c: Likewise. * iresolve.c: Likewise. * iso-c-binding.def: Likewise. * iso-fortran-env.def: Likewise. * lang-specs.h: Likewise. * lang.opt: Likewise. * libgfortran.h: Likewise. * match.c: Likewise. * match.h: Likewise. * matchexp.c: Likewise. * misc.c: Likewise. * module.c: Likewise. * openmp.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * parse.h: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * st.c: Likewise. * symbol.c: Likewise. * target-memory.c: Likewise. * target-memory.h: Likewise. * trans-array.h: Likewise. * trans-const.h: Likewise. * trans-stmt.h: Likewise. * trans-types.c: Likewise. * trans-types.h: Likewise. * types.def: Likewise. From-SVN: r132600
2007-12-25re PR fortran/34533 (DTIME returns total process time and not since last ↵Daniel Franke1-5/+9
invocation) gcc/fortran: 2007-12-25 Daniel Franke <franke.daniel@gmail.com> PR fortran/34533 * intrinsic.h (gfc_check_etime): Renamed to ... (gfc_check_dtime_etime): ... this. (gfc_check_etime_sub): Renamed to ... (gfc_check_dtime_etime_sub): ... this. (gfc_resolve_dtime_sub): New prototype. * check.c (gfc_check_etime): Renamed to ... (gfc_check_dtime_etime): ... this. (gfc_check_etime_sub): Renamed to ... (gfc_check_dtime_etime_sub): ... this. * iresolve.c (gfc_resolve_dtime_sub): New implementation. * intrinsic.c (add_functions): Removed alias from ETIME to DTIME, added stand-alone intrinsic DTIME. (add_subroutines): Adjusted check and resolve function names for DTIME and ETIME. * trans-intrinsic.c (gfc_conv_intrinsic_function): Added DTIME to known functions in switch. * intrinsic.texi (DTIME): Added paragraph about thread-safety, fixed return value section. (CPU_TIME): Clarified intent and added implementation notes. libgfortran: 2007-12-25 Daniel Franke <franke.daniel@gmail.com> PR fortran/34533 * intrinsics/cpu_time.c: Moved code commonly usable for CPU_TIME, DTIME and ETIME to ... * intrinsics/time_1.h: ... here. * intrinsics/dtime.c: New file. * intrinsics/etime.c: Newly implemented using the common time-aquisition function from time_1.h. * gfortran.map (_gfortran_dtime, _gfortran_dtime_sub): New. * Makefile.am: Added new file. * Makefile.in: Regenerated. * configure: Regenerated. From-SVN: r131168
2007-12-17intrinsic.c (add_functions): Undo change; mark float and sngl as STD_F77.Tobias Burnus1-2/+2
2007-12-17 Tobias Burnus <burnus@net-b.de> * intrinsic.c (add_functions): Undo change; mark float and sngl as STD_F77. * intrinsic.texi (FLOAT, SNGL): Change standard to F77 and later. * gfortran.texi (BOZ): Make note about FLOAT etc. clearer. 2007-12-17 Tobias Burnus <burnus@net-b.de> * gfortran.dg/initialization_16.f90: Update as FLOAT/SNGL are part of Fortran 77/95/2003. From-SVN: r131007
2007-12-16re PR fortran/34495 (accepts invalid initialization expressions withTRANSFER)Tobias Burnus1-2/+10
2007-12-16 Tobias Burnus <burnus@net-b.de> PR fortran/34495 * intrinsic.c (add_functions): Mark float and sngl as STD_GNU. (gfc_intrinsic_func_interface): Reject REAL, DBLE and CMPLX in initialization expressions for -std=f95. 2007-12-16 Tobias Burnus <burnus@net-b.de> PR fortran/34495 * gfortran.dg/initialization_16.f90: New. From-SVN: r130994
2007-11-29re PR fortran/34262 (MVBITS does not work for arrays)Tobias Burnus1-2/+6
2007-11-29 Tobias Burnus <burnus@net-b.de> PR fortran/34262 * intrinsic.c (gfc_get_intrinsic_sub_symbol): Add comment. (gfc_intrinsic_sub_interface): Copy elemental state if needed. * iresolve.c (gfc_resolve_mvbits): Mark procedure as elemental. 2007-11-29 Tobias Burnus <burnus@net-b.de> PR fortran/34262 * gfortran.dg/mvbits_3.f90: New. From-SVN: r130513
2007-10-27re PR fortran/33162 (INTRINSIC functions as ACTUAL argument)Jerry DeLisle1-30/+30
2007-10-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/33162 * intrinsic.h: Add prototypes for four new functions, gfc_check_datan2, gfc_check_dprod, gfc_check_fn_d, and gfc_check_x_yd. * intrinsic.c (add_functions): Add double precision checks for dabs, dacos, dacosh, dasin, dasinh, datan, datanh, datan2, dbesj0, dbesj1, dbesy0, dbesy1, dcos, dcosh, ddim, derf, derfc, dexp, dgamma, dlgama, dlog, dlog10, dmod, dsign, dsin, dsinh, dsqrt, dtan, and dtanh. Add real check dprod. * check.c (gfc_check_datan2): New function to check for double precision argumants. (gfc_check_dprod, gfc_check_fn_d, and gfc_check_x_yd): Ditto. From-SVN: r129673
2007-08-29re PR libfortran/32989 (GETARG intrinsic)Francois-Xavier Coudert1-3/+3
PR fortran/32989 * iresolve.c (gfc_resolve_getarg): Handle non-default integer kinds. * check.c (gfc_check_getarg): New function * intrinsic.h: Add prototype for gfc_check_getarg. * intrinsic.c (add_subroutines): Add reference to gfc_check_getarg. * intrinsic.texi (GETARG): Adjust documentation. * gfortran.fortran-torture/execute/getarg_1.f90: Add check for non-default integer kind arguments. From-SVN: r127905
2007-08-29re PR fortran/33105 (F2003: Support is_iostat_end & is_iostat_eor intrinsics)François-Xavier Coudert1-0/+12
PR fortran/33105 * intrinsic.c (add_functions): Add IS_IOSTAT_END and IS_IOSTAT_EOR intrinsics. * gfortran.h (gfc_isym_id): Add GFC_ISYM_IS_IOSTAT_END and GFC_ISYM_IS_IOSTAT_EOR. * trans-intrinsic.c (gfc_conv_has_intvalue): New function. (gfc_conv_intrinsic_function): Call gfc_conv_has_intvalue for GFC_ISYM_IS_IOSTAT_END and GFC_ISYM_IS_IOSTAT_EOR. * intrinsic.texi: Add IS_IOSTAT_END and IS_IOSTAT_EOR. * gfortran.dg/is_iostat_end_eor_1.f90: New test. From-SVN: r127903
2007-08-26re PR fortran/32980 (Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA ↵Tobias Burnus1-0/+25
(ALGAMA/DLGAMA)) 2007-08-26 Tobias Burnus <burnus@net-b.de> PR fortran/32980 * intrinsic.h (gfc_simplify_gamma,gfc_simplify_lgamma, gfc_resolve_gamma,gfc_resolve_lgamma): New function declations. * mathbuiltins.def: Define GAMMA and LGAMMA. * intrinsic.c (add_functions): Add GAMMA, DGAMMA, LGAMMA, ALGAMA and DLGAMA. * simplify.c (gfc_simplify_gamma,gfc_simplify_lgamma): New functions. * iresolve.c (gfc_resolve_gamma,gfc_resolve_lgamma): New functions. * intrinsic.texi: Add documentation for GAMMA and LGAMMA. 2007-08-26 Tobias Burnus <burnus@net-b.de> PR fortran/32980 * gfortran.dg/gamma_1.f90: New. * gfortran.dg/gamma_2.f90: New. * gfortran.dg/gamma_3.f90: New. From-SVN: r127809
2007-08-24re PR fortran/33178 (-std=f95: SIGN with integer arguments rejected as ↵Tobias Burnus1-6/+4
initialization expression) 2007-08-24 Tobias Burnus <burnus@net-b.de> PR fortran/33178 * intrinsic.c (gfc_intrinsic_func_interface): Fix initialization expression check. 2007-08-24 Tobias Burnus <burnus@net-b.de> PR fortran/33178 * gfortran.dg/initialization_4.f90: Update dg-error. * gfortran.dg/initialization_13.f90: New. From-SVN: r127786
2007-08-12re PR fortran/29600 ([F03] MINLOC and MAXLOC take an optional KIND argument)Francois-Xavier Coudert1-2/+3
PR fortran/29600 * intrinsic.c (add_functions): Add optional KIND argument to ACHAR. * iresolve.c (gfc_resolve_achar): Handle the KIND argument. * check.c (gfc_check_achar): Check for the optional KIND argument. * simplify.c (gfc_simplify_achar): Use KIND argument. * intrinsic.h (gfc_check_achar, gfc_simplify_achar, gfc_resolve_achar): Adjust prototypes. * gfortran.dg/intrinsics_kind_argument_1.f90: Add test for ACHAR intrinsic. From-SVN: r127385
2007-08-12re PR fortran/30964 (optional arguments to random_seed)Francois-Xavier Coudert1-2/+3
PR fortran/30964 PR fortran/33054 * trans-expr.c (gfc_conv_function_call): When no formal argument list is available, we still substitute missing optional arguments. * check.c (gfc_check_random_seed): Correct the check on the number of arguments to RANDOM_SEED. * intrinsic.c (add_subroutines): Add a resolution function to RANDOM_SEED. * iresolve.c (gfc_resolve_random_seed): New function. * intrinsic.h (gfc_resolve_random_seed): New prototype. * intrinsics/random.c (random_seed): Rename into random_seed_i4. (random_seed_i8): New function. * gfortran.map (GFORTRAN_1.0): Remove _gfortran_random_seed, add _gfortran_random_seed_i4 and _gfortran_random_seed_i8. * libgfortran.h (iexport_proto): Replace random_seed by random_seed_i4 and random_seed_i8. * runtime/main.c (init): Call the new random_seed_i4. * gfortran.dg/random_4.f90: New test. * gfortran.dg/random_5.f90: New test. * gfortran.dg/random_6.f90: New test. * gfortran.dg/random_7.f90: New test. From-SVN: r127383
2007-08-12re PR fortran/29600 ([F03] MINLOC and MAXLOC take an optional KIND argument)Francois-Xavier Coudert1-26/+41
PR fortran/29600 * intrinsic.c (add_functions): Add KIND arguments to COUNT, IACHAR, ICHAR, INDEX, LBOUND, LEN, LEN_TRIM, SCAN, SIZE, UBOUND and VERIFY. * iresolve.c (gfc_resolve_count): Add kind argument. (gfc_resolve_iachar): New function. (gfc_resolve_ichar): Add kind argument. (gfc_resolve_index_func): Likewise. (gfc_resolve_lbound): Likewise. (gfc_resolve_len): Likewise. (gfc_resolve_len_trim): Likewise. (gfc_resolve_scan): Likewise. (gfc_resolve_size): New function. (gfc_resolve_ubound): Add kind argument. (gfc_resolve_verify): Likewise. * trans-decl.c (gfc_get_extern_function_decl): Allow specific intrinsics to have 4 arguments. * check.c (gfc_check_count): Add kind argument. (gfc_check_ichar_iachar): Likewise. (gfc_check_index): Likewise. (gfc_check_lbound): Likewise. (gfc_check_len_lentrim): New function. (gfc_check_scan): Add kind argument. (gfc_check_size): Likewise. (gfc_check_ubound): Likewise. (gfc_check_verify): Likewise. * intrinsic.texi: Update documentation for COUNT, IACHAR, ICHAR, INDEX, LBOUND, LEN, LEN_TRIM, SCAN, SIZE, UBOUND and VERIFY. * simplify.c (get_kind): Whitespace fix. (int_expr_with_kind): New function. (gfc_simplify_iachar): Add kind argument. (gfc_simplify_iachar): Likewise. (gfc_simplify_ichar): Likewise. (gfc_simplify_index): Likewise. (simplify_bound_dim): Likewise. (simplify_bound): Likewise. (gfc_simplify_lbound): Likewise. (gfc_simplify_len): Likewise. (gfc_simplify_len_trim): Likewise. (gfc_simplify_scan): Likewise. (gfc_simplify_shape): Pass NULL as kind argument to gfc_simplify_size. (gfc_simplify_size): Add kind argument. (gfc_simplify_ubound): Likewise. (gfc_simplify_verify): Likewise. * intrinsic.h: Update prototypes and add new ones. * trans-intrinsic.c (gfc_conv_intrinsic_index): Rename into gfc_conv_intrinsic_index_scan_verify. (gfc_conv_intrinsic_scan, gfc_conv_intrinsic_verify): Remove. (gfc_conv_intrinsic_function): Call gfc_conv_intrinsic_index_scan_verify to translate the INDEX, SCAN and VERIFY intrinsics. * gfortran.dg/intrinsics_kind_argument_1.f90: New test. * gfortran.dg/pure_dummy_length_1.f90: Adapt to new error wording. From-SVN: r127380
2007-08-06re PR fortran/30933 (intrinsic: EXIT)Francois-Xavier Coudert1-3/+3
PR fortran/30933 * intrinsic.c (add_functions): Fix name of argument to CHDIR. From-SVN: r127257
2007-08-05re PR fortran/32979 (Implement vendor-specific ISNAN() intrinsic function)Francois-Xavier Coudert1-0/+6
PR fortran/32979 * intrinsic.h (gfc_check_isnan): Add prototype. * gfortran.h (gfc_isym_id): Add GFC_ISYM_ISNAN. * intrinsic.c (add_functions): Add ISNAN intrinsic. * check.c (gfc_check_isnan): New function. * trans-intrinsic.c (gfc_conv_intrinsic_isnan): New function. (gfc_conv_intrinsic_function): Call gfc_conv_intrinsic_isnan to translate ISNAN. * intrinsic.texi: Document ISNAN. * gfortran.dg/isnan_1.f90: New test. Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r127224
2007-08-01arith.c: Change copyright header to refer to version 3 of the GNU General ↵Nick Clifton1-4/+3
Public... * arith.c: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * openmp.c, interface.c, intrinsic.c, trans-array.c, trans-expr.c, symbol.c, iso-fortran-env.def, intrinsic.h, decl.c, trans-array.h, matchexp.c, dump-parse-tree.c, trans-common.c, array.c, Make-lang.in, trans-openmp.c, gfortran.h, error.c, iso-c-binding.def, lang.opt, data.c, trans-const.c, trans-stmt.c, expr.c, trans-const.h, trans-stmt.h, module.c, trans.c, scanner.c, trans-types.c, trans.h, gfortranspec.c, trans-types.h, lang-specs.h, io.c, bbt.c, resolve.c, f95-lang.c, st.c, iresolve.c, match.c, trans-decl.c, trans-io.c, target-memory.c, match.h, target-memory.h, parse.c, arith.h, check.c, dependency.c, parse.h, types.def, convert.c, dependency.h, primary.c, trans-intrinsic.c, options.c, misc.c, simplify.c: Likewise. From-SVN: r127129
2007-07-24re PR fortran/32778 (pedantic warning: intrinsics that are GNU extensions ↵Daniel Franke1-33/+30
not part of -std=gnu) gcc/fortran: 2007-07-24 Daniel Franke <franke.daniel@gmail.com> PR fortran/32778 * intrinsic.c (add_sym): Do not exclude any symbols, even if not part of the selected standard. (make generic): Likewise. (make alias): Likewise, set standard the alias belongs to. (add_subroutines): Call make_noreturn unconditionally. (check_intrinsic_standard): Change return value to try. (gfc_intrinsic_func_interface): Check return value of above function. (gfc_intrinsic_sub_interface): Likewise. gcc/testsuite: 2007-07-24 Daniel Franke <franke.daniel@gmail.com> PR fortran/32778 * gfortran.dg/imag_2.f: Removed * gfortran.dg/warn_std_1.f90: New test. * gfortran.dg/warn_std_2.f90: New test. * gfortran.dg/warn_std_3.f90: New test. From-SVN: r126881
2007-07-22re PR fortran/29962 (Initialization expressions)Daniel Franke1-361/+346
gcc/fortran: 2007-07-22 Daniel Franke <franke.daniel@gmail.com> PR fortran/29962 PR fortran/31253 PR fortran/31265 PR fortran/31639 * gfortran.h (gfc_intrinsic_sym): Changed members elemental, pure, generic, specific, actual_ok, noreturn into bits of a bitfield, added bits for inquiry, transformational, conversion. * check.c (non_init_transformational): Removed, removed all callers. * intrinsic.c (enum class): New. (add_sym*): Replaced argument elemetal by enum class. Changed all callers. (add_functions): Assign appropriate classes to intrinsic functions. (add_subroutines): Assign appropriate classes to intrinsic subroutines. (add_conv): Set conversion attribute. (gfc_init_expr_extensions): Removed, removed all callers. (gfc_intrinsic_func_interface): Reimplemented check for non-standard initializatione expressions. * expr.c (check_specification_function): New. (gfc_is_constant_expr): Added check for specification functions. (check_init_expr_arguments): New. (check_inquiry): Changed return value to MATCH, added checks for inquiry functions defined by F2003. (check_transformational): New. (check_null): New. (check_elemental): New. (check_conversion): New. (check_init_expr): Call new check functions, add more specific error messages. gcc/testsuite: 2007-07-22 Daniel Franke <franke.daniel@gmail.com> PR fortran/29962 * gfortran.dg/array_initializer_1.f90: Removed warning. * gfortran.dg/initialization_1.f90: Adjusted messages. * gfortran.dg/nested_modules_6.f90: Removed warning. PR fortran/31253 * gfortran.dg/initialization_7.f90: New test. PR fortran/31639 * gfortran.dg/initialization_8.f90: New test. From-SVN: r126826
2007-06-30re PR fortran/20373 (INTRINSIC symbols can be given the wrong type)Daniel Franke1-8/+7
gcc/fortran: 2007-06-30 Daniel Franke <franke.daniel@gmail.com> PR fortran/20373 * intrinsic.c (add_functions): Additional function types. (gfc_convert_type_warn): Remove intrinsic-flag from conversion functions. * resolve.c (resolve_symbol): Added type checks to explicitly defined intrinsics. gcc/testsuite: 2007-06-28 Daniel Franke <franke.daniel@gmail.com> PR fortran/20373 * gfortran.dg/intrinsic.f90: New test. From-SVN: r126153
2007-05-31trans-expr.c (gfc_conv_expr_op): Use zero constant that matches the lse type.Richard Guenther1-2/+2
2007-05-31 Richard Guenther <rguenther@suse.de> * trans-expr.c (gfc_conv_expr_op): Use zero constant that matches the lse type. (gfc_trans_string_copy): Use sizetype zero constant. * intrinsic.c (add_functions): The sizeof intrinsic has index type result. * trans-types.c (gfc_get_dtype): Convert size to index type before shifting. * trans-array.c (gfc_trans_array_constructor_value): Use index type for offset computation. * trans-intrinsic.c (gfc_conv_associated): Use correct type for zero constant. From-SVN: r125242
2007-05-29gfortran.h: Renamed 'enum gfc_generic_isym_id' to 'enum gfc_isym_id'...Daniel Franke1-347/+352
2007-05-29 Daniel Franke <franke.daniel@gmail.com> * gfortran.h: Renamed 'enum gfc_generic_isym_id' to 'enum gfc_isym_id', added missing GFC_ISYM_* enumerators, ordered alphabetically. (struct gfc_intrinsic_sym): Renamed 'generic_id' to 'id'. (gfc_find_subroutine): New prototype. * intrinsic.c (add_sym, add_sym_*): Added argument 'id' and changed all callers. (find_subroutine): Renamed to 'gfc_find_subroutine', removed static. * dependency.c: Changed usage of isym->generic_id to isym->id. * openmp.c: Likewise. * resolve.c: Likewise. * trans-array.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-openmp.c: Likewise. From-SVN: r125168
2007-05-29gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_SIZEOF.Tobias Schlüter1-0/+6
2007-05-28 Tobias Schlter <tobi@gcc.gnu.org> fortran/ * gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_SIZEOF. * intrinsic.c (add_functions): Add stuff for SIZEOF intrinsic. * intrinsic.h (gfc_check_sizeof): Add prototype of ... * check.c (gfc_check_sizeof): .. new function. * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): New function. (gfc_conv_intrinsic_strcmp): Whitespace fix. (gfc_conv_intrinsic_array_transfer): Remove double initialization, use fold_build. where appropriate. (gfc_conv_intrinsic_function): Add case for SIZEOF. * intrinsic.texi: Add documentation for SIZEOF. testsuite/ * gfortran.dg/sizeof.f90: New. From-SVN: r125161
2007-05-28gfortran.h (gfc_expr): Remove from_H, add "representation" struct.Brooks Moses1-10/+0
* gfortran.h (gfc_expr): Remove from_H, add "representation" struct. * primary.c (match_hollerith_constant): Store the representation of the Hollerith in representation, not in value.character. * arith.c: Add dependency on target-memory.h. (eval_intrinsic): Remove check for from_H. (hollerith2representation): New function. (gfc_hollerith2int): Determine value of the new constant. (gfc_hollerith2real): Likewise. (gfc_hollerith2complex): Likewise. (gfc_hollerith2logical): Likewise. (gfc_hollerith2character): Point both representation.string and value.character.string at the value string. * data.c (create_character_initializer): For BT_HOLLERITH rvalues, get the value from the representation rather than value.character. * expr.c (free_expr0): Update handling of BT_HOLLERITH values and values with representation.string. (gfc_copy_expr): Likewise. * intrinsic.c (do_simplify): Remove special treatement of variables resulting from Hollerith constants. * dump-parse-trees.c (gfc_show_expr): Update handling of Holleriths. * trans-const.c (gfc_conv_constant_to_tree): Replace from_H check with check for representation.string; get Hollerith representation from representation.string, not value.character. * trans-expr.c (is_zero_initializer_p): Replace from_H check with check for representation.string. * trans-stmt.c (gfc_trans_integer_select): Use gfc_conv_mpz_to_tree for case values, so as to avoid picking up the memory representation if the case is given by a transfer expression. * target-memory.c (gfc_target_encode_expr): Use the known memory representation rather than the value, if it exists. (gfc_target_interpret_expr): Store the memory representation of the interpreted expression as well as its value. (interpret_integer): Move to gfc_interpret_integer, make non-static. (interpret_float): Move to gfc_interpret_float, make non-static. (interpret_complex): Move to gfc_interpret_complex, make non-static. (interpret_logical): Move to gfc_interpret_logical, make non-static. (interpret_character): Move to gfc_interpret_character, make non-static. (interpret_derived): Move to gfc_interpret_derived, make non-static. * target-memory.h: Add prototypes for newly-exported gfc_interpret_* functions. From-SVN: r125135
2007-05-17re PR fortran/31919 ([4.1/4.2 only] min/max do not check array conformance)Daniel Franke1-23/+21
gcc/fortran: 2007-05-15 Daniel Franke <franke.daniel@gmail.com> PR fortran/31919 PR fortran/31929 PR fortran/31930 * intrinsic.c (check_specific): Check elemental intrinsics for rank and shape. (add_functions): Fixed dummy argument names of BESJN and BESYN. Fixed elemental status of MCLOCK and MCLOCK8. * check.c (check_rest): Added check for array conformance. (gfc_check_merge): Removed check for array conformance. (gfc_check_besn): Removed check for scalarity. * intrinsic.texi (CSHIFT, EOSHIFT): Fixed typos. (BESJN, BESYN): Clarified documentation. gcc/testsuite: 2007-05-17 Daniel Franke <franke.daniel@gmail.com> PR fortran/31919 * gfortran.dg/min_max_conformance.f90: New test. From-SVN: r124794
2007-05-04re PR libfortran/31760 (missing elemental applicability)Daniel Franke1-12/+12
gcc/fortran: 2007-05-04 Daniel Franke <franke.daniel@gmail.com> PR fortran/31760 * intrinsic.c (add_functions): Replaced calls to gfc_check_g77_math1 by gfc_check_fn_r to avoid checks for scalarity. * check.c (gfc_check_besn): Removed check for scalarity. (gfc_check_g77_math1): Removed. * intrinsic.h (gfc_check_g77_math1): Removed. gcc/testsuite: 2007-05-04 Daniel Franke <franke.daniel@gmail.com> PR fortran/31760 * gfortran.dg/erf.f90: New test. * gfortran.dg/besxy.f90: New test. [gcc/fortran/ChangeLog was already committed in r124441 by accident] From-SVN: r124446
2007-05-04re PR target/22539 (Internal compiler error with maximum sized array)Daniel Franke1-1/+7
gcc/fortran: 2007-05-04 Daniel Franke <franke.daniel@gmail.com> PR fortran/22539 * intrinsic.c (add_subroutines): Added FSEEK. * intrinsic.h (gfc_resolve_fseek_sub, gfc_check_fseek_sub): New. * iresolve.c (gfc_resolve_fseek_sub): New. * check.c (gfc_check_fseek_sub): New. * intrinsic.texi (FSEEK): Updated. gcc/testsuite: 2007-05-01 Daniel Franke <franke.daniel@gmail.com> PR fortran/22539 * gfortran.dg/fseek.f90: New test. libgfortran: 2007-05-04 Daniel Franke <franke.daniel@gmail.com> PR fortran/22539 * io/intrinsics.c (fseek_sub): New. * io/unix.c (fd_fseek): Change logical and physical offsets only if seek succeeds. * gfortran.map (fseek_sub): New. From-SVN: r124437
2007-05-01intrinsic.c (add_functions): Fixed ELEMENTAL specifications.Daniel Franke1-66/+66
2007-05-01 Daniel Franke <franke.daniel@gmail.com> * intrinsic.c (add_functions): Fixed ELEMENTAL specifications. (add_subroutines): Replaced magic numbers in function calls by ELEMENTAL and NOT_ELEMENTAL respectively. * intrinsic.texi (MVBITS): Changed class to elemental subroutine. (RANDOM_NUMBER): Changed class to subroutine. (HUGE, TINY): Changed class to inquiry function. From-SVN: r124320
2007-04-25re PR fortran/31668 (%VAL rejected for PROC_MODULE and PROC_INTERNAL procedures)Tobias Burnus1-2/+2
fortran/ 2007-04-25 Tobias Burnus <burnus@net-b.de> PR fortran/31668 * error.c (error_print): Fix %% support. * intrinsic.c (sort_actual): Improve error message. * resolve.c (resolve_actual_arglist): Allow %VAL for interfaces defined in the module declaration part. testsuite/ 2007-04-25 Tobias Burnus <burnus@net-b.de> PR fortran/31668 * gfortran.dg/c_by_val_2.f90: Add rejection test of %VAL with statement functions. * gfortran.dg/c_by_val_5.f90: New test. From-SVN: r124147
2007-04-07re PR fortran/31257 (ICE in gfc_conv_expr_descriptor)Paul Thomas1-1/+1
2007-04-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/31257 * intrinsic.c (add_functions): Add ref. to gfc_resolve_achar. * intrinsic.h : Add prototype for gfc_resolve_achar. * iresolve.c (gfc_resolve_achar): New function. 2007-04-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/31257 * gfortran.dg/achar_4.f90: New test. From-SVN: r123646