aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-31re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-1/+13
2011-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * intrinsic.c (klass): Add CLASS_ATOMIC. (add_subroutines): Add atomic_ref/atomic_define. * intrinsic.texi (ATOMIC_REF, ATOMIC_DEFINE): Document. * intrinsic.h (gfc_check_atomic_def, gfc_check_atomic_ref, gfc_resolve_atomic_def, gfc_resolve_atomic_ref): New prototypes. * gfortran.h (gfc_isym_id): Add GFC_ISYM_ATOMIC_DEF and GFC_ISYM_ATOMIC_REF. (gfc_atomic_int_kind, gfc_atomic_logical_kind): New global vars. * iresolve.c (gfc_resolve_atomic_def, gfc_resolve_atomic_ref): * New functions. * check.c (gfc_check_atomic, gfc_check_atomic_def, gfc_check_atomic_ref): New functions. * iso-fortran-env.def (ISOFORTRANENV_FILE_ATOMIC_INT_KIND, ISOFORTRANENV_FILE_ATOMIC_LOGICAL_KIND): Change kind value. * trans-intrinsic.c (conv_intrinsic_atomic_def, conv_intrinsic_atomic_ref, gfc_conv_intrinsic_subroutine): New functions. (conv_intrinsic_move_alloc) Renamed from gfc_conv_intrinsic_move_alloc - and made static. * trans.h (gfc_conv_intrinsic_move_alloc): Remove. (gfc_conv_intrinsic_subroutine) Add prototype. * trans.c (trans_code): Call gfc_conv_intrinsic_subroutine. From-SVN: r174510
2011-05-27re PR fortran/48820 (TR 29113: Implement parts needed for MPI 3)Tobias Burnus1-0/+9
2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.h (gfc_isym_id): Add GFC_ISYM_RANK. * intrinsic.c (add_functions): Add rank intrinsic. (gfc_check_intrinsic_standard): Handle GFC_STD_F2008_TR. * intrinsic.h (gfc_simplify_rank, gfc_check_rank): Add * prototypes. * simplify.c (gfc_simplify_rank): New function. * intrinsic.texi (RANK): Add description for rank intrinsic. * check.c (gfc_check_rank): New function. 2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/rank_3.f90: New. * gfortran.dg/rank_4.f90: New. From-SVN: r174348
2011-04-18convert each use of gfc_free (p) to free (p)Jim Meyering1-5/+5
Do that by running this command: perl -pi -e 's/\bgfc_free ?\(/free (/' \ $(git grep -El '\bgfc_free ?\(') which also corrects the few uses that lacked a space between the function name and the open parenthesis. Manually undo the change to the function definition itself and its prototype. They'll be removed next. * array.c (gfc_free_array_spec, gfc_set_array_spec): s/gfc_free/free/ * constructor.c (node_free): Likewise. * cpp.c (dump_queued_macros): Likewise. * data.c (gfc_assign_data_value): Likewise. * decl.c (free_variable, free_value, gfc_free_data): Likewise. (gfc_free_data_all, match_old_style_init): Likewise. (gfc_set_constant_character_len, gfc_free_enum_history, NUM_DECL): Likewise. (gfc_match_modproc): Likewise. * dependency.c (check_section_vs_section): Likewise. * error.c (gfc_pop_error, gfc_free_error): Likewise. * expr.c (free_expr0, gfc_free_expr, gfc_free_actual_arglist): Likewise. (gfc_free_ref_list, gfc_replace_expr, gfc_copy_ref): Likewise. (find_substring_ref, gfc_simplify_expr, gfc_check_assign_symbol): Likewise. * frontend-passes.c (gfc_run_passes, cfe_expr_0): Likewise. (strip_function_call, optimize_comparison): Likewise. * interface.c (gfc_free_interface, arginfo, check_interface0): Likewise. (CHECK_OS_COMPARISON, gfc_extend_assign, gfc_free_formal_arglist): Likewise. * intrinsic.c (gfc_intrinsic_done_1, gfc_convert_type_warn): Likewise. (gfc_convert_chartype): Likewise. * io.c (gfc_free_open, compare_to_allowed_values, gfc_free_close): Likewise. (gfc_free_filepos, gfc_free_dt, gfc_free_inquire): Likewise. * match.c (gfc_free_iterator, gfc_match_associate): Likewise. (gfc_free_alloc_list, gfc_free_namelist, gfc_free_equiv_until): Likewise. (free_case, gfc_free_forall_iterator): Likewise. * misc.c: Likewise. * module.c (free_pi_tree, resolve_fixups, free_rename): Likewise. (free_true_name, peek_atom, mio_allocated_wide_string): Likewise. (mio_pool_string, mio_internal_string, mio_gmp_integer): Likewise. (mio_gmp_real, mio_expr, mio_typebound_proc): Likewise. (mio_full_typebound_tree, skip_list, load_equiv): Likewise. (free_written_common, gfc_use_module, gfc_free_use_stmts): Likewise. * openmp.c (gfc_free_omp_clauses): Likewise. * options.c (gfc_post_options): Likewise. * parse.c (select_type_pop, parse_omp_structured_block): Likewise. * primary.c (gfc_free_structure_ctor_component): Likewise. * resolve.c (resolve_structure_cons, check_host_association): Likewise. (gfc_resolve_forall, resolve_equivalence): Likewise. * scanner.c (gfc_scanner_done_1, gfc_release_include_path): Likewise. (gfc_define_undef_line, preprocessor_line, include_line): Likewise. (load_file, gfc_read_orig_filename): Likewise. * simplify.c (simplify_transformation_to_array): Likewise. (gfc_simplify_ibits, simplify_shift, gfc_simplify_ishftc, STRING): Likewise. (gfc_simplify_compiler_options): Likewise. * st.c (gfc_free_statement, gfc_free_statements): Likewise. (gfc_free_association_list): Likewise. * symbol.c (free_components, gfc_free_st_label, free_st_labels): Likewise. (gfc_delete_symtree, gfc_free_symbol, gfc_undo_symbols): Likewise. (free_old_symbol, gfc_commit_symbols, free_tb_tree): Likewise. (free_common_tree, free_uop_tree, free_sym_tree): Likewise. (gfc_free_dt_list, gfc_free_equiv_infos, gfc_free_equiv_lists): Likewise. (gfc_free_finalizer, gfc_free_charlen, free_entry_list): Likewise. (gfc_free_namespace): Likewise. * trans-array.c (gfc_free_ss, gfc_trans_array_bound_check): Likewise. (gfc_conv_array_ref, gfc_conv_ss_startstride): Likewise. (gfc_trans_dummy_array_bias, gfc_conv_array_parameter): Likewise. * trans-common.c (get_init_field, create_common): Likewise. * trans-const.c (gfc_build_wide_string_const): Likewise. (gfc_conv_string_init): Likewise. * trans-decl.c (gfc_generate_function_code): Likewise. * trans-expr.c (gfc_conv_substring, gfc_free_interface_mapping): Likewise. (SCALAR_POINTER, gfc_conv_statement_function): Likewise. (gfc_trans_subarray_assign): Likewise. * trans-intrinsic.c (conv_generic_with_optional_char_arg): Likewise. * trans-io.c (gfc_trans_io_runtime_check, set_string): Likewise. (transfer_namelist_element, transfer_array_component): Likewise. * trans-openmp.c (gfc_trans_omp_array_reduction): Likewise. * trans-stmt.c (cleanup_forall_symtrees, gfc_trans_forall_1): Likewise. * trans.c (trans_runtime_error_vararg, gfc_restore_backend_locus): Likewise. From-SVN: r172666
2011-03-27re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-1/+2
2011-03-27 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * gfortran.h (gfc_isym_id): Rename GFC_ISYM_NUMIMAGES to GFC_ISYM_NUM_IMAGES. (gfc_fcoarray): Add GFC_FCOARRAY_LIB. * intrinsic.c (add_functions): Update due to GFC_ISYM_NUM_IMAGES rename. * invoke.texi (-fcoarray=): Document "lib" argument. * iresolve.c (gfc_resolve_this_image): Fix THIS IMAGE(). * libgfortran.h (libgfortran_stat_codes): Add comments. * options.c (gfc_handle_coarray_option): Add -fcoarray=lib. * simplify.c (gfc_simplify_num_images, gfc_simplify_this_image): Handle GFC_FCOARRAY_LIB. * trans.h (gfc_init_coarray_decl): New prototype. (gfor_fndecl_caf_init, gfor_fndecl_caf_finalize, gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical, gfor_fndecl_caf_sync_all, gfor_fndecl_caf_sync_images, gfor_fndecl_caf_error_stop, gfor_fndecl_caf_error_stop_str, gfort_gvar_caf_num_images, gfort_gvar_caf_this_image): New global variables. * trans-decl.c: Declare several CAF functions (cf. above). (gfc_build_builtin_function_decls): Initialize those. (gfc_init_coarray_decl): New function. (create_main_function): Call CAF init/finalize functions. * trans-intrinsic.c (trans_this_image, trans_num_images): New. (gfc_conv_intrinsic_function): Call those. * trans-stmt.c (gfc_trans_stop, gfc_trans_sync, * gfc_trans_critical): Add code for GFC_FCOARRAY_LIB. From-SVN: r171568
2011-01-29re PR fortran/47531 (SHAPE misses KIND= support)Tobias Burnus1-2/+3
2011-01-29 Tobias Burnus <burnus@net-b.de> PR fortran/47531 * check.c (gfc_check_shape): Support kind argument in SHAPE. * intrinsic.c (add_functions): Ditto. * resolve.c (gfc_resolve_shape): Ditto. * simplify.c (gfc_simplify_shape): Ditto. * intrinsic.h (gfc_check_shape, gfc_resolve_shape, gfc_simplify_shape): Update prototypes. * intrinisc.text (SHAPE): Document kind argument. 2011-01-29 Tobias Burnus <burnus@net-b.de> PR fortran/47531 * gfortran.dg/shape_6.f90: New. From-SVN: r169392
2011-01-07re PR fortran/41580 ([OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add ↵Tobias Burnus1-3/+4
compile-time simplifcation) 2011-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/41580 * class.c (gfc_build_class_symbol): Mark __vtab as attr.vtab. * intrinsic.c (add_functions): Use simplify functions for EXTENDS_TYPE_OF and SAME_TYPE_AS. * intrinsic.h (gfc_simplify_extends_type_of, gfc_simplify_same_type_as): New prototypes. * simplify.c (is_last_ref_vtab, gfc_simplify_extends_type_of, gfc_simplify_same_type_as): New functions. 2011-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/41580 * gfortran.dg/extends_type_of_3.f90: New. From-SVN: r168579
2010-11-10re PR fortran/46411 (MOVE_ALLOC wrongly rejected as impure)Tobias Burnus1-1/+1
2010-11-10 Tobias Burnus <burnus@net-b.de> PR fortran/46411 * intrinsic.c (gfc_intrinsic_sub_interface): Check for attr.pure and not for attr.elemental. * intrinsic.texi (move_alloc): Document as being pure. 2010-11-10 Tobias Burnus <burnus@net-b.de> PR fortran/46411 * gfortran.dg/intrinsic_7.f90: New. From-SVN: r166550
2010-11-10re PR fortran/46331 (Compilation time long with simple function in array ↵Jerry DeLisle1-15/+1
constructor) 2010-11-09 Jerry DeLisle <jvdelisle@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org> PR fortran/46331 * intrinsic.c: Correctly set the pure attributes for intrinsic functions. * expr.c (check_specification_function): Remove this function and move its code into gfc_is_constant_expr. (gfc_is_constant_expr): Change the order of checks by checking for non-constant arguments first. Then, check for initialization functions, followed by intrinsics. Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org> From-SVN: r166520
2010-09-29optc-gen.awk: Generate global_options initializer instead of individual ↵Joseph Myers1-3/+3
variables. gcc: * optc-gen.awk: Generate global_options initializer instead of individual variables. Add x_ prefix to names of structure members. * opth-gen.awk: Generate gcc_options structure. Add x_ prefix to names of structure members. * doc/tm.texi.in (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Document. * doc/tm.texi: Regenerate. * alias.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * builtins.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER. * c-parser.c (disable_extension_diagnostics, restore_extension_diagnostics): Update names of cpp_options members. * combine.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * common.opt (fcompare-debug-second): Don't use Var. * config/alpha/alpha.h (target_flags): Remove. * config/arm/arm.h (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Define. * config/bfin/bfin.h (target_flags): Remove. * config/cris/cris.h (target_flags): Remove. * config/i386/i386-c.c (ix86_pragma_target_parse): Update names of cl_target_option members. * config/i386/i386.c (ix86_force_align_arg_pointer): Remove. (ix86_function_specific_print, ix86_valid_target_attribute_tree, ix86_can_inline_p): Update names of cl_target_option members. * config/i386/i386.h (ix86_isa_flags): Remove. * config/lm32/lm32.h (target_flags): Remove. * config/mcore/mcore.h (mcore_stack_increment): Remove. * config/mcore/mcore.md (addsi3): Remove extern declaration of flag_omit_frame_pointer. * config/mep/mep.h (target_flags): Remove. * config/mips/mips.h (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Define. * config/mmix/mmix.h (target_flags): Remove. * config/rs6000/rs6000.h (rs6000_xilinx_fpu, flag_pic, flag_expensive_optimizations): Remove. * config/s390/s390.h (flag_pic): Remove. * config/score/score-conv.h (target_flags): Remove. * config/sh/sh.h (sh_fixed_range_str): Remove. * config/spu/spu.h (target_flags, spu_fixed_range_string): Remove. * dbxout.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER * df-scan.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * diagnostic.c (diagnostic_initialize): Update names of diagnostic_context members. * diagnostic.h (diagnostic_context): Rename inhibit_warnings and warn_system_headers. (diagnostic_report_warnings_p): Update for new names. * dwarf2out.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER * emit-rtl.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER and HARD_FRAME_POINTER_IS_ARG_POINTER. * flags.h (flag_compare_debug): Declare. * ira.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * opts.c (flag_compare_debug): Define. (common_handle_option): Update names of diagnostic_context members. Handle -fcompare-debug-second. (fast_math_flags_struct_set_p): Update names of cl_optimization members. * reginfo.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * regrename.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * reload.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * reload1.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * resource.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * rtl.h (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Define and use. * sel-sched.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * stmt.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER. gcc/c-family: * c-common.c (c_cpp_error): Update names of diagnostic_context members. * c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Update names of cl_optimization members. * c-opts.c (warning_as_error_callback, c_common_handle_option, sanitize_cpp_opts, finish_options): Update names of cpp_options members. gcc/fortran: * cpp.c (cpp_define_builtins): Update names of gfc_option_t members. (gfc_cpp_post_options): Update names of cpp_options members. (cb_cpp_error): Update names of diagnostic_context members. * f95-lang.c (gfc_init_builtin_functions): Update names of gfc_option_t members. * gfortran.h (gfc_option_t): Rename warn_conversion and flag_openmp. * intrinsic.c (gfc_convert_type_warn): Update names of gfc_option_t members. * options.c (gfc_init_options, gfc_post_options, set_Wall, gfc_handle_option): Update names of gfc_option_t members. * parse.c (next_free, next_fixed): Update names of gfc_option_t members. * scanner.c (pedantic): Remove extern declaration. (skip_free_comments, skip_fixed_comments, include_line): Update names of gfc_option_t members. * trans-decl.c (gfc_generate_function_code): Update names of gfc_option_t members. gcc/java: * java-tree.h (flag_filelist_file, flag_assert, flag_jni, flag_force_classes_archive_check, flag_redundant, flag_newer, flag_use_divide_subroutine, flag_use_atomic_builtins, flag_use_boehm_gc, flag_hash_synchronization, flag_check_references, flag_optimize_sci, flag_indirect_classes, flag_indirect_dispatch, flag_store_check, flag_reduced_reflection): Remove. * jcf-dump.c (flag_newer): Remove. * jcf.h (quiet_flag): Remove. * parse.h (quiet_flag): Remove. libcpp: * include/cpplib.h (cpp_options): Rename warn_deprecated, warn_traditional, warn_long_long and pedantic. * directives.c (directive_diagnostics, _cpp_handle_directive): Update names of cpp_options members. * expr.c (cpp_classify_number, eval_token): Update names of cpp_options members. * init.c (cpp_create_reader, post_options): Update names of cpp_options members. * internal.h (CPP_PEDANTIC, CPP_WTRADITIONAL): Update names of cpp_options members. * macro.c (parse_params): Update names of cpp_options members. From-SVN: r164723
2010-09-28re PR fortran/40569 (F2008: Support COMPILER_OPTIONS() / COMPILER_VERSION())Tobias Burnus1-4/+4
gcc/ 2010-09-28 Tobias Burnus <burnus@net-b.de> PR fortran/40569 PR fortran/40568 * toplev.h (save_decoded_options, save_decoded_options_count): New global variables. * toplev.c (save_decoded_options, save_decoded_options_count): export variables. gcc/fortran/ 2010-09-28 Tobias Burnus <burnus@net-b.de> PR fortran/40569 PR fortran/40568 * intrinsic.c (add_functions): Make compiler_version and compiler_options CLASS_INQUIRY. * gfortran.h (gfc_get_option_string): New prototype. * intrinsic.texi (COMPILER_VERSION, COMPILER_OPTIONS): Add documentation. (C_SIZEOF): Mark as inquiry function of ISO_C_BINDING. (ISO_FORTRAN_ENV): Refer to COMPILER_VERSION and COMPILER_OPTIONS. (ISO_C_BINDING): Refer to C_SIZEOF. * options.c (gfc_get_option_string): New function. * simplify.c (gfc_simplify_compiler_options): Use it. (gfc_simplify_compiler_version): Include compiler name. From-SVN: r164698
2010-09-27re PR fortran/40569 (F2008: Support COMPILER_OPTIONS() / COMPILER_VERSION())Tobias Burnus1-7/+56
2010-09-27 Tobias Burnus <burnus@net-b.de> PR fortran/40569 PR fortran/40568 * intrinsic.h (gfc_simplify_compiler_options, gfc_simplify_compiler_version): New prototypes. * intrinsic.c (gfc_intrinsic_function_by_id, make_from_module): New functions. (gfc_find_function, gfc_find_subroutine, gfc_generic_intrinsic, gfc_specific_intrinsic): Don't return module intrinsics. (add_functions): Add compiler_options, compiler_version. (gfc_intrinsic_func_interface): Also lookup symbol by ISYM ID. * symbol.c (std_for_isocbinding_symbol): Add version check for NAMED_FUNCTIONS. * iso-fortran-env.def: Add compiler_options, compiler_version. * iso-c-binding.def: Add c_sizeof. * gfortran.h (gfc_intrinsic_sym): Add from_module:1. (iso_c_binding_symbol, iso_fortran_env_symbol): Add NAMED_FUNCTIONS. (gfc_intrinsic_function_by_id): New prototype. * module.c (create_intrinsic_function): New function. (import_iso_c_binding_module, use_iso_fortran_env_module): Use it. * trans-types.c (init_c_interop_kinds): Add NAMED_FUNCTIONS. * resolve.c (resolve_intrinsic): Try also to resolve intrinsics by ISYM ID. * simplify.c (gfc_simplify_compiler_options, gfc_simplify_compiler_version): New functions. 2010-09-27 Tobias Burnus <burnus@net-b.de> PR fortran/40569 PR fortran/40568 * gfortran.dg/storage_size_2.f08: Fix test. * gfortran.dg/c_sizeof_1.f90: Fix test. * gfortran.dg/c_sizeof_2.f90: Update dg-error. * gfortran.dg/c_sizeof_3.f90: New. * gfortran.dg/c_sizeof_4.f90: New. * gfortran.dg/iso_c_binding_compiler_1.f90: New. * gfortran.dg/iso_c_binding_compiler_2.f90: New. From-SVN: r164639
2010-09-23re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))Daniel Kraft1-0/+13
2010-09-23 Daniel Kraft <d@domob.eu> PR fortran/38936 PR fortran/44044 PR fortran/45474 * gfortran.h (gfc_check_vardef_context): New method. (struct symbol_attribute): New flag `select_type_temporary'. * primary.c (gfc_variable_attr): Clarify initialization of ref. (match_variable): Remove PROTECTED check and assignment check for PARAMETERs (this is now done later). * match.c (gfc_match_iterator): Remove INTENT(IN) check. (gfc_match_associate): Defer initialization of newAssoc->variable. (gfc_match_nullify): Remove PURE definability check. (select_type_set_tmp): Set new `select_type_temporary' flag. * expr.c (gfc_check_assign): Remove INTENT(IN) check here. (gfc_check_pointer_assign): Ditto (and other checks removed). (gfc_check_vardef_context): New method. * interface.c (compare_parameter_protected): Removed. (compare_actual_formal): Use `gfc_check_vardef_context' for checks related to INTENT([IN]OUT) arguments. * intrinsic.c (check_arglist): Check INTENT for intrinsics. * resolve.c (gfc_resolve_iterator): Use `gfc_check_vardef_context'. (remove_last_array_ref): New method. (resolve_deallocate_expr), (resolve_allocate_expr): Ditto. (resolve_allocate_deallocate): Ditto (for STAT and ERRMSG). (resolve_assoc_var): Remove checks for definability here. (resolve_select_type): Handle resolving of code->block here. (resolve_ordinary_assign): Remove PURE check. (resolve_code): Do not resolve code->blocks for SELECT TYPE here. Use `gfc_check_vardef_context' for assignments and pointer-assignments. 2010-09-23 Daniel Kraft <d@domob.eu> PR fortran/38936 PR fortran/44044 PR fortran/45474 * gfortran.dg/intrinsic_intent_1.f03: New test. * gfortran.dg/select_type_17.f03: New test. * gfortran.dg/associate_5.f03: More definability tests. * gfortran.dg/enum_2.f90: Check definability. * gfortran.dg/allocatable_dummy_2.f90: Change expected error message. * gfortran.dg/allocate_alloc_opt_2.f90: Ditto. * gfortran.dg/char_expr_2.f90: Ditto. * gfortran.dg/deallocate_alloc_opt_2.f90: Ditto. * gfortran.dg/enum_5.f90: Ditto. * gfortran.dg/equiv_constraint_8.f90: Ditto. * gfortran.dg/impure_assignment_2.f90: Ditto. * gfortran.dg/impure_assignment_3.f90: Ditto. * gfortran.dg/intent_out_1.f90: Ditto. * gfortran.dg/intent_out_3.f90: Ditto. * gfortran.dg/pointer_assign_7.f90: Ditto. * gfortran.dg/pointer_intent_3.f90: Ditto. * gfortran.dg/pr19936_1.f90: Ditto. * gfortran.dg/proc_ptr_comp_3.f90: Ditto. * gfortran.dg/simpleif_2.f90: Ditto. * gfortran.dg/protected_5.f90: Ditto. * gfortran.dg/protected_4.f90: Ditto and remove invalid error check. * gfortran.dg/protected_6.f90: Ditto. * gfortran.dg/protected_7.f90: Ditto. From-SVN: r164550
2010-09-09re PR fortran/43665 (INTENT(IN) etc. optimization of calls: function ↵Tobias Burnus1-191/+175
annotations for noclobber/noescape arguments) 2010-09-09 Tobias Burnus <burnus@net-b.de> PR fortran/43665 * intrincic.texi (FGET, FGETC, FPUT, FPUTC, FSTAT, GETCWD, KILL, STAT): Show also syntax for the function version. * intrinsic.c (add_sym_1s_intent, add_sym_2s_intent, add_sym_3s_intent): Remove function. (add_sym_1s, add_sym_2s, add_sym_3s): Take always the intent as argument. (add_sym_2_intent): New function. (add_functions): Set intent for functions which modify the argument: fstat, fgetc, fget, hostnm, lstat, stat. Change argument name of hostnm from "a" to "c" (add_subroutines): Change add_sym_*s_intent to add_sym_*s and add intent to the add_sym_*s calls. From-SVN: r164052
2010-09-08re PR fortran/38282 (Bit intrinsics: ILEN and IBCHNG)Francois-Xavier Coudert1-6/+104
PR fortran/38282 * intrinsic.c (add_functions): Add B{G,L}{E,T}, DSHIFT{L,R}, MASK{L,R}, MERGE_BITS and SHIFT{A,L,R}. * gfortran.h: Define ISYM values for above intrinsics. * intrinsic.h (gfc_check_bge_bgt_ble_blt, gfc_check_dshift, gfc_check_mask, gfc_check_merge_bits, gfc_check_shift, gfc_simplify_bge, gfc_simplify_bgt, gfc_simplify_ble, gfc_simplify_blt, gfc_simplify_dshiftl, gfc_simplify_dshiftr, gfc_simplify_lshift, gfc_simplify_maskl, gfc_simplify_maskr, gfc_simplify_merge_bits, gfc_simplify_rshift, gfc_simplify_shifta, gfc_simplify_shiftl, gfc_simplify_shiftr, gfc_resolve_dshift, gfc_resolve_mask, gfc_resolve_merge_bits, gfc_resolve_shift): New prototypes. * iresolve.c (gfc_resolve_dshift, gfc_resolve_mask, gfc_resolve_merge_bits, gfc_resolve_shift): New functions. * check.c (gfc_check_bge_bgt_ble_blt, gfc_check_dshift, gfc_check_mask, gfc_check_merge_bits, gfc_check_shift): New functions. * trans-intrinsic.c (gfc_conv_intrinsic_dshift, gfc_conv_intrinsic_bitcomp, gfc_conv_intrinsic_shift, gfc_conv_intrinsic_merge_bits, gfc_conv_intrinsic_mask): New functions. (gfc_conv_intrinsic_function): Call above static functions. * intrinsic.texi: Document new intrinsics. * simplify.c (gfc_simplify_bge, gfc_simplify_bgt, gfc_simplify_ble, gfc_simplify_blt, gfc_simplify_dshiftl, gfc_simplify_dshiftr, gfc_simplify_lshift, gfc_simplify_maskl, gfc_simplify_maskr, gfc_simplify_merge_bits, gfc_simplify_rshift, gfc_simplify_shifta, gfc_simplify_shiftl, gfc_simplify_shiftr): New functions. * gfortran.dg/bit_comparison_1.F90: New test. * gfortran.dg/leadz_trailz_3.f90: New test. * gfortran.dg/masklr_2.F90: New test. * gfortran.dg/shiftalr_1.F90: New test. * gfortran.dg/merge_bits_2.F90: New test. * gfortran.dg/dshift_2.F90: New test. * gfortran.dg/bit_comparison_2.F90: New test. * gfortran.dg/masklr_1.F90: New test. * gfortran.dg/merge_bits_1.F90: New test. * gfortran.dg/dshift_1.F90: New test. * gfortran.dg/shiftalr_2.F90: New test. From-SVN: r164021
2010-09-06re PR fortran/38282 (Bit intrinsics: ILEN and IBCHNG)Tobias Burnus1-0/+24
2010-09-06 Tobias Burnus <burnus@net-b.de> PR fortran/38282 * intrinsic.c (add_functions): Support IALL, IANY, IPARITY. (check_specific): Special case for those intrinsics. * gfortran.h (gfc_isym_id): Add new intrinsics * intrinsic.h (gfc_check_transf_bit_intrins, gfc_simplify_iall, gfc_simplify_iany, gfc_simplify_iparity, gfc_resolve_iall, gfc_resolve_iany, gfc_resolve_iparity): New prototypes. * iresolve.c (gfc_resolve_iall, gfc_resolve_iany, gfc_resolve_iparity, resolve_transformational): New functions. (gfc_resolve_product, gfc_resolve_sum, gfc_resolve_parity): Use resolve_transformational. * check.c (gfc_check_transf_bit_intrins): New function. * simplify.c (gfc_simplify_iall, gfc_simplify_iany, gfc_simplify_iparity, do_bit_any, do_bit_ior, do_bit_xor, simplify_transformation): New functions. (gfc_simplify_all, gfc_simplify_any, gfc_simplify_parity, gfc_simplify_sum, gfc_simplify_product): Use simplify_transformation. * trans-intrinsic.c (gfc_conv_intrinsic_arith, gfc_conv_intrinsic_function, gfc_is_intrinsic_libcall): Handle IALL, IANY and IPARITY intrinsics. * intrinsic.texi (IMAGE_INDEX): Move up to fix alphabetic order. (IALL, IANY, IPARITY): Document new intrinsics. 2010-09-06 Tobias Burnus <burnus@net-b.de> PR fortran/38282 * gfortran.dg/iall_iany_iparity_1.f90: New. * gfortran.dg/iall_iany_iparity_2.f90: New. 2010-09-06 Tobias Burnus <burnus@net-b.de> PR fortran/38282 * gfortran.map: Add new iany, iall and iparity intrinsics. * Makefile.am: Ditto. * m4/iany.m4: New. * m4/iall.m4: New. * m4/iparity.m4: New. * Makefile.in: Regenerate. * generated/iall_i1.c: Generate. * generated/iall_i2.c: Generate. * generated/iall_i4.c: Generate. * generated/iall_i8.c: Generate. * generated/iall_i16.c: Generate. * generated/iany_i1.c: Generate. * generated/iany_i2.c: Generate. * generated/iany_i4.c: Generate. * generated/iany_i8.c: Generate. * generated/iany_i16.c: Generate. * generated/iparity_i1.c: Generate. * generated/iparity_i2.c: Generate. * generated/iparity_i4.c: Generate. * generated/iparity_i8.c: Generate. * generated/iparity_i16.c: Generate. From-SVN: r163898
2010-09-03re PR fortran/45159 (Unnecessary temporaries)Thomas Koenig1-0/+2
2010-09-03 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45159 * dependency.c (gfc_deb_compare_expr): Compare equal for equal arglists for pure user functions, or for those intrinsic functions which are also pure. * intrinsics.c (add_conv): Mark conversion functions as pure. (add_char_conversions): Likewise. 2010-09-03 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45159 * gfortran.dg/dependency_34.f90: New test. From-SVN: r163834
2010-09-01intrinsic.c: Add EXECUTE_COMMAND_LINE intrinsic.Francois-Xavier Coudert1-0/+9
* intrinsic.c: Add EXECUTE_COMMAND_LINE intrinsic. * intrinsic.h (gfc_resolve_execute_command_line): New function. * iresolve.c (gfc_resolve_execute_command_line): New function. * gfortran.h (GFC_ISYM_EXECUTE_COMMAND_LINE): New value. * intrinsic.texi: Document EXECUTE_COMMAND_LINE. * intrinsics/execute_command_line.c: New file. * gfortran.map (_gfortran_execute_command_line_i4, _gfortran_execute_command_line_i8): New symbols. * Makefile.am: Add new file intrinsics/execute_command_line.c. * Makefile.in: Regenerated. * gfortran.dg/execute_command_line_1.f90: New test. From-SVN: r163719
2010-08-31re PR fortran/38282 (Bit intrinsics: ILEN and IBCHNG)Francois-Xavier Coudert1-0/+14
PR fortran/38282 * f95-lang.c (gfc_init_builtin_functions): Define popcount{,l,ll} and parity{,l,ll} builtins. * trans-intrinsic.c (gfc_conv_intrinsic_popcnt_poppar): New function. (gfc_conv_intrinsic_function): Call above new functions. * simplify.c (gfc_simplify_popcnt, gfc_simplify_poppar): New functions. * intrinsic.texi: Document POPCNT and POPPAR. * gfortran.dg/popcnt_poppar_1.F90: New test. * gfortran.dg/popcnt_poppar_2.F90: New test. From-SVN: r163691
2010-08-27re PR fortran/33197 (Fortran 2008: math functions)Tobias Burnus1-0/+15
gcc/fortran/ 2010-08-27 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * gcc/fortran/intrinsic.c (add_functions): Add norm2 and parity. * gcc/fortran/intrinsic.h (gfc_check_norm2, gfc_check_parity): gfc_simplify_norm2, gfc_simplify_parity, gfc_resolve_norm2, gfc_resolve_parity): New prototypes. * gcc/fortran/gfortran.h (gfc_isym_id): New enum items GFC_ISYM_NORM2 and GFC_ISYM_PARITY. * gcc/fortran/iresolve.c (gfc_resolve_norm2, gfc_resolve_parity): New functions. * gcc/fortran/check.c (gfc_check_norm2, gfc_check_parity): New functions. * gcc/fortran/trans-intrinsic.c (gfc_conv_intrinsic_arith, gfc_conv_intrinsic_function): Handle NORM2 and PARITY. * gcc/fortran/intrinsic.texi (NORM2, PARITY): Add. * gcc/fortran/simplify.c (simplify_transformation_to_array): Add post-processing opterator. (gfc_simplify_all, gfc_simplify_any, gfc_simplify_count, gfc_simplify_product, gfc_simplify_sum): Update call. (add_squared, do_sqrt, gfc_simplify_norm2, do_xor, gfc_simplify_parity): New functions. gcc/testsuite/ 2010-08-27 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * gcc/testsuite/gfortran.dg/norm2_1.f90: New. * gcc/testsuite/gfortran.dg/norm2_2.f90: New. * gcc/testsuite/gfortran.dg/norm2_3.f90: New. * gcc/testsuite/gfortran.dg/norm2_4.f90: New. * gcc/testsuite/gfortran.dg/parity_1.f90: New. * gcc/testsuite/gfortran.dg/parity_2.f90: New. * gcc/testsuite/gfortran.dg/parity_3.f90: New. libgfortran/ 2010-08-27 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * libgfortran/m4/ifunction.m4 (FINISH_ARRAY_FUNCTION, ARRAY_FUNCTION): Allow expression after loop. * libgfortran/m4/norm2.m4: New for _gfortran_norm2_r{4,8,10,16}. * libgfortran/m4/parity.m4: New for * _gfortran_parity_l{1,2,4,8,16}. * libgfortran/gfortran.map: Add new functions. * libgfortran/Makefile.am: Ditto. * libgfortran/m4/minloc1.m4: Add empty argument for * ARRAY_FUNCTION. * libgfortran/m4/maxloc1.m4: Ditto. * libgfortran/m4/all.m4: Ditto. * libgfortran/m4/minval.m4: Ditto. * libgfortran/m4/maxval.m4: Ditto. * libgfortran/m4/count.m4: Ditto. * libgfortran/m4/product.m4: Ditto. * libgfortran/m4/any.m4: Ditto. * Makefile.in: Regenerated. * generated/minval_r8.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/minloc1_16_r16.c: Regenerated. * generated/norm2_r4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/parity_l2.c: Regenerated. * generated/any_l16.c: Regenerated. * generated/maxval_i2.c: Regenerated. * generated/any_l2.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/parity_l16.c: Regenerated. * generated/all_l1.c: Regenerated. * generated/product_i2.c: Regenerated. * generated/minloc1_8_r16.c: Regenerated. * generated/maxloc1_8_r16.c: Regenerated. * generated/sum_r16.c: Regenerated. * generated/sum_i1.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/maxloc1_16_r16.c: Regenerated. * generated/minloc1_16_i4.c: Regenerated. * generated/maxloc1_16_i4.c: Regenerated. * generated/maxval_r16.c: Regenerated. * generated/product_c10.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/all_l2.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/all_l16.c: Regenerated. * generated/minloc1_16_r10.c: Regenerated. * generated/sum_i2.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/minval_i16.c: Regenerated. * generated/parity_l4.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/minloc1_4_i16.c: Regenerated. * generated/maxloc1_4_i16.c: Regenerated. * generated/minloc1_8_r10.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/maxloc1_8_r10.c: Regenerated. * generated/sum_c16.c: Regenerated. * generated/minloc1_16_r8.c: Regenerated. * generated/maxloc1_16_r8.c: Regenerated. * generated/count_4_l.c: Regenerated. * generated/sum_r10.c: Regenerated. * generated/count_8_l.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/maxloc1_16_r10.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/maxval_r10.c: Regenerated. * generated/minval_i1.c: Regenerated. * generated/maxloc1_4_i1.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/product_i16.c: Regenerated. * generated/all_l4.c: Regenerated. * generated/norm2_r16.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/norm2_r8.c: Regenerated. * generated/minloc1_4_i1.c: Regenerated. * generated/minval_r16.c: Regenerated. * generated/minval_i2.c: Regenerated. * generated/maxloc1_4_i2.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/sum_c10.c: Regenerated. * generated/minloc1_4_r16.c: Regenerated. * generated/maxloc1_4_r16.c: Regenerated. * generated/count_1_l.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_16_i8.c: Regenerated. * generated/maxloc1_16_i8.c: Regenerated. * generated/minloc1_4_i2.c: Regenerated. * generated/maxloc1_8_i1.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/product_r16.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/sum_r8.c: Regenerated. * generated/norm2_r10.c: Regenerated. * generated/minloc1_16_i16.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/minloc1_16_i1.c: Regenerated. * generated/maxloc1_16_i1.c: Regenerated. * generated/minval_r10.c: Regenerated. * generated/count_16_l.c: Regenerated. * generated/parity_l8.c: Regenerated. * generated/minloc1_8_i1.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_8_i2.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/minloc1_4_r10.c: Regenerated. * generated/minloc1_8_i16.c: Regenerated. * generated/maxloc1_4_r10.c: Regenerated. * generated/maxloc1_8_i16.c: Regenerated. * generated/minloc1_16_r4.c: Regenerated. * generated/maxloc1_16_r4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/sum_i16.c: Regenerated. * generated/count_2_l.c: Regenerated. * generated/maxloc1_16_i16.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/minloc1_16_i2.c: Regenerated. * generated/maxloc1_16_i2.c: Regenerated. * generated/parity_l1.c: Regenerated. * generated/maxval_i16.c: Regenerated. * generated/maxval_i1.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/any_l1.c: Regenerated. * generated/minloc1_8_i2.c: Regenerated. * generated/product_c16.c: Regenerated. * generated/product_r10.c: Regenerated. * generated/product_i1.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/maxval_r4.c: Regenerated. From-SVN: r163595
2010-08-21re PR fortran/36158 (Transformational function BESSEL_YN(n1,n2,x) and ↵Tobias Burnus1-2/+29
BESSEL_JN missing) 2010-08-21 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * intrinsic.c (add_sym): Init value attribute. (set_attr_value): New function. (add_functions) Use it and add JN/YN resolvers. * symbol.c (gfc_copy_formal_args_intr): Copy value attr. * intrinsic.h (gfc_resolve_bessel_n2): New prototype. * gfortran.h (gfc_intrinsic_arg): Add value attribute. * iresolve.c (gfc_resolve_bessel_n2): New function. * trans-intrinsic.c (gfc_get_symbol_for_expr): Create formal arg list. (gfc_conv_intrinsic_function,gfc_is_intrinsic_libcall): Add GFC_ISYM_JN2/GFC_ISYM_YN2 as case value. * simplify.c (): For YN set to -INF if previous values was -INF. * trans-expr.c (gfc_conv_procedure_call): Don't crash if sym->as is NULL. * iresolve.c (gfc_resolve_extends_type_of): Set the type of the dummy argument to the one of the actual. 2010-08-21 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * m4/bessel.m4: Implement bessel_jn and bessel_yn. * gfortran.map: Add the generated bessel_jn_r{4,8,10,16} and bessel_yn_r{4,8,10,16}. * Makefile.am: Add bessel.m4. * Makefile.in: Regenerated. * generated/bessel_r4.c: Generated. * generated/bessel_r16.c: Generated. * generated/bessel_r8.c: Generated. * generated/bessel_r10.c: Generated. 2010-08-21 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * gfortran.dg/bessel_6.f90: New. * gfortran.dg/bessel_7.f90: New. From-SVN: r163440
2010-08-19re PR fortran/36158 (Transformational function BESSEL_YN(n1,n2,x) and ↵Tobias Burnus1-0/+10
BESSEL_JN missing) 2010-08-19 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * check.c (gfc_check_bessel_n2): New function. * gfortran.h (gfc_isym_id): Add GFC_ISYM_JN2 and GFC_ISYM_YN2. * intrinsic.c (add_functions): Add transformational version of the Bessel_jn/yn intrinsics. * intrinsic.h (gfc_check_bessel_n2,gfc_simplify_bessel_jn2, gfc_simplify_bessel_yn2): New prototypes. * intrinsic.texi (Bessel_jn, Bessel_yn): Document transformational variant. * simplify.c (gfc_simplify_bessel_jn, gfc_simplify_bessel_yn): Check for negative order. (gfc_simplify_bessel_n2,gfc_simplify_bessel_jn2, gfc_simplify_bessel_yn2): New functions. 2010-08-19 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * gfortran.dg/bessel_3.f90: New. * gfortran.dg/bessel_4.f90: New. * gfortran.dg/bessel_5.f90: New. From-SVN: r163364
2010-08-15re PR fortran/45197 ([F2008] Allow IMPURE elemental procedures)Daniel Kraft1-168/+177
2010-08-15 Daniel Kraft <d@domob.eu> PR fortran/45197 * decl.c (gfc_match_prefix): Match IMPURE prefix and mark ELEMENTAL routines not IMPURE also as PURE. * intrinsic.c (enum klass): New class `CLASS_PURE' and renamed `NO_CLASS' in `CLASS_IMPURE'. (add_sym): Set symbol-attributes `pure' and `elemental' correctly. (add_sym_0s): Renamed `NO_CLASS' in `CLASS_IMPURE'. (add_functions): Ditto. (add_subroutines): Ditto and mark `MOVE_ALLOC' as CLASS_PURE. * resolve.c (gfc_pure): Do not treat ELEMENTAL as automatically PURE. (resolve_formal_arglist): Check that arguments to ELEMENTAL procedures are not ALLOCATABLE and have their INTENT specified. 2010-08-15 Daniel Kraft <d@domob.eu> PR fortran/45197 * gfortran.dg/elemental_args_check_3.f90: New test. * gfortran.dg/impure_1.f08: New test. * gfortran.dg/impure_2.f08: New test. * gfortran.dg/impure_3.f90: New test. * gfortran.dg/typebound_proc_6.f03: Changed expected error message. From-SVN: r163261
2010-08-11re PR fortran/44595 (INTENT of arguments to intrinsic procedures not checked)Janus Weil1-5/+5
2010-08-11 Janus Weil <janus@gcc.gnu.org> PR fortran/44595 * intrinsic.c (gfc_current_intrinsic_arg): Change type from 'char' to 'gfc_intrinsic_arg'. (check_arglist,check_specific): Add reference to 'name' field. (init_arglist): Remove reference to 'name' field. * intrinsic.h (gfc_current_intrinsic_arg): Modify prototype. * check.c (variable_check): Reverse order of checks. Respect intent of formal arg. (int_or_proc_check): New function. (coarray_check): New function. (allocatable_check): New function. (gfc_check_allocated,gfc_check_move_alloc): Use 'allocatable_check'. (gfc_check_complex): Use 'int_or_real_check'. (gfc_check_lcobound,gfc_check_image_index,gfc_check_this_image, gfc_check_ucobound): Use 'coarray_check'. (gfc_check_pack): Use 'real_or_complex_check'. (gfc_check_alarm_sub,gfc_check_signal,gfc_check_signal_sub): Use 'int_or_proc_check'. (scalar_check,type_check,numeric_check,int_or_real_check, real_or_complex_check,kind_check,double_check,logical_array_check, array_check,same_type_check,rank_check,nonoptional_check, kind_value_check,gfc_check_a_p,gfc_check_associated,gfc_check_cmplx, gfc_check_cshift,gfc_check_dcmplx,gfc_check_dot_product,gfc_check_dprod, gfc_check_eoshift,gfc_check_fn_rc2008,gfc_check_index,gfc_check_kind, gfc_check_matmul,gfc_check_minloc_maxloc,check_reduction,gfc_check_null, gfc_check_present,gfc_check_reshape,gfc_check_same_type_as, gfc_check_spread,gfc_check_unpack,gfc_check_random_seed, gfc_check_getarg,gfc_check_and,gfc_check_storage_size): Add reference to 'name' field. 2010-08-11 Janus Weil <janus@gcc.gnu.org> Steve Kargl <kargl@gcc.gnu.org> PR fortran/44595 * gfortran.dg/move_alloc_3.f90: New. * gfortran.dg/random_seed_2.f90: New. Co-Authored-By: Steve Kargl <kargl@gcc.gnu.org> From-SVN: r163096
2010-08-02re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal ↵Mikael Morin1-0/+2
argument) 2010-08-02 Mikael Morin <mikael@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/42051 PR fortran/44064 PR fortran/45151 * intrinsic.c (gfc_get_intrinsic_sub_symbol): Commit changed symbol. * symbol.c (gen_cptr_param, gen_fptr_param, gen_shape_param, gfc_copy_formal_args, gfc_copy_formal_args_intr, gfc_copy_formal_args_ppc, generate_isocbinding_symbol): Ditto. * parse.c (parse_derived_contains, parse_spec, parse_progunit): Call reject_statement in case of error. (match_deferred_characteritics): Call gfc_undo_symbols in case match fails. Co-Authored-By: Janus Weil <janus@gcc.gnu.org> From-SVN: r162821
2010-07-08re PR fortran/44649 ([OOP] F2008: storage_size intrinsic (also working for ↵Janus Weil1-1/+10
polymorphic types)) 2010-07-08 Janus Weil <janus@gcc.gnu.org> PR fortran/44649 * gfortran.h (gfc_isym_id): Add GFC_ISYM_C_SIZEOF,GFC_ISYM_STORAGE_SIZE. * intrinsic.h (gfc_check_c_sizeof,gfc_check_storage_size, gfc_resolve_storage_size): New prototypes. * check.c (gfc_check_c_sizeof,gfc_check_storage_size): New functions. * intrinsic.c (add_functions): Add STORAGE_SIZE. * iresolve.c (gfc_resolve_storage_size): New function. * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Handle polymorphic arguments. (gfc_conv_intrinsic_storage_size): New function. (gfc_conv_intrinsic_function): Handle STORAGE_SIZE. 2010-07-08 Janus Weil <janus@gcc.gnu.org> PR fortran/44649 * gfortran.dg/c_sizeof_1.f90: Modified. * gfortran.dg/storage_size_1.f08: New. * gfortran.dg/storage_size_2.f08: New. From-SVN: r161977
2010-06-25intrinsic.h (gfc_check_selected_real_kind, [...]): Update prototypes.Tobias Burnus1-2/+3
2010-06-25 Tobias Burnus <burnus@net-b.de> * intrinsic.h (gfc_check_selected_real_kind, gfc_simplify_selected_real_kind): Update prototypes. * intrinsic.c (add_functions): Add radix support to selected_real_kind. * check.c (gfc_check_selected_real_kind): Ditto. * simplify.c (gfc_simplify_selected_real_kind): Ditto. * trans-decl.c (gfc_build_intrinsic_function_decls): Change call from selected_real_kind to selected_real_kind2008. * intrinsic.texi (SELECTED_REAL_KIND): Update for radix. (PRECISION, RANGE, RADIX): Add cross @refs. 2010-06-25 Tobias Burnus <burnus@net-b.de> * intrinsics/selected_real_kind.f90 (_gfortran_selected_real_kind2008): Add function. (_gfortran_selected_real_kind): Stub which calls _gfortran_selected_real_kind2008. * gfortran.map (GFORTRAN_1.4): Add _gfortran_selected_real_kind2008. * mk-srk-inc.sh: Save also RADIX. 2010-06-25 Tobias Burnus <burnus@net-b.de> * selected_real_kind_2.f90: New. * selected_real_kind_3.f90: New. From-SVN: r161411
2010-06-09re PR fortran/44359 (-Wall / -Wconversion: Too verbose warning for DATA BOZ ↵Daniel Franke1-52/+61
conversions) gcc/fortran/: 2010-06-09 Daniel Franke <franke.daniel@gmail.com> PR fortran/44359 * intrinsic.c (gfc_convert_type_warn): Further improve -Wconversion. gcc/testsuite/: 2010-06-09 Daniel Franke <franke.daniel@gmail.com> PR fortran/44359 * gfortran.dg/warn_conversion.f90: Removed check for redundant warning. * gfortran.dg/warn_conversion_2.f90: Use non-constant expression to check for warning. From-SVN: r160505
2010-06-09mvbits_9.f90: New test.Steven G. Kargl1-3/+3
2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org> * testsuite/gfortran.dg/mvbits_9.f90: New test. * testsuite/gfortran.dg/ibset_1.f90: Ditto. * testsuite/gfortran.dg/ibits_1.f90: Ditto. * testsuite/gfortran.dg/btest_1.f90: Ditto. * testsuite/gfortran.dg/ibclr_1.f90: Ditto. 2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org> * fortran/intrinsic.c (add_functions): Change gfc_check_btest, gfc_check_ibclr, and gfc_check_ibset to gfc_check_bitfcn. * fortran/intrinsic.h: Remove prototypes for gfc_check_btest, gfc_check_ibclr, and gfc_check_ibset. Add prototype for gfc_check_bitfcn. * fortran/check.c (nonnegative_check, less_than_bitsize1, less_than_bitsize2): New functions. (gfc_check_btest): Renamed to gfc_check_bitfcn. Use nonnegative_check and less_than_bitsize1. (gfc_check_ibclr, gfc_check_ibset): Removed. (gfc_check_ibits,gfc_check_mvbits): Use nonnegative_check and less_than_bitsize1. From-SVN: r160492
2010-05-19re PR fortran/44055 (Warn (-Wconversion*) when converting single to double ↵Daniel Franke1-12/+35
precision) gcc/fortran/: 2010-05-19 Daniel Franke <franke.daniel@gmail.com> PR fortran/44055 * lang.opt (Wconversion-extra): New option. * gfortran.h (gfc_option_t): Add warn_conversion_extra. * options.c (gfc_init_options): Disable -Wconversion-extra by default. (set_Wall): Enable -Wconversion. (gfc_handle_option): Set warn_conversion_extra. * intrinsic.c (gfc_convert_type_warn): Ignore kind conditions introduced for -Wconversion if -Wconversion-extra is present. * invoke.texi: Add -Wconversion to -Wall; document new behaviour of -Wconversion; document -Wconversion-extra. gcc/testsuite/: 2010-05-19 Daniel Franke <franke.daniel@gmail.com> PR fortran/44055 * gfortran.dg/c_sizeof_2.f90: Add -Wno-conversion to dg-options; Fixed scope of C_SIZEOF. * gfortran.dg/warn_conversion_2.f90: New. From-SVN: r159586
2010-05-19re PR fortran/34505 (FLOAT/SNGL: Not accepted as actual argument; ↵Daniel Franke1-4/+6
diagnostics problems) gcc/fortran/: 2010-05-19 Daniel Franke <franke.daniel@gmail.com> PR fortran/34505 * intrinsic.h (gfc_check_float): New prototype. (gfc_check_sngl): New prototype. * check.c (gfc_check_float): New. (gfc_check_sngl): New. * intrinsic.c (add_functions): Moved DFLOAT from aliasing DBLE to be a specific for REAL. Added check routines for FLOAT, DFLOAT and SNGL. * intrinsic.texi: Removed individual nodes of FLOAT, DFLOAT and SNGL, added them to the list of specifics of REAL instead. gcc/testsuite/: 2010-05-19 Daniel Franke <franke.daniel@gmail.com> PR fortran/34505 * gfortran.dg/dfloat_1.f90: Add warnings for non-default kind arguments; add check for return value kind. * gfortran.dg/float_1.f90: Likewise. From-SVN: r159558
2010-05-13re PR fortran/35779 (error pointer wrong in PARAMETER)Daniel Franke1-3/+3
gcc/fortran/: 2010-05-13 Daniel Franke <franke.daniel@gmail.com> PR fortran/35779 * intrinsic.c (gfc_init_expr): Renamed to gfc_init_expr_flag. Updated all usages. * expr.c (init_flag): Removed; use gfc_init_expr_flag everywhere. * array.c (match_array_list): Pass on gfc_init_expr_flag when matching iterators. gcc/testsuite/: 2010-05-13 Daniel Franke <franke.daniel@gmail.com> PR fortran/35779 * gfortran.dg/initialization_25.f90: New. From-SVN: r159366
2010-05-10re PR fortran/27866 (Warn when casting, e.g. assigning a double precision to ↵Daniel Franke1-2/+34
a real) gcc/fortran/: 2010-05-10 Daniel Franke <franke.daniel@gmail.com> PR fortran/27866 PR fortran/35003 PR fortran/42809 * intrinsic.c (gfc_convert_type_warn): Be more discriminative about conversion warnings. gcc/testsuite/: 2010-05-08 Daniel Franke <franke.daniel@gmail.com> PR fortran/27866 PR fortran/35003 PR fortran/42809 * gfortran.dg/array_constructor_type_17.f03: Updated match string. * gfortran.dg/warn_conversion.f90: New. From-SVN: r159238
2010-05-07re PR fortran/40728 (Bogus error "Error: Can't convert UNKNOWN to REAL(8) at ↵Daniel Franke1-11/+8
(1)") gcc/fortran/: 2010-05-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/40728 * intrinc.c (gfc_is_intrinsic): Do not prematurely mark symbol as external gcc/testsuite/: 2010-05-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/40728 * gfortran.dg/coarray_1.f90: Fixed error message. * gfortran.dg/selected_char_kind_3.f90: Fixed error message. * gfortran.dg/intrinsic_std_1.f90: Fixed bogus message. * gfortran.dg/intrinsic_std_5.f90: New. From-SVN: r159155
2010-05-02re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-8/+8
2010-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * intrinsic.c (add_functions): Fix GFC_STD and add gfc_resolve_* calls for lcobound, ucobound, image_index and this_image. * intrinsic.h (gfc_resolve_lcobound, gfc_resolve_this_image, gfc_resolve_image_index, gfc_resolve_ucobound): New prototypes. * iresolve.c (gfc_resolve_lcobound, gfc_resolve_this_image, gfc_resolve_image_index, gfc_resolve_ucobound, resolve_bound): New functions. (gfc_resolve_lbound, gfc_resolve_ubound): Use resolve_bound. From-SVN: r158974
2010-04-20intrinsic.c (sort_actual): Remove 'is' in error message.Harald Anlauf1-1/+1
2010-04-20 Harald Anlauf <anlauf@gmx.de> * intrinsic.c (sort_actual): Remove 'is' in error message. From-SVN: r158577
2010-04-14re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-1/+26
2010-04-14 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * array.c (gfc_find_array_ref): Handle codimensions. (gfc_match_array_spec,gfc_match_array_ref): Use gfc_fatal_error. * check.c (is_coarray, dim_corank_check, gfc_check_lcobound, gfc_check_image_index, gfc_check_this_image, gfc_check_ucobound): New functions. * gfortran.h (gfc_isym_id): Add GFC_ISYM_IMAGE_INDEX, GFC_ISYM_LCOBOUND, GFC_ISYM_THIS_IMAGE, GFC_ISYM_UCOBOUND. * intrinsic.h (add_functions): Add this_image, image_index, lcobound and ucobound intrinsics. * intrinsic.c (gfc_check_lcobound,gfc_check_ucobound, gfc_check_image_index, gfc_check_this_image, gfc_simplify_image_index, gfc_simplify_lcobound, gfc_simplify_this_image, gfc_simplify_ucobound): New function prototypes. * intrinsic.texi (IMAGE_INDEX, LCOBOUND, THIS_IMAGE IMAGE_INDEX): Document new intrinsic functions. * match.c (gfc_match_critical, sync_statement): Make * -fcoarray=none error fatal. * simplify.c (simplify_bound_dim): Handle coarrays. (simplify_bound): Update simplify_bound_dim call. (gfc_simplify_num_images): Add -fcoarray=none check. (simplify_cobound, gfc_simplify_lcobound, gfc_simplify_ucobound, gfc_simplify_ucobound, gfc_simplify_ucobound): New functions. 2010-04-14 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * gfortran.dg/coarray_9.f90: Update dg-errors. * gfortran.dg/coarray_10.f90: New test. * gfortran.dg/coarray_11.f90: New test. From-SVN: r158292
2010-04-06re PR fortran/39997 (Procedure(), pointer & implicit typing: rejects-valid ↵Tobias Burnus1-0/+3
/ accepts-invalid?) 2010-04-06 Tobias Burnus <burnus@net-b.de> PR fortran/39997 * intrinsic.c (add_functions): Add num_images. * decl.c (gfc_match_end): Handle END CRITICAL. * intrinsic.h (gfc_simplify_num_images): Add prototype. * dump-parse-tree.c (show_code_node): Dump CRITICAL, ERROR STOP, and SYNC. * gfortran.h (gfc_statement): Add enum items for those. (gfc_exec_op) Ditto. (gfc_isym_id): Add num_images. * trans-stmt.c (gfc_trans_stop): Handle ERROR STOP. (gfc_trans_sync,gfc_trans_critical): New functions. * trans-stmt.h (gfc_trans_stop,gfc_trans_sync, gfc_trans_critical): Add/update prototypes. * trans.c (gfc_trans_code): Handle CRITICAL, ERROR STOP, and SYNC statements. * trans.h (gfor_fndecl_error_stop_string) Add variable. * resolve.c (resolve_sync): Add function. (gfc_resolve_blocks): Handle CRITICAL. (resolve_code): Handle CRITICAL, ERROR STOP, (resolve_branch): Add CRITICAL constraint check. and SYNC statements. * st.c (gfc_free_statement): Add new statements. * trans-decl.c (gfor_fndecl_error_stop_string): Global variable. (gfc_build_builtin_function_decls): Initialize it. * match.c (gfc_match_if): Handle ERROR STOP and SYNC. (gfc_match_critical, gfc_match_error_stop, sync_statement, gfc_match_sync_all, gfc_match_sync_images, gfc_match_sync_memory): New functions. (match_exit_cycle): Handle CRITICAL constraint. (gfc_match_stopcode): Handle ERROR STOP. * match.h (gfc_match_critical, gfc_match_error_stop, gfc_match_sync_all, gfc_match_sync_images, gfc_match_sync_memory): Add prototype. * parse.c (decode_statement, gfc_ascii_statement, parse_executable): Handle new statements. (parse_critical_block): New function. * parse.h (gfc_compile_state): Add COMP_CRITICAL. * intrinsic.texi (num_images): Document new function. * simplify.c (gfc_simplify_num_images): Add function. 2010-04-06 Tobias Burnus <burnus@net-b.de> PR fortran/39997 * gfortran.dg/coarray_1.f90: New test. * gfortran.dg/coarray_2.f90: New test. * gfortran.dg/coarray_3.f90: New test. 2010-04-06 Tobias Burnus <burnus@net-b.de> PR fortran/39997 * runtime/stop.c (error_stop_string): New function. * gfortran.map (_gfortran_error_stop_string): Add. From-SVN: r158008
2010-04-01ioparm.def: Update copyright.Paul Thomas1-1/+2
2010-04-01 Paul Thomas <pault@gcc.gnu.org> * ioparm.def : Update copyright. * lang.opt : ditto * trans-array.c : ditto * trans-array.h : ditto * expr.c: ditto * trans-types.c: ditto * dependency.c : ditto * gfortran.h : ditto * options.c : ditto * trans-io.c : ditto * trans-intrinsic.c : ditto * libgfortran.h : ditto * invoke.texi : ditto * intrinsic.texi : ditto * trans.c : ditto * trans.h : ditto * intrinsic.c : ditto * interface.c : ditto * iresolve.c : ditto * trans-stmt.c : ditto * trans-stmt.h : ditto * parse,c : ditto * match.h : ditto * error.c : ditto From-SVN: r157923
2010-02-16re PR fortran/43040 (Wrong decl for mathbuiltins -> wrong code with LTO)Tobias Burnus1-3/+3
2010-02-16 Tobias Burnus <burnus@net-b.de> PR fortran/43040 * gfortran.h (gfc_isym_id): Rename GFS_ISYM_GAMMA to * GFS_ISYM_TGAMMA. * intrinsic.c (add_functions): Ditto. * iresolve.c (gfc_resolve_gamma): Call tgamma instead of gamma. * mathbuiltins.def: Use TGAMMA instead of GAMMA with "tgamma". From-SVN: r156796
2009-11-30backport: re PR fortran/42053 ([OOP] SELECT TYPE: reject duplicate CLASS IS ↵Janus Weil1-1/+1
blocks) merge from fortran-dev branch: gcc/fortran/ 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/42053 * resolve.c (resolve_select_type): Check for duplicate CLASS IS blocks. 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/41631 * decl.c (gfc_match_derived_decl): Set extension level. * gfortran.h (symbol_attribute): Expand 'extension' bit field to 8 bit. * iresolve.c (gfc_resolve_extends_type_of): Return value of 'is_extension_of' has kind=4. * match.c (select_type_set_tmp,gfc_match_class_is): Create temporary for CLASS IS blocks. * module.c (MOD_VERSION): Bump module version. (ab_attribute,attr_bits): Remove AB_EXTENSION. (mio_symbol_attribute): Handle expanded 'extension' field. * resolve.c (resolve_select_type): Implement CLASS IS blocks. (resolve_fl_variable_derived): Show correct type name. * symbol.c (gfc_build_class_symbol): Set extension level. 2009-11-30 Janus Weil <janus@gcc.gnu.org> * intrinsic.h (gfc_resolve_extends_type_of): Add prototype. * intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'. * iresolve.c (gfc_resolve_extends_type_of): New function, which replaces the call to EXTENDS_TYPE_OF by the library function 'is_extension_of' and modifies the arguments. * trans-intrinsic.c (gfc_conv_extends_type_of): Removed. (gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall. 2009-11-30 Paul Thomas <pault@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> * decl.c (encapsulate_class_symbol): Replaced by 'gfc_build_class_symbol'. (build_sym,build_struct): Call 'gfc_build_class_symbol'. (gfc_match_derived_decl): Replace vindex by hash_value. * dump-parse-tree.c (show_symbol): Replace vindex by hash_value. * gfortran.h (symbol_attribute): Add field 'vtab'. (gfc_symbol): Replace vindex by hash_value. (gfc_class_esym_list): Ditto. (gfc_get_derived_type,gfc_build_class_symbol,gfc_find_derived_vtab): New prototypes. * module.c (mio_symbol): Replace vindex by hash_value. * resolve.c (vindex_expr): Rename to 'hash_value_expr'. (resolve_class_compcall,resolve_class_typebound_call): Renamed 'vindex_expr'. (resolve_select_type): Replace $vindex by $vptr->$hash. * symbol.c (gfc_add_save): Handle vtab symbols. (gfc_type_compatible): Rewrite. (gfc_build_class_symbol): New function which replaces 'encapsulate_class_symbol'. (gfc_find_derived_vtab): New function to set up a vtab symbol for a derived type. * trans-decl.c (gfc_create_module_variable): Handle vtab symbols. * trans-expr.c (select_class_proc): Replace vindex by hash_value. (gfc_conv_derived_to_class): New function to construct a temporary CLASS variable from a derived type expression. (gfc_conv_procedure_call): Call 'gfc_conv_derived_to_class'. (gfc_conv_structure): Initialize the $extends and $size fields of vtab symbols. (gfc_trans_class_assign): Replace $vindex by $vptr. Remove the $size assignment. * trans-intrinsic.c (gfc_conv_same_type_as): Replace $vindex by $vptr->$hash, and replace vindex by hash_value. * trans-stmt.c (gfc_trans_allocate): Insert $vptr references, replace $vindex by $vptr. Remove the $size assignment. * trans-types.c (gfc_get_derived_type): Make it non-static. gcc/testsuite/ 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/42053 * gfortran.dg/select_type_9.f03: New. 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/41631 * gfortran.dg/extends_type_of_1.f03: Fix invalid test case. * gfortran.dg/module_md5_1.f90: Adjusted MD5 sum. * gfortran.dg/select_type_1.f03: Remove FIXMEs. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/select_type_8.f03: New test. 2009-11-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/extends_type_of_1.f03: New test. * gfortran.dg/same_type_as_1.f03: Extended. 2009-11-30 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/class_4c.f03: Add dg-additional-sources. * gfortran.dg/class_4d.f03: Rename module. Cleanup modules. libgfortran/ 2009-11-30 Janus Weil <janus@gcc.gnu.org> * gfortran.map: Add _gfortran_is_extension_of. * Makefile.am: Add intrinsics/extends_type_of.c. * Makefile.in: Regenerated. * intrinsics/extends_type_of.c: New file. From-SVN: r154840
2009-11-28trans-common.c (create_common): Remove unused offset variable.Jakub Jelinek1-2/+0
* trans-common.c (create_common): Remove unused offset variable. * io.c (gfc_match_wait): Remove unused loc variable. * trans-openmp.c (gfc_trans_omp_clauses): Remove unused old_clauses variable. (gfc_trans_omp_do): Remove unused outermost variable. * iresolve.c (gfc_resolve_alarm_sub, gfc_resolve_fseek_sub): Remove unused status variable. * module.c (number_use_names): Remove unused c variable. (load_derived_extensions): Remove unused nuse variable. * trans-expr.c (gfc_conv_substring): Remove unused var variable. * trans-types.c (gfc_get_array_descr_info): Remove unused offset_off variable. * matchexp.c (match_primary): Remove unused where variable. * trans-intrinsic.c (gfc_conv_intrinsic_bound): Remove unused cond2 variable. (gfc_conv_intrinsic_sizeof): Remove unused source variable. (gfc_conv_intrinsic_transfer): Remove unused stride variable. (gfc_conv_intrinsic_function): Remove unused isym variable. * arith.c (gfc_hollerith2real, gfc_hollerith2complex, gfc_hollerith2logical): Remove unused len variable. * parse.c (parse_derived): Remove unused derived_sym variable. * decl.c (variable_decl): Remove unused old_locus variable. * resolve.c (check_class_members): Remove unused tbp_sym variable. (resolve_ordinary_assign): Remove unused assign_proc variable. (resolve_equivalence): Remove unused value_name variable. * data.c (get_array_index): Remove unused re variable. * trans-array.c (gfc_conv_array_transpose): Remove unused src_info variable. (gfc_conv_resolve_dependencies): Remove unused aref and temp_dim variables. (gfc_conv_loop_setup): Remove unused dim and len variables. (gfc_walk_variable_expr): Remove unused head variable. * match.c (match_typebound_call): Remove unused var variable. * intrinsic.c (gfc_convert_chartype): Remove unused from_ts variable. From-SVN: r154722
2009-09-30re PR fortran/40996 ([F03] ALLOCATABLE scalars)Tobias Burnus1-0/+12
fortran/ 2009-09-30 Janus Weil <janus@gcc.gnu.org> * check.c (gfc_check_same_type_as): New function for checking SAME_TYPE_AS and EXTENDS_TYPE_OF. * decl.c (encapsulate_class_symbol): Set ABSTRACT attribute for class container, if the contained type has it. Add an initializer for the class container. (add_init_expr_to_sym): Handle BT_CLASS. (vindex_counter): New counter for setting vindices. (gfc_match_derived_decl): Set vindex for all derived types, not only those which are being extended. * expr.c (gfc_check_assign_symbol): Handle NULL initialization of class pointers. * gfortran.h (gfc_isym_id): New values GFC_ISYM_SAME_TYPE_AS and GFC_ISYM_EXTENDS_TYPE_OF. (gfc_type_is_extensible): New prototype. * intrinsic.h (gfc_check_same_type_as): New prototype. * intrinsic.c (add_functions): Add SAME_TYPE_AS and EXTENDS_TYPE_OF. * primary.c (gfc_expr_attr): Handle CLASS-valued functions. * resolve.c (resolve_structure_cons): Handle BT_CLASS. (type_is_extensible): Make non-static and rename to 'gfc_type_is_extensible. (resolve_select_type): Renamed type_is_extensible. (resolve_class_assign): Handle NULL pointers. (resolve_fl_variable_derived): Renamed type_is_extensible. (resolve_fl_derived): Ditto. * trans-expr.c (gfc_trans_subcomponent_assign): Handle NULL initialization of class pointer components. (gfc_conv_structure): Handle BT_CLASS. * trans-intrinsic.c (gfc_conv_same_type_as,gfc_conv_extends_type_of): New functions. (gfc_conv_intrinsic_function): Handle SAME_TYPE_AS and EXTENDS_TYPE_OF. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.h (type_selector, select_type_tmp): New global variables. * match.c (type_selector, select_type_tmp): New global variables, used for SELECT TYPE statements. (gfc_match_select_type): Better error handling. Remember selector. (gfc_match_type_is): Create temporary variable. * module.c (ab_attribute): New value 'AB_IS_CLASS'. (attr_bits): New string. (mio_symbol_attribute): Handle 'is_class'. * resolve.c (resolve_select_type): Insert pointer assignment statement, to assign temporary to selector. * symbol.c (gfc_get_ha_sym_tree): Replace selector by a temporary in SELECT TYPE statements. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * dump-parse-tree.c (show_code_node): Renamed 'alloc_list'. * gfortran.h (gfc_code): Rename 'alloc_list'. Add member 'ts'. (gfc_expr_to_initialize): New prototype. * match.c (alloc_opt_list): Correctly check type compatibility. Renamed 'alloc_list'. (dealloc_opt_list): Renamed 'alloc_list'. * resolve.c (expr_to_initialize): Rename to 'gfc_expr_to_initialize' and make it non-static. (resolve_allocate_expr): Set vindex for CLASS variables correctly. Move initialization code to gfc_trans_allocate. Renamed 'alloc_list'. (resolve_allocate_deallocate): Renamed 'alloc_list'. (check_class_pointer_assign): Rename to 'resolve_class_assign'. Change argument type. Adjust to work with ordinary assignments. (resolve_code): Call 'resolve_class_assign' for ordinary assignments. Renamed 'check_class_pointer_assign'. * st.c (gfc_free_statement): Renamed 'alloc_list'. * trans-stmt.c (gfc_trans_allocate): Renamed 'alloc_list'. Handle size determination and initialization of CLASS variables. Bugfix for ALLOCATE statements with default initialization and SOURCE block. (gfc_trans_deallocate): Renamed 'alloc_list'. 2009-09-30 Paul Thomas <pault@gcc.gnu.org> * trans-expr.c (gfc_conv_procedure_call): Convert a derived type actual to a class object if the formal argument is a class. 2009-09-30 Janus Weil <janus@gcc.gnu.org> PR fortran/40996 * decl.c (build_struct): Handle allocatable scalar components. * expr.c (gfc_add_component_ref): Correctly set typespec of expression, after inserting component reference. * match.c (gfc_match_type_is,gfc_match_class_is): Make sure that no variables are being used uninitialized. * primary.c (gfc_match_varspec): Handle CLASS array components. * resolve.c (resolve_select_type): Transform EXEC_SELECT_TYPE to EXEC_SELECT. * trans-array.c (structure_alloc_comps,gfc_trans_deferred_array): Handle allocatable scalar components. * trans-expr.c (gfc_conv_component_ref): Ditto. * trans-types.c (gfc_get_derived_type): Ditto. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * decl.c (encapsulate_class_symbol): Modify names of class container components by prefixing with '$'. (gfc_match_end): Handle COMP_SELECT_TYPE. * expr.c (gfc_add_component_ref): Modify names of class container components by prefixing with '$'. * gfortran.h (gfc_statement): Add ST_SELECT_TYPE, ST_TYPE_IS and ST_CLASS_IS. (gfc_case): New field 'ts'. (gfc_exec_op): Add EXEC_SELECT_TYPE. (gfc_type_is_extension_of): New prototype. * match.h (gfc_match_select_type,gfc_match_type_is,gfc_match_class_is): New prototypes. * match.c (match_derived_type_spec): New function. (match_type_spec): Use 'match_derived_type_spec'. (match_case_eos): Modify error message. (gfc_match_select_type): New function. (gfc_match_case): Modify error message. (gfc_match_type_is): New function. (gfc_match_class_is): Ditto. * parse.h (gfc_compile_state): Add COMP_SELECT_TYPE. * parse.c (decode_statement): Handle SELECT TYPE, TYPE IS and CLASS IS statements. (next_statement): Handle ST_SELECT_TYPE. (gfc_ascii_statement): Handle ST_SELECT_TYPE, ST_TYPE_IS, ST_CLASS_IS. (parse_select_type_block): New function. (parse_executable): Handle ST_SELECT_TYPE. * resolve.c (resolve_deallocate_expr): Handle BT_CLASS. Modify names of class container components by prefixing with '$'. (resolve_allocate_expr): Ditto. (resolve_select_type): New function. (gfc_resolve_blocks): Handle EXEC_SELECT_TYPE. (check_class_pointer_assign): Modify names of class container components by prefixing with '$'. (resolve_code): Ditto. * st.c (gfc_free_statement): Ditto. * symbol.c (gfc_type_is_extension_of): New function. (gfc_type_compatible): Use 'gfc_type_is_extension_of', plus a bugfix. * trans.c (gfc_trans_code): Handel EXEC_SELECT_TYPE. 2009-09-30 Janus Weil <janus@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> * check.c (gfc_check_move_alloc): Arguments don't have to be arrays. The second argument needs to be type-compatible with the first (not the other way around, which makes a difference for CLASS entities). * decl.c (encapsulate_class_symbol): New function. (build_sym,build_struct): Handle BT_CLASS, call 'encapsulate_class_symbol'. (gfc_match_decl_type_spec): Remove warning, use BT_CLASS. (gfc_match_derived_decl): Set vindex; * expr.c (gfc_add_component_ref): New function. (gfc_copy_expr,gfc_check_pointer_assign,gfc_check_assign_symbol): Handle BT_CLASS. * dump-parse-tree.c (show_symbol): Print vindex. * gfortran.h (bt): New basic type BT_CLASS. (symbol_attribute): New field 'is_class'. (gfc_typespec): Remove field 'is_class'. (gfc_symbol): New field 'vindex'. (gfc_get_ultimate_derived_super_type): New prototype. (gfc_add_component_ref): Ditto. * interface.c (gfc_compare_derived_types): Pointer equality check moved here from gfc_compare_types. (gfc_compare_types): Handle BT_CLASS and use gfc_type_compatible. * match.c (gfc_match_allocate,gfc_match_deallocate,gfc_match_call): Handle BT_CLASS. * misc.c (gfc_clear_ts): Removed is_class. (gfc_basic_typename,gfc_typename): Handle BT_CLASS. * module.c (bt_types,mio_typespec): Handle BT_CLASS. (mio_symbol): Handle vindex. * primary.c (gfc_match_varspec,gfc_variable_attr): Handle BT_CLASS. * resolve.c (find_array_spec,check_typebound_baseobject): Handle BT_CLASS. (resolve_ppc_call,resolve_expr_ppc): Don't call 'gfc_is_proc_ptr_comp' inside 'gcc_assert'. (resolve_deallocate_expr,resolve_allocate_expr): Handle BT_CLASS. (check_class_pointer_assign): New function. (resolve_code): Handle BT_CLASS, call check_class_pointer_assign. (resolve_fl_var_and_proc,type_is_extensible,resolve_fl_variable_derived, resolve_fl_variable): Handle BT_CLASS. (check_generic_tbp_ambiguity): Add special case. (resolve_typebound_procedure,resolve_fl_derived): Handle BT_CLASS. * symbol.c (gfc_get_ultimate_derived_super_type): New function. (gfc_type_compatible): Handle BT_CLASS. * trans-expr.c (conv_parent_component_references): Handle CLASS containers. (gfc_conv_initializer): Handle BT_CLASS. * trans-types.c (gfc_typenode_for_spec,gfc_get_derived_type): Handle BT_CLASS. testsuite/ 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/same_type_as_1.f03: New test. * gfortran.dg/same_type_as_2.f03: Ditto. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/select_type_1.f03: Extended. * gfortran.dg/select_type_3.f03: New test. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/class_allocate_1.f03: New test. 2009-09-30 Janus Weil <janus@gcc.gnu.org> PR fortran/40996 * gfortran.dg/allocatable_scalar_3.f90: New test. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/typebound_proc_5.f03: Changed error messages. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/block_name_2.f90: Modified error message. * gfortran.dg/select_6.f90: Ditto. * gfortran.dg/select_type_1.f03: New test. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/allocate_derived_1.f90: Remove -w option. * gfortran.dg/class_1.f03: Ditto. * gfortran.dg/class_2.f03: Ditto. * gfortran.dg/proc_ptr_comp_pass_1.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_2.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_3.f90: Ditto. * gfortran.dg/typebound_call_10.f03: Ditto. * gfortran.dg/typebound_call_2.f03: Ditto. * gfortran.dg/typebound_call_3.f03: Ditto. * gfortran.dg/typebound_call_4.f03: Ditto. * gfortran.dg/typebound_call_9.f03: Ditto. * gfortran.dg/typebound_generic_3.f03: Ditto. * gfortran.dg/typebound_generic_4.f03: Ditto. * gfortran.dg/typebound_operator_1.f03: Ditto. * gfortran.dg/typebound_operator_2.f03: Ditto. * gfortran.dg/typebound_operator_3.f03: Ditto. * gfortran.dg/typebound_operator_4.f03: Ditto. * gfortran.dg/typebound_proc_1.f08: Ditto. * gfortran.dg/typebound_proc_5.f03: Ditto. * gfortran.dg/typebound_proc_6.f03: Ditto. From-SVN: r152345
2009-07-26re PR fortran/33197 (Fortran 2008: math functions)Tobias Burnus1-2/+5
2009-07-26 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * intrinsic.c (make_generic): Remove assert as "atan" can be both ISYM_ATAN and ISYM_ATAN2. (add_functions): Add two-argument variant of ATAN. * intrinsic.h (gfc_check_atan_2): Add check for it. * intrinsic.texi (ATAN2): Correct and enhance description. (ATAN): Describe two-argument variant of ATAN. 2009-07-26 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * gfortran.dg/atan2_1.f90: New test * gfortran.dg/atan2_2.f90: New test From-SVN: r150100
2009-07-25re PR fortran/33197 (Fortran 2008: math functions)Tobias Burnus1-6/+6
2009-07-25 Tobias Burnus <burnus@net-b.de> Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/33197 * intrinsic.c (add_functions): Support complex arguments for acos,acosh,asin,asinh,atan,atanh. * invoke.texi (ACOS,ACOSH,ASIN,ASINH,ATAN,ATANH): Support complex arguments. * simplify.c (gfc_simplify_acos,gfc_simplify_acosh, gfc_simplify_asin,gfc_simplify_asinh,gfc_simplify_atan, gfc_simplify_atanh,gfc_simplify_atan,gfc_simplify_asinh, gfc_simplify_acosh,gfc_simplify_atanh): Support complex arguments. 2009-07-25 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * intrinsics/c99_functions.c (cacosf,cacos,cacosl,casinf, casin,casind,catanf,catan,catanl,cacoshf,cacosh,cacoshl, casinhf,casinh,casinhf,catanhf,catanh,catanhl): New functions. * c99_protos.h: Add prototypes for those. 2009-07-25 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * gfortran.dg/complex_intrinsic_5.f90: New test. * gfortran.dg/complex_intrinsic_7.f90: New test. Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> From-SVN: r150087
2009-07-11re PR fortran/33197 (Fortran 2008: math functions)Tobias Burnus1-4/+4
2009-07-09 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * check.c (gfc_check_fn_rc2008): New function. * intrinsic.h (gfc_check_fn_rc2008): New prototype. * intrinsic.c (add_functions): Add complex tan, cosh, sinh, and tanh. 2009-07-09 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * gfortran.dg/complex_intrinsic_3.f90: New test. * gfortran.dg/complex_intrinsic_4.f90: New test. From-SVN: r149503
2009-07-09re PR fortran/40604 (ICE with -fcheck=pointer)Tobias Burnus1-0/+1
2009-07-09 Tobias Burnus <burnus@net-b.de> PR fortran/40604 * intrinsic.c (gfc_convert_type_warn): Set sym->result. * trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer for optional arguments. 2009-07-09 Tobias Burnus <burnus@net-b.de> PR fortran/40604 * gfortran.dg/pointer_check_6.f90: New test. From-SVN: r149405
2009-06-11re PR fortran/38718 (some simplifiers for elemental intrinsics missing; ↵Francois-Xavier Coudert1-4/+7
required for init expressions) PR fortran/38718 * intrinsic.c (add_functions): Add simplifiers for ISNAN, IS_IOSTAT_END and IS_IOSTAT_EOR. * intrinsic.h (gfc_simplify_is_iostat_end, * gfc_simplify_is_iostat_eor, gfc_simplify_isnan): New prototypes. * intrinsic.c (gfc_simplify_is_iostat_end, * gfc_simplify_is_iostat_eor, gfc_simplify_isnan): New functions. * gfortran.dg/is_iostat_end_eor_2.f90: New test. * gfortran.dg/nan_5.f90: New test. From-SVN: r148367
2009-06-07re PR fortran/25104 ([F2003] Non-initialization expr. as case-selector)Daniel Franke1-2/+2
2009-06-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/25104 PR fortran/29962 * array.c (gfc_append_constructor): Added NULL-check. * check.c (gfc_check_spread): Check DIM. (gfc_check_unpack): Check that the ARRAY arguments provides enough values for MASK. * intrinsic.h (gfc_simplify_spread): New prototype. (gfc_simplify_unpack): Likewise. * intrinsic.c (add_functions): Added new simplifier callbacks. * simplify.c (gfc_simplify_spread): New. (gfc_simplify_unpack): New. * expr.c (check_transformational): Allow additional * transformational intrinsics in initialization expression. 2009-06-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/25104 PR fortran/29962 * gfortran.dg/spread_init_expr.f03: New. * gfortran.dg/unpack_init_expr.f03: New. * gfortran.dg/intrinsic_argument_conformance_2.f90: Adjusted error message. From-SVN: r148250
2009-06-07re PR fortran/25104 ([F2003] Non-initialization expr. as case-selector)Daniel Franke1-5/+5
2009-06-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/25104 PR fortran/29962 * check.c (gfc_check_all_any): Check rank of DIM. (gfc_check_count): Likewise. * intrinsic.h (gfc_simplify_all): New prototype. (gfc_simplify_any): Likewise. (gfc_simplify_count): Likewise. (gfc_simplify_sum): Likewise. (gfc_simplify_product): Likewise. * intrinsic.c (add_functions): Added new simplifier callbacks. * simplify.c (transformational_result): New. (simplify_transformation_to_scalar): New. (simplify_transformation_to_array): New. (gfc_count): New. (gfc_simplify_all): New. (gfc_simplify_any): New. (gfc_simplify_count): New. (gfc_simplify_sum): New. (gfc_simplify_product): New. * expr.c (check_transformational): Allow additional * transformational intrinsics in initialization expression. 2009-06-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/25104 PR fortran/29962 * gfortran.dg/count_init_expr.f03 * gfortran.dg/product_init_expr.f03 * gfortran.dg/sum_init_expr.f03 From-SVN: r148249
2009-06-07re PR fortran/36874 (Add shape checks to cshift/eoshift)Daniel Franke1-8/+7
2009-06-07 Daniel Franke <franke.daniel@gmail.com> * check.c (dim_rank_check): Return SUCCESS if DIM=NULL. (gfc_check_lbound): Removed (now) redundant check for DIM=NULL. (gfc_check_minloc_maxloc): Likewise. (check_reduction): Likewise. (gfc_check_size): Likewise. (gfc_check_ubound): Likewise. (gfc_check_cshift): Added missing shape-conformance checks. (gfc_check_eoshift): Likewise. * gfortran.h (gfc_check_conformance): Modified prototype to printf-style. * expr.c (gfc_check_conformance): Accept error-message chunks in printf-style. Changed all callers. 2009-06-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/36874 * gfortran.dg/intrinsic_argument_conformance_2.f90: Adjusted error message. * gfortran.dg/zero_sized_1.f90: Removed checks with incompatible shapes. * gfortran.dg/zero_sized_5.f90: Likewise. From-SVN: r148247