Commit Graph

165 Commits

Author SHA1 Message Date
Thomas Koenig
1607a827d1 gfortran.h (gfc_option_t): Replace dump_parse_tree by dump_fortran_original and add dump_fortran_optimized.
2010-10-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* gfortran.h (gfc_option_t):  Replace dump_parse_tree by
	dump_fortran_original and add dump_fortran_optimized.
	* lang.opt: Add fdump-fortran-original and
	fdump-fortran-optimized.  Document that fdump-parse-tree is
	deprecated.
	* gfortran.texi: Add -fdump-fortran-original and
	-fdump-fortran-optimized.  -fdump-parse-tree is deprecated.
	* frontend-passes.c (gfc_run_passes):  If optimizing and
	if gfc_option.dump_fortran_optimized is set, dump the parse tree
	after optimization.
	* parse.c:  Rename gfc_option.dump_parse_tree to
	gfc_option.dump_fortran_original.
	* options.c (gfc_init_options):  Rename gfc_option.dump_parse_tree
	to gfc_option.dump_fortran_original and handle
	gfc_option.dump_fortran_optimize.
	(gfc_post_options): Rename gfc_option.dump_parse_tree
	to gfc_option.dump_fortran_original.
	(gfc_handle_option):  Rename OPT_fdump_parse_tree to
	OPT_fdump_fortran_original and gfc_option.dump_parse_tree
	to gfc_option.dump_fortran_original.  Handle
	OPT_fdump_fortran_optimized.

From-SVN: r166091
2010-10-30 15:19:27 +00:00
Daniel Kraft
a81f4b6785 re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))
2010-10-12  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* parse.c (parse_associate): Set typespec of associate-name if that of
	the target is already available.

2010-10-12  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.dg/associate_1.f03: More tests with derived-types.
	* gfortran.dg/associate_9.f03: New test (XFAIL for now).
	* gfortran.dg/associate_8.f03: Fix typo.
	* gfortran.dg/initialization_27.f90: Fix typo.

From-SVN: r165378
2010-10-12 15:30:53 +02:00
Joseph Myers
e3339d0f33 optc-gen.awk: Generate global_options initializer instead of individual 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-29 15:49:14 +01:00
Daniel Kraft
e5ca969363 re PR fortran/44602 ([F2008] EXIT: Jump to end of construct)
2010-09-03  Daniel Kraft  <d@domob.eu>

	PR fortran/44602
	* gfortran.h (struct gfc_code): Renamed `whichloop' to
	`which_construct' as this is no longer restricted to loops.
	* parse.h (struct gfc_state_data): New field `construct'.
	* match.c (match_exit_cycle): Handle EXIT from non-loops.
	* parse.c (push_state): Set `construct' field.
	* resolve.c (resolve_select_type): Extend comment.
	* trans-stmt.c (gfc_trans_if): Add exit label.
	(gfc_trans_block_construct), (gfc_trans_select): Ditto.
	(gfc_trans_simple_do): Store exit/cycle labels on the gfc_code itself.
	(gfc_trans_do), (gfc_trans_do_while): Ditto.
	(gfc_trans_exit): Use new name `which_construct' instead of `whichloop'.
	(gfc_trans_cycle): Ditto.
	(gfc_trans_if_1): Use fold_build3_loc instead of fold_build3.

2010-09-03  Daniel Kraft  <d@domob.eu>

	PR fortran/44602
	* gfortran.dg/exit_2.f08; Adapt error messages.
	* gfortran.dg/exit_3.f08: New test.
	* gfortran.dg/exit_4.f08: New test.
	* gfortran.dg/exit_5.f03: New test.

From-SVN: r163798
2010-09-03 10:01:51 +02:00
Daniel Kraft
571d54deb6 re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))
2010-08-17  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.h (struct gfc_association_list): New member `where'.
	(gfc_is_associate_pointer) New method.
	* match.c (gfc_match_associate): Remember locus for each associate
	name matched and do not try to set variable flag.
	* parse.c (parse_associate): Use remembered locus for symbols.
	* primary.c (match_variable): Instead of variable-flag check for
	associate names set it for all such names used.
	* symbol.c (gfc_is_associate_pointer): New method.
	* resolve.c (resolve_block_construct): Don't generate assignments
	to give associate-names their values.
	(resolve_fl_var_and_proc): Allow associate-names to be deferred-shape.
	(resolve_symbol): Set some more attributes for associate variables,
	set variable flag here and check it and don't try to build an
	explicitely shaped array-spec for array associate variables.
	* trans-expr.c (gfc_conv_variable): Dereference in case of association
	to scalar variable.
	* trans-types.c (gfc_is_nodesc_array): Handle array association symbols.
	(gfc_sym_type): Return pointer type for association to scalar vars.
	* trans-decl.c (gfc_get_symbol_decl): Defer association symbols.
	(trans_associate_var): New method.
	(gfc_trans_deferred_vars): Handle association symbols.

2010-08-17  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.dg/associate_1.f03: Extended to test newly supported
	features like association to variables.
	* gfortran.dg/associate_3.f03: Removed check for illegal change
	of associate-name here...
	* gfortran.dg/associate_5.f03: ...and added it here.
	* gfortran.dg/associate_6.f03: No longer XFAIL'ed.
	* gfortran.dg/associate_7.f03: New test.

From-SVN: r163295
2010-08-17 10:20:03 +02:00
Daniel Kraft
52bf62f96b re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))
2010-08-15  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.h (gfc_find_proc_namespace): New method.
	* expr.c (gfc_build_intrinsic_call): No need to build symtree messing
	around with namespace.
	* symbol.c (gfc_find_proc_namespace): New method.
	* trans-decl.c (gfc_build_qualified_array): Use it for correct
	value of nest.
	* primary.c (gfc_match_varspec): Handle associate-names as arrays.
	* parse.c (parse_associate): Removed assignment-generation here...
	* resolve.c (resolve_block_construct): ...and added it here.
	(resolve_variable): Handle names that are arrays but were not parsed
	as such because of association.
	(resolve_code): Fix BLOCK resolution.
	(resolve_symbol): Generate array-spec for associate-names.

2010-08-15  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.dg/associate_1.f03: Enable test for array expressions.
	* gfortran.dg/associate_3.f03: Clarify comment.
	* gfortran.dg/associate_5.f03: New test.
	* gfortran.dg/associate_6.f03: New test.

From-SVN: r163268
2010-08-15 21:46:21 +02:00
Mikael Morin
4bc20f3a3f re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal argument)
2010-08-04  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/42051
	PR fortran/44064
	* symbol.c (changed_syms): Made static again.
	(gfc_symbol_state): Don't conditionalize on GFC_DEBUG. 
	Changed conditional internal error into assert.
	Rename function to ...
	(gfc_enforce_clean_symbol_state): ... this.
	* gfortran.h (gfc_symbol_state, gfc_enforce_clean_symbol_state): 
	Rename the former to the latter.
	* parse.c (decode_statement, decode_omp_directive,
	decode_gcc_attribute): Update callers accordingly. Don't conditionalize
	on GFC_DEBUG.
	(changed_syms): Remove declaration.
	(next_statement): Use gfc_enforce_clean_symbol_state.

From-SVN: r162865
2010-08-04 14:17:31 +00:00
Mikael Morin
ef973f3f4b re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal 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-08-02 15:30:47 +00:00
Mikael Morin
951d634180 re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal argument)
2010-07-31  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/42051
	PR fortran/44064
	* symbol.c (changed_syms): Made non-static.
	* parse.c (changed_syms): Declare new external. 
	(next_statement): Assert changed_syms is NULL at the beginning.

From-SVN: r162776
2010-07-31 10:27:36 +00:00
Mikael Morin
3cb595ac0b gfortran.h (gfc_release_symbol): New prototype.
2010-07-30  Mikael Morin  <mikael@gcc.gnu.org>

	* gfortran.h (gfc_release_symbol): New prototype.
	* symbol.c (gfc_release_symbol): New. Code taken from free_sym_tree.
	(gfc_undo_symbols, free_sym_tree, gfc_free_finalizer):
	Use gfc_release_symbol.
	* parse.c (gfc_fixup_sibling_symbols): Ditto.
	* resolve.c (resolve_symbol): Ditto.

From-SVN: r162719
2010-07-30 16:41:55 +00:00
Mikael Morin
31fee91edf re PR fortran/44660 (ICE in resolve_equivalence())
2010-07-25  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/44660
	* gfortran.h (gfc_namespace): New field old_equiv.
	(gfc_free_equiv_until): New prototype.
	* match.c (gfc_free_equiv_until): New, renamed from gfc_free_equiv with
	a parameterized stop condition.
	(gfc_free_equiv): Use gfc_free_equiv_until.
	* parse.c (next_statement): Save equivalence list.
	(reject_statement): Restore equivalence list.

From-SVN: r162516
2010-07-25 17:01:15 +00:00
Tobias Burnus
8569c75308 re PR fortran/40011 (Problems with -fwhole-file)
2010-07-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40011
        * parse.c (gfc_parse_file): Do not override
        gfc_global_ns_list items.

2010-07-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40011
        * gfortran.dg/whole_file_21.f90: New.

        * gfortran.dg/integer_exponentiation_3.F90: Use
        -ffloat-store only for i?86/x86-64 -m32.

From-SVN: r162500
2010-07-24 18:32:11 +02:00
Janus Weil
d40477b49f re PR fortran/44869 ([OOP] generic TBPs not initialized properly)
2010-07-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44689
	* decl.c (build_sym,attr_decl1): Only build the class container if the
	symbol has sufficient attributes.
	* expr.c (gfc_check_pointer_assign): Use class_pointer instead of
	pointer attribute for classes.
	* match.c (gfc_match_allocate,gfc_match_deallocate): Ditto.
	* module.c (MOD_VERSION): Bump.
	(enum ab_attribute,attr_bits): Add AB_CLASS_POINTER.
	(mio_symbol_attribute): Handle class_pointer attribute.
	* parse.c (parse_derived): Use class_pointer instead of pointer
	attribute for classes.
	* primary.c (gfc_variable_attr,gfc_expr_attr): Ditto.
	* resolve.c (resolve_structure_cons,resolve_deallocate_expr,
	resolve_allocate_expr,resolve_fl_derived): Ditto.
	(resolve_fl_var_and_proc): Check for class_ok attribute.

2010-07-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44689
	* gfortran.dg/class_24.f03: New.

From-SVN: r162052
2010-07-11 09:55:11 +02:00
Tobias Burnus
c6c73c51ca parse.c (next_free, next_fixed): Allow ";" as first character.
2010-06-25  Tobias Burnus  <burnus@net-b.de>

        * parse.c (next_free, next_fixed): Allow ";" as first character.

2010-06-25  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/semicolon_fixed.f: Update.
        * gfortran.dg/semicolon_fixed_2.f: New.
        * gfortran.dg/semicolon_free_2.f90: New.
        * gfortran.dg/semicolon_free.f90: Update.

From-SVN: r161405
2010-06-25 21:01:04 +02:00
Tobias Burnus
fe4e525c24 re PR fortran/40632 (Support F2008's contiguous attribute)
2010-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40632
        * interface.c (compare_parameter): Add gfc_is_simply_contiguous
        checks.
        * symbol.c (gfc_add_contiguous): New function.
        (gfc_copy_attr, check_conflict): Handle contiguous attribute.
        * decl.c (match_attr_spec): Ditto.
        (gfc_match_contiguous): New function.
        * resolve.c (resolve_fl_derived, resolve_symbol): Handle
        contiguous.
        * gfortran.h (symbol_attribute): Add contiguous.
        (gfc_is_simply_contiguous): Add prototype.
        (gfc_add_contiguous): Add prototype.
        * match.h (gfc_match_contiguous): Add prototype.
        * parse.c (decode_specification_statement,
        decode_statement): Handle contiguous attribute.
        * expr.c (gfc_is_simply_contiguous): New function.
        * dump-parse-tree.c (show_attr): Handle contiguous.
        * module.c (ab_attribute, attr_bits, mio_symbol_attribute):
        Ditto.
        * trans-expr.c (gfc_add_interface_mapping): Copy
        attr.contiguous.
        * trans-array.c (gfc_conv_descriptor_stride_get,
        gfc_conv_array_parameter): Handle contiguous arrays.
        * trans-types.c (gfc_build_array_type, gfc_build_array_type,
        gfc_sym_type, gfc_get_derived_type, gfc_get_array_descr_info):
        Ditto.
        * trans.h (gfc_array_kind): Ditto.
        * trans-decl.c (gfc_get_symbol_decl): Ditto.

2010-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40632
        * gfortran.dg/contiguous_1.f90: New.
        * gfortran.dg/contiguous_2.f90: New.
        * gfortran.dg/contiguous_3.f90: New.

From-SVN: r161079
2010-06-21 16:15:56 +02:00
Daniel Kraft
03af1e4c73 re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))
2010-06-10  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.h (enum gfc_statement): Add ST_ASSOCIATE, ST_END_ASSOCIATE.
	(struct gfc_symbol): New field `assoc'.
	(struct gfc_association_list): New struct.
	(struct gfc_code): New struct `block' in union, move `ns' there
	and add association list.
	(gfc_free_association_list): New method.
	(gfc_has_vector_subscript): Made public;
	* match.h (gfc_match_associate): New method.
	* parse.h (enum gfc_compile_state): Add COMP_ASSOCIATE.
	* decl.c (gfc_match_end): Handle ST_END_ASSOCIATE.
	* interface.c (gfc_has_vector_subscript): Made public.
	(compare_actual_formal): Rename `has_vector_subscript' accordingly.
	* match.c (gfc_match_associate): New method.
	(gfc_match_select_type): Change reference to gfc_code's `ns' field.
	* primary.c (match_variable): Don't allow names associated to expr here.
	* parse.c (decode_statement): Try matching ASSOCIATE statement.
	(case_exec_markers, case_end): Add ASSOCIATE statement.
	(gfc_ascii_statement): Hande ST_ASSOCIATE and ST_END_ASSOCIATE.
	(parse_associate): New method.
	(parse_executable): Handle ST_ASSOCIATE.
	(parse_block_construct): Change reference to gfc_code's `ns' field.
	* resolve.c (resolve_select_type): Ditto.
	(resolve_code): Ditto.
	(resolve_block_construct): Ditto and add comment.
	(resolve_select_type): Set association list in generated BLOCK to NULL.
	(resolve_symbol): Resolve associate names.
	* st.c (gfc_free_statement): Change reference to gfc_code's `ns' field
	and free association list.
	(gfc_free_association_list): New method.
	* symbol.c (gfc_new_symbol): NULL new field `assoc'.
	* trans-stmt.c (gfc_trans_block_construct): Change reference to
	gfc_code's `ns' field.

2010-06-10  Daniel Kraft  <d@domob.eu>

	PR fortran/38936
	* gfortran.dg/associate_1.f03: New test.
	* gfortran.dg/associate_2.f95: New test.
	* gfortran.dg/associate_3.f03: New test.
	* gfortran.dg/associate_4.f08: New test.

From-SVN: r160550
2010-06-10 16:47:49 +02:00
Tobias Burnus
aac18c0250 re PR fortran/44360 (wrong-code: host-associated procedure wrongly favoured to use-associated one)
2010-06-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/44360
        * parse.c (gfc_fixup_sibling_symbols): Do not "fix"
        use-associated symbols.

2010-06-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/44360
        * gfortran.dg/use_13.f90: New test case.

From-SVN: r160138
2010-06-02 07:55:19 +02:00
Janus Weil
7a08eda161 gfortran.h (CLASS_DATA): New macro for accessing the $data component of a class container.
2010-05-30  Janus Weil  <janus@gcc.gnu.org>

	* gcc/fortran/gfortran.h (CLASS_DATA): New macro for accessing the
	$data component of a class container.
	* gcc/fortran/decl.c (attr_decl1): Use macro CLASS_DATA.
	* gcc/fortran/expr.c (gfc_check_pointer_assign,gfc_check_assign_symbol,
	gfc_has_ultimate_allocatable,gfc_has_ultimate_pointer): Ditto.
	* gcc/fortran/interface.c (matching_typebound_op): Ditto.
	* gcc/fortran/match.c (gfc_match_allocate, gfc_match_deallocate): Ditto.
	* gcc/fortran/parse.c (parse_derived): Ditto.
	* gcc/fortran/primary.c (gfc_match_varspec, gfc_variable_attr,
	gfc_expr_attr): Ditto.
	* gcc/fortran/resolve.c (resolve_structure_cons, find_array_spec,
	resolve_deallocate_expr, resolve_allocate_expr, resolve_select_type,
	resolve_fl_var_and_proc, resolve_typebound_procedure,
	resolve_fl_derived): Ditto.
	* gcc/fortran/symbol.c (gfc_type_compatible): Restructured.
	* gcc/fortran/trans-array.c (structure_alloc_comps): Use macro
	CLASS_DATA.
	* gcc/fortran/trans-decl.c (gfc_get_symbol_decl,
	gfc_trans_deferred_vars): Ditto.
	* gcc/fortran/trans-stmt.c (gfc_trans_allocate): Ditto.

From-SVN: r160060
2010-05-30 23:56:11 +02:00
Janus Weil
bc382218ce re PR fortran/44212 ([OOP] ICE when defining a pointer component before defining the class and calling a TBP then)
2010-05-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44212
	* match.c (gfc_match_select_type): On error jump back out of the local
	namespace.
	* parse.c (parse_derived): Defer creation of vtab symbols to resolution
	stage, more precisely to ...
	* resolve.c (resolve_fl_derived): ... this place.


2010-05-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44212
	* gfortran.dg/class_22.f03: New.

From-SVN: r159745
2010-05-22 20:55:53 +02:00
Steven G. Kargl
431f5969d1 re PR fortran/43592 (Unexpected INTERFACE statement in INTERFACE block at (1))
2010-05-03  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/43592
	* fortran/parse.c (parse_interface): Do not dereference a NULL pointer.

2010-05-03  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/43592
	* gfortran.dg/unexpected_interface.f90: New test.

From-SVN: r158998
2010-05-03 17:57:14 +00:00
Paul Thomas
eece1eb9ac [multiple changes]
2010-04-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43896
	* symbol.c (add_proc_component,copy_vtab_proc_comps): Remove
	initializers for PPC members of the vtabs.

2010-04-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42274
	* symbol.c (add_proc_component,add_proc_comps): Correctly set the 'ppc'
	attribute for all PPC members of the vtypes.
	(copy_vtab_proc_comps): Copy the correct interface.
	* trans.h (gfc_trans_assign_vtab_procs): Modified prototype.
	* trans-expr.c (gfc_trans_assign_vtab_procs): Pass the derived type as
	a dummy argument and make sure all PPC members of the vtab are
	initialized correctly.
	(gfc_conv_derived_to_class,gfc_trans_class_assign): Additional argument
	in call to gfc_trans_assign_vtab_procs.
	* trans-stmt.c (gfc_trans_allocate): Ditto.

2010-04-29  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/43326
	* resolve.c (resolve_typebound_function): Renamed
	resolve_class_compcall.Do all the detection of class references
	here.
	(resolve_typebound_subroutine): resolve_class_typebound_call
	renamed. Otherwise same as resolve_typebound_function.
	(gfc_resolve_expr): Call resolve_typebound_function.
	(resolve_code): Call resolve_typebound_subroutine.

2010-04-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43492
	* resolve.c (resolve_typebound_generic_call): For CLASS methods
	pass back the specific symtree name, rather than the target
	name.

2010-04-29  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/42353
	* resolve.c (resolve_structure_cons): Make the initializer of
	the vtab component 'extends' the same type as the component.

2010-04-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/42680
	* interface.c (check_interface1): Pass symbol name rather than NULL to
	gfc_compare_interfaces.(gfc_compare_interfaces): Add assert to
	trap MULL. (gfc_compare_derived_types): Revert previous change
	incorporated incorrectly during merge from trunk, r155778.
	* resolve.c (check_generic_tbp_ambiguity): Pass symbol name rather
	than NULL to gfc_compare_interfaces.
	* symbol.c (add_generic_specifics): Likewise.

2010-02-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42353
	* interface.c (gfc_compare_derived_types): Add condition for vtype.
	* symbol.c (gfc_find_derived_vtab): Sey access to private.
	(gfc_find_derived_vtab): Likewise.
	* module.c (ab_attribute): Add enumerator AB_VTAB.
	(mio_symbol_attribute): Use new attribute, AB_VTAB.
	(check_for_ambiguous): Likewise.

2010-04-29  Paul Thomas  <pault@gcc.gnu.org>
	    Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41829
	* trans-expr.c (select_class_proc): Remove function.
	(conv_function_val): Delete reference to previous.
	(gfc_conv_derived_to_class): Add second argument to the call to
	gfc_find_derived_vtab.
	(gfc_conv_structure): Exclude proc_pointer components when
	accessing $data field of class objects.
	(gfc_trans_assign_vtab_procs): New function.
	(gfc_trans_class_assign): Add second argument to the call to
	gfc_find_derived_vtab.
	* symbol.c (gfc_build_class_symbol): Add delayed_vtab arg and
	implement holding off searching for the vptr derived type.
	(add_proc_component): New function.
	(add_proc_comps): New function.
	(add_procs_to_declared_vtab1): New function.
	(copy_vtab_proc_comps): New function.
	(add_procs_to_declared_vtab): New function.
	(void add_generic_specifics): New function.
	(add_generics_to_declared_vtab): New function.
	(gfc_find_derived_vtab): Add second argument to the call to
	gfc_find_derived_vtab. Add the calls to
	add_procs_to_declared_vtab and add_generics_to_declared_vtab.
	* decl.c (build_sym, build_struct): Use new arg in calls to
	gfc_build_class_symbol.
	* gfortran.h : Add vtype bitfield to symbol_attr. Remove the
	definition of struct gfc_class_esym_list. Modify prototypes
	of gfc_build_class_symbol and gfc_find_derived_vtab.
	* trans-stmt.c (gfc_trans_allocate): Add second argument to the
	call to gfc_find_derived_vtab.
	* module.c : Add the vtype attribute.
	* trans.h : Add prototype for gfc_trans_assign_vtab_procs.
	* resolve.c (resolve_typebound_generic_call): Add second arg
	to pass along the generic name for class methods.
	(resolve_typebound_call): The same.
	(resolve_compcall): Use the second arg to carry the generic
	name from the above. Remove the reference to class_esym.
	(check_members, check_class_members, resolve_class_esym,
	hash_value_expr): Remove functions.
	(resolve_class_compcall, resolve_class_typebound_call): Modify
	to use vtable rather than member by member calls.
	(gfc_resolve_expr): Modify second arg in call to
	resolve_compcall.
	(resolve_select_type): Add second arg in call to
	gfc_find_derived_vtab.
	(resolve_code): Add second arg in call resolve_typebound_call.
	(resolve_fl_derived): Exclude vtypes from check for late
	procedure definitions. Likewise for checking of explicit
	interface and checking of pass arg.
	* iresolve.c (gfc_resolve_extends_type_of): Add second arg in
	calls to gfc_find_derived_vtab.
	* match.c (select_type_set_tmp): Use new arg in call to
	gfc_build_class_symbol.
	* trans-decl.c (gfc_get_symbol_decl): Complete vtable if
	necessary.
	* parse.c (endType): Finish incomplete classes.


2010-04-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42274
	* gfortran.dg/class_16.f03: New test.

2010-04-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42274
	* gfortran.dg/class_15.f03: New.

2010-04-29  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/43326
	* gfortran.dg/dynamic_dispatch_9.f03: New test.

2010-04-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43492
	* gfortran.dg/generic_22.f03 : New test.

2010-04-29  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/42353
	* gfortran.dg/class_14.f03: New test.

2010-04-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/42680
	* gfortran.dg/interface_32.f90: New test.

2009-04-29  Paul Thomas  <pault@gcc.gnu.org>
	    Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41829
	* gfortran.dg/dynamic_dispatch_5.f03 : Change to "run".
	* gfortran.dg/dynamic_dispatch_7.f03 : New test.
	* gfortran.dg/dynamic_dispatch_8.f03 : New test.

From-SVN: r158910
2010-04-29 19:10:48 +00:00
Jakub Jelinek
60d3aec487 tree-ssa-pre.c (my_rev_post_order_compute): Remove set but not used count variable.
* tree-ssa-pre.c (my_rev_post_order_compute): Remove set but not
	used count variable.
	* genemit.c (gen_expand, gen_split): Avoid set but not used warnings
	when operandN variables aren't used in the body of the expander
	or splitter.
	* tree-outof-ssa.c (FOR_EACH_ELIM_GRAPH_SUCC,
	FOR_EACH_ELIM_GRAPH_PRED): Avoid set but not used warnings.
	* tree-ssa-operands.h (FOR_EACH_SSA_TREE_OPERAND): Likewise.
	* tree-flow.h (FOR_EACH_IMM_USE_FAST, FOR_EACH_IMM_USE_STMT,
	FOR_EACH_IMM_USE_ON_STMT): Likewise.
	* tree.h (FOR_EACH_CONSTRUCTOR_ELT): Likewise.
	* tree.c (PROCESS_ARG): Likewise.
fortran/
	* parse.c (parse_derived, parse_enum): Avoid set but not used
	warning.
java/
	* expr.c (process_jvm_instruction): Avoid set but not used warning.
	* builtins.c (compareAndSwapInt_builtin, compareAndSwapLong_builtin,
	getVolatile_builtin): Likewise.
libjava/
	* exception.cc (_Jv_Throw): Avoid set but not used warning.
	* include/java-assert.h (JvAssertMessage, JvAssert): Use argument in
	sizeof to avoid set but not used warnings.
libjava/classpath/
	* native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
	(Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1):
	Avoid set but not used warning.
libiberty/
	* regex.c (byte_re_match_2_internal): Avoid set but not used
	warning.
gcc/testsuite/
	* gcc.dg/builtin-choose-expr.c: Avoid set but not used warnings.
	* gcc.dg/trunc-1.c: Likewise.
	* gcc.dg/vla-9.c: Likewise.
	* gcc.dg/dfp/composite-type.c: Likewise.
libffi/
	* testsuite/libffi.call/err_bad_abi.c: Remove unused args variable.

From-SVN: r158084
2010-04-07 22:27:37 +02:00
Tobias Burnus
178f9aa17e re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2010-04-06  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * gfortran.h (gfc_array_spec): Add cotype.
        * array.c (gfc_match_array_spec,gfc_set_array_spec): Use it
        and defer error diagnostic.
        * resolve.c (resolve_fl_derived): Add missing check.
        (resolve_symbol): Add cotype/type check.
        * parse.c (parse_derived): Fix setting of coarray_comp.

2010-04-06  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * gfortran.dg/coarray_4.f90: Fix test.
        * gfortran.dg/coarray_6.f90: Add more tests.

From-SVN: r158014
2010-04-06 20:23:56 +02:00
Tobias Burnus
be59db2d47 re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2010-04-06  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * array.c (gfc_free_array_spec,gfc_resolve_array_spec,
        match_array_element_spec,gfc_copy_array_spec,
        gfc_compare_array_spec): Include corank.
        (match_array_element_spec,gfc_set_array_spec): Support codimension.
        * decl.c (build_sym,build_struct,variable_decl,
        match_attr_spec,attr_decl1,cray_pointer_decl,
        gfc_match_volatile): Add codimension.
        (gfc_match_codimension): New function.
        * dump-parse-tree.c (show_array_spec,show_attr): Support
        * codimension.
        * gfortran.h (symbol_attribute,gfc_array_spec): Ditto.
        (gfc_add_codimension): New function prototype.
        * match.h (gfc_match_codimension): New function prototype.
        (gfc_match_array_spec): Update prototype
        * match.c (gfc_match_common): Update gfc_match_array_spec call.
        * module.c (MOD_VERSION): Bump.
        (mio_symbol_attribute): Support coarray attributes.
        (mio_array_spec): Add corank support.
        * parse.c (decode_specification_statement,decode_statement,
        parse_derived): Add coarray support.
        * resolve.c (resolve_formal_arglist, was_declared,
        is_non_constant_shape_array, resolve_fl_variable,
        resolve_fl_derived, resolve_symbol): Add coarray support.
        * symbol.c (check_conflict, gfc_add_volatile, gfc_copy_attr,
        gfc_build_class_symbol): Add coarray support.
        (gfc_add_codimension): New function.

2010-04-06  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * gfortran.dg/coarray_4.f90: New test.
        * gfortran.dg/coarray_5.f90: New test.
        * gfortran.dg/coarray_6.f90: New test.

From-SVN: r158012
2010-04-06 20:16:13 +02:00
Tobias Burnus
d0a4a61c3d re PR fortran/39997 (Procedure(), pointer & implicit typing: rejects-valid / 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-06 18:26:02 +02:00
Paul Thomas
fa502cb2db ioparm.def: Update copyright.
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-04-01 18:06:05 +00:00
Tobias Burnus
096bfdb112 re PR fortran/42650 (F90: DT function with in-line DT definition and RESULT is rejected)
2010-02-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42650
        * parse.c (decode_specification_statement): Use sym->result not
        * sym.

2010-02-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42650
        * gfortran.dg/func_result_5.f90: New test.

From-SVN: r156449
2010-02-02 14:05:50 +01:00
Tobias Burnus
1eee5628bd re PR fortran/25829 ([F03] Asynchronous IO support)
2010-01-08  Tobias Burnus  <burnus@net-b.de

        PR/fortran 25829
        * symbol.c (check_conflict, gfc_copy_attr): Add
        ASYNCHRONOUS support.
        (gfc_add_asynchronous): New function.
        * decl.c (match_attr_spec): Add ASYNCHRONOUS support.
        (gfc_match_asynchronous): New function.
        * dump-parse-tree.c (show_attr): Add ASYNCHRONOUS support.
        * gfortran.h (symbol_attribute): New ASYNCHRONOUS bit.
        (gfc_add_asynchronous): New Prototype.
        * module.c (ab_attribute, mio_symbol_attribute): Add
        ASYNCHRONOUS support.
        * resolve.c (was_declared): Ditto.
        * match.h (gfc_match_asynchronous): New prototype.
        * parse.c (decode_specification_statement,decode_statement):
        Add ASYNCHRONOUS support.

2010-01-08  Tobias Burnus  <burnus@net-b.de

        PR/fortran 25829
        * gfortran.dg/asynchronous_1.f90: New test.
        * gfortran.dg/asynchronous_2.f90: New test.
        * gfortran.dg/conflicts.f90: Update error message.

From-SVN: r155732
2010-01-08 10:23:26 +01:00
Daniel Franke
b94e5176d7 re PR fortran/41369 (Empty derived-type wrongly rejected as function return type)
2009-12-10  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/41369
	* parse.c (match_deferred_characteristics): Removed check for empty
	types in function return values.

2009-12-10  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/41369
	* gfortran.dg/func_derived_5.f90: New.

From-SVN: r155141
2009-12-10 16:03:40 -05:00
Jakub Jelinek
c4fae39e15 trans-common.c (create_common): Remove unused offset variable.
* 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-11-28 13:13:21 +01:00
Janus Weil
1517fd57b6 re PR fortran/41586 ([OOP] Allocatable _scalars_ are never auto-deallocated)
2009-10-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41586
	* parse.c (parse_derived): Correctly set 'alloc_comp' and 'pointer_comp'
	for CLASS variables.
	* trans-array.c (structure_alloc_comps): Handle deallocation and
	nullification of allocatable scalar components.
	* trans-decl.c (gfc_get_symbol_decl): Remember allocatable scalars for
	automatic deallocation.
	(gfc_trans_deferred_vars): Automatically deallocate allocatable scalars.


2009-10-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41586
	* gfortran.dg/auto_dealloc_1.f90: New test case.

From-SVN: r152988
2009-10-19 21:21:18 +02:00
Janus Weil
2e23972ecb re PR fortran/41608 ([OOP] ICE with CLASS and invalid code)
2009-10-17  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41608
	* decl.c (gfc_match_data_decl): Add BT_CLASS for undefined type
	and empty type errors.
	* parse.c (gfc_build_block_ns): Only set recursive if parent ns
	has a proc_name.

	PR fortran/41629
	PR fortran/41618
	PR fortran/41587
	* gfortran.h : Add class_ok bitfield to symbol_attr.
	* decl.c (build_sym): Set attr.class_ok if dummy, pointer or
	allocatable.
	(build_struct): Use gfc_try 't' to carry errors past the call
	to encapsulate_class_symbol.
	(attr_decl1): For a CLASS object, apply the new attribute to
	the data component.
	* match.c (gfc_match_select_type): Set attr.class_ok for an
	assigned selector.
	* resolve.c (resolve_fl_variable_derived): Check a CLASS object
	is dummy, pointer or allocatable by testing the class_ok and
	the use_assoc attribute.

2009-10-17  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41629
	* gfortran.dg/class_6.f90: New test.

	PR fortran/41608
	PR fortran/41587
	* gfortran.dg/class_7.f90: New test.

	PR fortran/41618
	* gfortran.dg/class_8.f90: New test.


Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>

From-SVN: r152955
2009-10-17 18:09:25 +00:00
Janus Weil
7431bf06bc re PR fortran/41579 ([OOP] Nesting of SELECT TYPE)
2009-10-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41579
	* gfortran.h (gfc_select_type_stack): New struct, to be used as a stack
	for SELECT TYPE statements.
	(select_type_stack): New global variable.
	(type_selector,select_type_tmp): Removed.
	* match.c (type_selector,type_selector): Removed.
	(select_type_stack): New variable, serving as a stack for
	SELECT TYPE statements.
	(select_type_push,select_type_set_tmp): New functions.
	(gfc_match_select_type): Call select_type_push.
	(gfc_match_type_is): Call select_type_set_tmp.
	* parse.c (select_type_pop): New function.
	(parse_select_type_block): Call select_type_pop.
	* symbol.c (select_type_insert_tmp): New function.
	(gfc_find_sym_tree): Call select_type_insert_tmp.


2009-10-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41579
	* gfortran.dg/select_type_6.f03: New test.

From-SVN: r152600
2009-10-09 22:25:19 +02:00
Janus Weil
93d7668704 expr.c (gfc_check_pointer_assign): Do the correct type checking when CLASS variables are involved.
2009-10-07  Janus Weil  <janus@gcc.gnu.org>

	* expr.c (gfc_check_pointer_assign): Do the correct type checking when
	CLASS variables are involved.
	* match.c (gfc_match_select_type): Parse associate-name in SELECT TYPE
	statements, and set up a local namespace for the SELECT TYPE block.
	* parse.h (gfc_build_block_ns): New prototype.
	* parse.c (parse_select_type_block): Return from local namespace to its
	parent after SELECT TYPE block.
	(gfc_build_block_ns): New function for setting up the local namespace
	for a BLOCK construct.
	(parse_block_construct): Use gfc_build_block_ns.
	* resolve.c (resolve_select_type): Insert assignment for the selector
	variable, in case an associate-name is given, and put the SELECT TYPE
	statement inside a BLOCK.
	(resolve_code): Call resolve_class_assign after checking the assignment.
	* symbol.c (gfc_find_sym_tree): Moved some code here from
	gfc_get_ha_sym_tree.
	(gfc_get_ha_sym_tree): Moved some code to gfc_find_sym_tree.


2009-10-07  Janus Weil  <janus@gcc.gnu.org>

	* gfortran.dg/same_type_as_2.f03: Modified (was illegal).
	* gfortran.dg/select_type_1.f03: Modified error message.
	* gfortran.dg/select_type_5.f03: New test.

From-SVN: r152526
2009-10-07 12:54:35 +02:00
Tobias Burnus
cf2b3c22a2 re PR fortran/40996 ([F03] ALLOCATABLE scalars)
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-09-30 21:55:45 +02:00
Daniel Kraft
9abe5e56e2 re PR fortran/39626 (Correctly implement details of Fortran 2008 BLOCK construct)
2009-09-29  Daniel Kraft  <d@domob.eu>

	PR fortran/39626
	* gfortran.h (enum gfc_statement): Add ST_BLOCK and ST_END_BLOCK.
	(struct gfc_namespace): Convert flags to bit-fields and add flag
	`construct_entities' for use with BLOCK constructs.
	(enum gfc_exec_code): Add EXEC_BLOCK.
	(struct gfc_code): Add namespace field to union for EXEC_BLOCK.
	* match.h (gfc_match_block): New prototype.
	* parse.h (enum gfc_compile_state): Add COMP_BLOCK.
	* trans.h (gfc_process_block_locals): New prototype.
	(gfc_trans_deferred_vars): Made public, new prototype.
	* trans-stmt.h (gfc_trans_block_construct): New prototype.
	* decl.c (gfc_match_end): Handle END BLOCK correctly.
	(gfc_match_intent): Error if inside of BLOCK.
	(gfc_match_optional), (gfc_match_value): Ditto.
	* match.c (gfc_match_block): New routine.
	* parse.c (decode_statement): Handle BLOCK statement.
	(case_exec_markers): Add ST_BLOCK.
	(case_end): Add ST_END_BLOCK.
	(gfc_ascii_statement): Handle ST_BLOCK and ST_END_BLOCK.
	(parse_spec): Check for statements not allowed inside of BLOCK.
	(parse_block_construct): New routine.
	(parse_executable): Parse BLOCKs.
	(parse_progunit): Disallow CONTAINS in BLOCK constructs.
	* resolve.c (is_illegal_recursion): Find real container procedure and
	don't get confused by BLOCK constructs.
	(resolve_block_construct): New routine.
	(gfc_resolve_blocks), (resolve_code): Handle EXEC_BLOCK.
	* st.c (gfc_free_statement): Handle EXEC_BLOCK statements.
	* trans-decl.c (saved_local_decls): New static variable.
	(add_decl_as_local): New routine.
	(gfc_finish_var_decl): Add variable as local if inside BLOCK.
	(gfc_trans_deferred_vars): Make public.
	(gfc_process_block_locals): New routine.
	* trans-stmt.c (gfc_trans_block_construct): New routine.
	* trans.c (gfc_trans_code): Handle EXEC_BLOCK statements.

2009-09-29  Daniel Kraft  <d@domob.eu>

	PR fortran/39626
	* gfortran.dg/block_1.f08: New test.
	* gfortran.dg/block_2.f08: New test.
	* gfortran.dg/block_3.f90: New test.
	* gfortran.dg/block_4.f08: New test.
	* gfortran.dg/block_5.f08: New test.
	* gfortran.dg/block_6.f08: New test.
	* gfortran.dg/block_7.f08: New test.
	* gfortran.dg/block_8.f08: New test.

From-SVN: r152266
2009-09-29 09:42:42 +02:00
Steven G. Kargl
bbffcb7eab re PR fortran/41459 (Error not printed with -Werror and -fmax-errors=1)
2009-09-24  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/41459
	* gfortran.dg/empty_label.f: New test.
	* gfortran.dg/empty_label.f90: Ditto.
	* gfortran.dg/warnings_are_errors_1.f: Fix to emit a single warning.

2009-09-24  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/41459
	* error.c(gfc_warning_now): Move warnings_are_errors test to 
	after actual emitting of the warning.
	* parse.c (next_free): Improve error locus printing.
	(next_fixed): Change gfc_warn to gfc_warning_now, and improve
	locus reporting.

From-SVN: r152147
2009-09-24 21:53:36 +00:00
Jerry DeLisle
9cd38d51e8 re PR fortran/39229 (No warning of truncated lines if a continuation line follows)
2009-08-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/39229
	* scanner.c (next_char): Fix typo in comment.
	(gfc_get_char_literal): Warn if truncate flag is set for both fixed and
	free form source, adjusting error locus as needed.
	* parse.c (next_fixed): Clear the truncate flag.
	(next_statement): Remove truncate warning.

From-SVN: r151258
2009-09-01 03:02:07 +00:00
Janus Weil
bc21d3152f re PR fortran/40941 (gfc_typespec: put derived and cl into union)
2009-08-13  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40941
	* gfortran.h (gfc_typespec): Put 'derived' and 'cl' into union.
	* decl.c (build_struct): Make sure 'cl' is only used
	if type is BT_CHARACTER.
	* symbol.c (gfc_set_default_type): Ditto.
	* resolve.c (resolve_symbol, resolve_fl_derived): Ditto.
	(resolve_equivalence,resolve_equivalence_derived): Make sure 'derived'
	is only used if type is BT_DERIVED.
	* trans-io.c (transfer_expr): Make sure 'derived' is only used if type
	is BT_DERIVED or BT_INTEGER (special case: C_PTR/C_FUNPTR).
	* array.c: Mechanical replacements to accomodate union in gfc_typespec.
	* check.c: Ditto.
	* data.c: Ditto.
	* decl.c: Ditto.
	* dump-parse-tree.c: Ditto.
	* expr.c: Ditto.
	* interface.c: Ditto.
	* iresolve.c: Ditto.
	* match.c: Ditto.
	* misc.c: Ditto.
	* module.c: Ditto.
	* openmp.c: Ditto.
	* parse.c: Ditto.
	* primary.c: Ditto.
	* resolve.c: Ditto.
	* simplify.c: Ditto.
	* symbol.c: Ditto.
	* target-memory.c: Ditto.
	* trans-array.c: Ditto.
	* trans-common.c: Ditto.
	* trans-const.c: Ditto.
	* trans-decl.c: Ditto.
	* trans-expr.c: Ditto.
	* trans-intrinsic.c: Ditto.
	* trans-io.c: Ditto.
	* trans-stmt.c: Ditto.
	* trans-types.c: Ditto.

From-SVN: r150725
2009-08-13 21:46:46 +02:00
Paul Thomas
3af8d8cb86 re PR fortran/40011 (Problems with -fwhole-file)
2009-08-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40011
	* error.c : Add static flag 'warnings_not_errors'.
	(gfc_error): If 'warnings_not_errors' is set, branch to code
	from gfc_warning.
	(gfc_clear_error): Reset 'warnings_not_errors'.
	(gfc_errors_to_warnings): New function.
	* options.c (gfc_post_options): If pedantic and flag_whole_file
	change the latter to a value of 2.
	* parse.c (parse_module): Add module namespace to gsymbol.
	(resolve_all_program_units): New function.
	(clean_up_modules): New function.
	(translate_all_program_units): New function.
	(gfc_parse_file): If whole_file, do not clean up module right
	away and add derived types to namespace derived types. In
	addition, call the three new functions above.
	* resolve.c (not_in_recursive): New function.
	(not_entry_self_reference): New function.
	(resolve_global_procedure): Symbol must not be IFSRC_UNKNOWN,
	procedure must not be in the course of being resolved and
	must return false for the two new functions. Pack away the
	current derived type list before calling gfc_resolve for the
	gsymbol namespace.  It is unconditionally an error if the ranks
	of the reference and ther procedure do not match. Convert
	errors to warnings during call to gfc_procedure_use if not
	pedantic or legacy.
	(gfc_resolve): Set namespace resolved flag to -1 during
	resolution and store current cs_base.
	* trans-decl.c (gfc_get_symbol_decl): If whole_file compilation
	substitute a use associated variable, if it is available in a
	gsymbolnamespace.
	(gfc_get_extern_function_decl): If the procedure is use assoc,
	do not attempt to find it in a gsymbol because it could be an
	interface. If the symbol exists in a module namespace, return
	its backend_decl.
	* trans-expr.c (gfc_trans_scalar_assign): If a derived type
	assignment, set the rhs TYPE_MAIN_VARIANT to that of the rhs.
	* trans-types.c (copy_dt_decls_ifequal): Add 'from_gsym' as a
	boolean argument. Copy component backend_decls directly if the
	components are derived types and from_gsym is true.
	(gfc_get_derived_type): If whole_file copy the derived type from
	the module if it is use associated, otherwise, if can be found
	in another gsymbol namespace, use the existing derived type as
	the TYPE_CANONICAL and build normally.
	* gfortran.h : Add derived_types and resolved fields to
	gfc_namespace. Include prototype for gfc_errors_to_warnings.

2009-08-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40011
	* gfortran.dg/whole_file_7.f90: New test.
	* gfortran.dg/whole_file_8.f90: New test.
	* gfortran.dg/whole_file_9.f90: New test.
	* gfortran.dg/whole_file_10.f90: New test.
	* gfortran.dg/whole_file_11.f90: New test.
	* gfortran.dg/whole_file_12.f90: New test.
	* gfortran.dg/whole_file_13.f90: New test.
	* gfortran.dg/whole_file_14.f90: New test.

From-SVN: r150333
2009-08-01 13:45:12 +00:00
Tobias Burnus
08a6b8e049 re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28  Tobias Burnus  <burnus@net-b.de>
	    Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR fortran/34112
	* symbol.c (gfc_add_ext_attribute): New function.
	(gfc_get_sym_tree): New argument allow_subroutine.
	(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
	gen_shape_param,generate_isocbinding_symbol): Use it.
	* decl.c (find_special): New argument allow_subroutine.
	(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
	match_procedure_in_type,gfc_match_final_decl): Use it.
	(gfc_match_gcc_attributes): New function.
	* gfortran.texi (Mixed-Language Programming): New section
	"GNU Fortran Compiler Directives".
	* gfortran.h (ext_attr_t): New struct.
	(symbol_attributes): Use it.
	(gfc_add_ext_attribute): New prototype.
	(gfc_get_sym_tree): Update pototype.
	* expr.c (gfc_check_pointer_assign): Check whether call
	convention is the same.
	* module.c (import_iso_c_binding_module, create_int_parameter,
	use_iso_fortran_env_module): Update gfc_get_sym_tree call.
	* scanner.c (skip_gcc_attribute): New function.
	(skip_free_comments,skip_fixed_comments): Use it.
	(gfc_next_char_literal): Support !GCC$ lines.
	* resolve.c (check_host_association): Update
	gfc_get_sym_tree call.
	* match.c (gfc_match_sym_tree,gfc_match_call): Update
	gfc_get_sym_tree call.
	* trans-decl.c (add_attributes_to_decl): New function.
	(gfc_get_symbol_decl,get_proc_pointer_decl,
	gfc_get_extern_function_decl,build_function_decl: Use it.
	* match.h (gfc_match_gcc_attributes): Add prototype.
	* parse.c (decode_gcc_attribute): New function.
	(next_free,next_fixed): Support !GCC$ lines.
	* primary.c (match_actual_arg,check_for_implicit_index,
	gfc_match_rvalue,gfc_match_rvalue): Update
	gfc_get_sym_tree call.

2009-06-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/34112
	* gfortran.dg/compiler-directive_1.f90: New test.
	* gfortran.dg/compiler-directive_2.f: New test.


Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>

From-SVN: r149036
2009-06-28 19:56:41 +02:00
Steven G. Kargl
a513927a5b gfortran.h (gfc_code): Rename struct member expr to expr1.
2009-05-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.h (gfc_code): Rename struct member expr to expr1.
	* openmp.c (resolve_omp_atomic): Update expr to expr1.
	* interface.c (gfc_extend_assign): Ditto.
	* trans-expr.c (gfc_conv_expr_reference, gfc_trans_assignment,
	gfc_trans_init_assign): Ditto.
	* dump-parse-tree.c (show_code_node): Ditto.
	* trans-openmp.c (gfc_trans_omp_atomic): Ditto.
	* trans-stmt.c ( gfc_trans_label_assign, gfc_trans_goto, gfc_trans_call,
	gfc_trans_return, gfc_trans_pause, gfc_trans_stop, gfc_trans_if_1,
	gfc_trans_arithmetic_if, gfc_trans_do_while, gfc_trans_integer_select,
	gfc_trans_logical_select, gfc_trans_character_select
	forall_make_variable_temp, check_forall_dependencies
	gfc_trans_forall_1, gfc_trans_where_2, gfc_trans_where_3
	gfc_trans_where, gfc_trans_allocate, gfc_trans_deallocate): Ditto.
	* io.c (match_io_element, gfc_match_inquire): Ditto.
	* resolve.c (resolve_typebound_call, resolve_ppc_call,
	resolve_allocate_expr, resolve_allocate_deallocate, resolve_select,
	resolve_transfer, resolve_where, gfc_resolve_assign_in_forall,
	gfc_resolve_blocks, resolve_code, build_init_assign): Ditto.
	* st.c (gfc_free_statement): Ditto.
	* match.c (gfc_match_assignment, gfc_match_pointer_assignment,
	match_arithmetic_if, gfc_match_if, gfc_match_elseif
	gfc_match_stopcode, gfc_match_assign, gfc_match_goto,
	gfc_match_nullify, match_typebound_call, gfc_match_call
	gfc_match_select, match_simple_where, gfc_match_where
	gfc_match_elsewhere, match_simple_forall, gfc_match_forall): Ditto.
	* trans-io.c (gfc_trans_transfer): Ditto.
	* parse.c (parse_where_block, parse_if_block): Ditto.

From-SVN: r147497
2009-05-13 20:49:13 +00:00
Steven G. Kargl
79bd194804 gfortran.h (gfc_code): Rename struct member label to label1.
2009-05-12  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.h (gfc_code): Rename struct member label to label1.
	* dump-parse-tree.c (show_code_node): Update symbol.
	* trans-stmt.c (gfc_trans_label_assign, gfc_trans_goto,
	gfc_trans_arithmetic_if)": Ditto.
	* resolve.c (gfc_resolve_blocks, resolve_code): Ditto.
	* match.c (match_arithmetic_if, gfc_match_if, gfc_reference_st_label,
	gfc_match_assign, gfc_match_goto): Ditto.
	* parse.c (parse_do_block): Ditto.

From-SVN: r147489
2009-05-13 16:17:59 +00:00
Tobias Burnus
5c71a5e0e9 re PR fortran/34153 (Debugging: Cannot set breakpoint in comment lines or "END PROGRAM")
2009-05-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34153
        * gfortran.h (gfc_exec_op): Add EXEC_END_PROCEDURE.
        * dump-parse-tree.c (show_code_node): Use EXEC_END_PROCEDURE.
        * trans.c (gfc_trans_code): Ditto.
        * resolve.c (resolve_code): Ditto.
        * st.c (gfc_free_statement): Ditto.

From-SVN: r147477
2009-05-13 16:52:54 +02:00
Ian Lance Taylor
24b97832e7 basic-block.h (enum profile_status): Break out of struct control_flow_graph.
./:	* basic-block.h (enum profile_status): Break out of struct
	control_flow_graph.
	* cgraph.h (struct inline_summary): Break out of struct
	cgraph_local_info.
	* cgraphunit.c (enum cgraph_order_sort_kind): New enum, broken out
	of struct cgraph_order_sort.
	* combine.c (enum undo_kind): New enum, broken out of struct
	undo.
	* cse.c (struct branch_path): Break out of struct
	cse_basic_block_data.
	* except.h (enum eh_region_type): Break out of struct eh_region.
	* gcc.c (enum add_del): Break out of struct modify_target.
	* genrecog.c (enum decision_type): Break out of struct
	decision_test.
	* ggc-page.c (struct ggc_pch_ondisk): Break out of struct
	ggc_pch_data.
	* matrix-reorg.c (struct free_info): Break out of struct
	matrix_info.
	* regmove.c (enum match_use): New enum, broken out of struct
	match.
	* sched-int.h (enum post_call_group): New enum, broken out of
	struct deps.
	(struct deps_reg): Break out of struct deps.
	* target.h (struct asm_int_op): Break out of struct gcc_target.
	* tree-eh.c (struct goto_queue_node): Break out of struct
	leh_tf_state.
	* tree-inline.h (enum copy_body_cge_which): Break out of
	copy_body_data.
	* tree-pass.h (enum opt_pass_type): Break out of struct opt_pass.

	* c-decl.c (in_struct, struct_types): New static variables.
	(pushtag): Add loc parameter.  Change all callers.
	(lookup_tag): Add ploc parameter.  Change all callers.
	(check_compound_literal_type): New function.
	(parser_xref_tag): Add loc parameter.  Change all callers.  If
	-Wc++-compat, warn about struct/union/enum types defined within a
	struct or union.
	(start_struct): Add enclosing_in_struct, enclosing_struct_types,
	and loc parameters.  Change all callers.  Change error calls to
	error_at, using loc.  For a redefinition, if the location of the
	original definition is known, report it.  Set in_struct and
	struct_types.  If -Wc++-compat warn if in sizeof, typeof, or
	alignof.
	(finish_struct): Add new parameters enclosing_in_struct and
	enclosing_struct_types.  Change all callers.  Set
	C_TYPE_DEFINED_IN_STRUCT for all struct/union/enum types defined
	in the struct.  If in a struct, add this struct to struct_types.
	(start_enum): Add loc parameter.  Change all callers.  Use
	error_at for errors, using loc.  For a redefinition, if the
	location of the original definition is known, report it.  If in a
	struct, add this enum type to struct_types.  If -Wc++-compat warn
	if in sizeof, typeof, or alignof.
	* c-parser.c (disable_extension_diagnostics): Disable
	-Wc++-compat.
	(enable_extension_diagnostics): Reenable -Wc++-compat if
	appropriate.
	(c_parser_enum_specifier): Get enum location for start_enum.
	(c_parser_struct_or_union_specifier): Get struct location for
	start_struct.  Save in_struct and struct_types status between
	start_struct and finish_struct.
	(c_parser_cast_expression): Get location of cast.
	(c_parser_alignof_expression): Get location of type.
	(c_parser_postfix_expression): Likewise.
	(c_parser_postfix_expression_after_paren_type): Add type_loc
	parameter.  Change all callers.  Call
	check_compound_literal_type.  Use type_loc for error about
	variable size type.
	* c-typeck.c (build_external_ref): If -Wc++-compat, warn about a
	use of an enum constant from an enum type defined in a struct or
	union.
	(c_cast_expr): Add loc parameter.  Change all callers.  If
	-Wc++-compat, warn about defining a type in a cast.
	* c-tree.h (C_TYPE_DEFINED_IN_STRUCT): Define.
	(start_enum, start_struct, finish_struct): Update declarations.
	(parser_xref_tag, c_cast_expr): Update declarations.
	(check_compound_literal_type): Declare.
fortran/:
	* gfortran.h (enum gfc_omp_sched_kind): New enum, broken out of
	gfc_omp_clauses.
	(enum gfc_omp_default_sharing): Likewise.
	* module.c (enum gfc_rsym_state): New enum, broken out of
	pointer_info.
	(enum gfc_wsym_state): Likewise.
	* parse.c (enum state_order): New enum, broken out of st_state.
objc/:
	* objc-act.c (objc_building_struct): New static variable.
	(objc_in_struct, objc_struct_types): New static variables.
	(objc_start_struct, objc_finish_struct): New static functions.
	(generate_struct_by_value_array): Call objc_start_struct instead
	of start_struct, and call objc_finish_struct instead of
	finish_struct.
	(objc_build_struct, build_objc_symtab_template): Likewise.
	(build_module_descriptor): Likewise.
	(build_next_objc_exception_stuff): Likewise.
	(build_protocol_template): Likewise.
	(build_method_prototype_list_template): Likewise.
	(build_method_prototype_template): Likewise.
	(build_category_template, build_selector_template): Likewise.
	(build_class_template, build_super_template): Likewise.
	(build_ivar_template, build_ivar_list_template): Likewise.
	(build_method_list_template): Likewise.
	(build_method_template): Likewise.
objcp/:
	* objcp-decl.h (start_struct): Add three new, ignored, macro
	parameters.
	(finish_struct): Add two new, ignored, macro parameters.
testsuite/:
	* gcc.dg/Wcxx-compat-7.c: New testcase.
	* gcc.dg/Wcxx-compat-8.c: New testcase.
	* gcc.dg/c99-tag-1.c: Recognize new "originally defined here"
	notes
	* gcc.dg/pr17188-1.c: Likewise.
	* gcc.dg/pr39084.c: Likewise.

From-SVN: r147358
2009-05-11 01:02:40 +00:00
Janus Weil
713485cc67 re PR fortran/39630 ([F03] Procedure Pointer Components)
2009-05-06  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/39630
	* decl.c (match_procedure_interface): New function to match the
	interface for a PROCEDURE statement.
	(match_procedure_decl): Call match_procedure_interface.
	(match_ppc_decl): New function to match the declaration of a
	procedure pointer component.
	(gfc_match_procedure):  Call match_ppc_decl.
	(match_binding_attributes): Add new argument 'ppc' and handle the
	POINTER attribute for procedure pointer components.
	(match_procedure_in_type,gfc_match_generic): Added new argument to
	match_binding_attributes.
	* dump-parse-tree.c (show_expr,show_components,show_code_node): Handle
	procedure pointer components.
	* expr.c (free_expr0,gfc_copy_expr,gfc_simplify_expr): Handle EXPR_PPC.
	(gfc_check_pointer_assign): Handle procedure pointer components, but no
	full checking yet.
	(is_proc_ptr_comp): New function to determine if an expression is a
	procedure pointer component.
	* gfortran.h (expr_t): Add EXPR_PPC.
	(symbol_attribute): Add new member 'proc_pointer_comp'.
	(gfc_component): Add new member 'formal'.
	(gfc_exec_op): Add EXEC_CALL_PPC.
	(gfc_get_default_type): Changed first argument.
	(is_proc_ptr_comp): Add prototype.
	(gfc_match_varspec): Add new argument.
	* interface.c (compare_actual_formal): Handle procedure pointer
	components.
	* match.c (gfc_match_pointer_assignment,match_typebound_call): Handle
	procedure pointer components.
	* module.c (mio_expr): Handle EXPR_PPC.
	* parse.c (parse_derived): Handle procedure pointer components.
	* primary.c (gfc_match_varspec): Add new argument 'ppc_arg' and handle
	procedure pointer components.
	(gfc_variable_attr): Handle procedure pointer components.
	(gfc_match_rvalue): Added new argument to gfc_match_varspec and changed
	first argument of gfc_get_default_type.
	(match_variable): Added new argument to gfc_match_varspec.
	* resolve.c (resolve_entries,set_type,resolve_fl_parameter): Changed
	first argument of gfc_get_default_type.
	(resolve_structure_cons,resolve_actual_arglist): Handle procedure
	pointer components.
	(resolve_ppc_call): New function to resolve a call to a procedure
	pointer component (subroutine).
	(resolve_expr_ppc): New function to resolve a call to a procedure
	pointer component (function).
	(gfc_resolve_expr): Handle EXPR_PPC.
	(resolve_code): Handle EXEC_CALL_PPC.
	(resolve_fl_derived): Copy the interface for a procedure pointer
	component.
	(resolve_symbol): Fix overlong line.
	* st.c (gfc_free_statement): Handle EXEC_CALL_PPC.
	* symbol.c (gfc_get_default_type): Changed first argument.
	(gfc_set_default_type): Changed first argument of gfc_get_default_type.
	(gfc_add_component): Initialize ts.type to BT_UNKNOWN.
	* trans.h (gfc_conv_function_call): Renamed.
	* trans.c (gfc_trans_code): Handle EXEC_CALL_PPC.
	* trans-expr.c (gfc_conv_component_ref): Ditto.
	(gfc_conv_function_val): Rename to 'conv_function_val', add new
	argument 'expr' and handle procedure pointer components.
	(gfc_conv_operator_assign): Renamed gfc_conv_function_val.
	(gfc_apply_interface_mapping_to_expr): Handle EXPR_PPC.
	(gfc_conv_function_call): Rename to 'gfc_conv_procedure_call', add new
	argument 'expr' and handle procedure pointer components.
	(gfc_get_proc_ptr_comp): New function to get the backend decl for a
	procedure pointer component.
	(gfc_conv_function_expr): Renamed gfc_conv_function_call.
	(gfc_conv_structure): Handle procedure pointer components.
	* trans-intrinsic.c (gfc_conv_intrinsic_funcall,
	conv_generic_with_optional_char_arg): Renamed gfc_conv_function_call.
	* trans-stmt.h (gfc_get_proc_ptr_comp): Add prototype.
	* trans-stmt.c (gfc_trans_call): Renamed gfc_conv_function_call.
	* trans-types.h (gfc_get_ppc_type): Add prototype.
	* trans-types.c (gfc_get_ppc_type): New function to build a tree node
	for a procedure pointer component.
	(gfc_get_derived_type): Handle procedure pointer components.


2009-05-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39630
	* gfortran.dg/proc_decl_1.f90: Modified.
	* gfortran.dg/proc_ptr_comp_1.f90: New.
	* gfortran.dg/proc_ptr_comp_2.f90: New.
	* gfortran.dg/proc_ptr_comp_3.f90: New.
	* gfortran.dg/proc_ptr_comp_4.f90: New.
	* gfortran.dg/proc_ptr_comp_5.f90: New.
	* gfortran.dg/proc_ptr_comp_6.f90: New.


Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>

From-SVN: r147206
2009-05-06 23:17:16 +02:00
Janus Weil
6596e2fe5a re PR fortran/39930 (Bogus error: ambiguous reference)
2009-04-28  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39930
	PR fortran/39931
	* expr.c (gfc_check_pointer_assign): Correctly detect if the left hand
	side is a pointer.
	* parse.c (gfc_fixup_sibling_symbols): Don't check for ambiguity.


2009-04-28  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39930
	PR fortran/39931
	* gfortran.dg/ambiguous_reference_2.f90: New.
	* gfortran.dg/pointer_assign_7.f90: New.

From-SVN: r146880
2009-04-28 11:44:36 +02:00
Janus Weil
3070bab4c9 re PR fortran/36704 (Procedure pointer as function result)
2009-04-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/36704
	* decl.c (add_hidden_procptr_result): New function for handling
	procedure pointer return values by adding a hidden result variable.
	(variable_decl,match_procedure_decl,gfc_match_function_decl,
	gfc_match_subroutine,gfc_match_end,attr_decl1): Handle procedure pointer
	return values.
	* parse.c (parse_interface): Add EXTERNAL attribute only after
	FUNCTION/SUBROUTINE declaration is complete.
	* primary.c (replace_hidden_procptr_result): New function for replacing
	function symbol by hidden result variable.
	(gfc_match_rvalue,match_variable): Replace symbol by hidden result
	variable.
	* resolve.c (resolve_contained_fntype,resolve_function,resolve_variable,
	resolve_symbol): Allow for procedure pointer function results.
	(resolve_fl_procedure): Conflict detection moved here from
	'check_conflict'.
	* symbol.c (gfc_check_function_type): Allow for procedure pointer
	function results.
	(check_conflict): Move some conflict detection to resolution stage.
	* trans-types.c (gfc_sym_type,gfc_get_function_type): Handle hidden
	result variables.


2009-04-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/36704
	* gfortran.dg/external_procedures_1.f90: Modified.
	* gfortran.dg/proc_ptr_result_1.f90: New.
	* gfortran.dg/proc_ptr_result_2.f90: New.
	* gfortran.dg/proc_ptr_result_3.f90: New.

From-SVN: r145815
2009-04-09 11:39:09 +02:00
Paul Thomas
71a7778cd9 re PR fortran/22571 (Reject derived types for dummy arguments declared in the subroutine unless they are SEQUENCE)
2009-03-30  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/22571
	PR fortran/26227
	PR fortran/24886
	* symbol.c : Add gfc_global_ns_list.
	* decl.c (add_global_entry): Set the namespace ('ns') field.
	* gfortran.h : Add the resolved field to gfc_namespace. Add the
	namespace ('ns') field to gfc_gsymbol.  Add flag_whole_file to
	gfc_option_t.  Add the prototype for gfc_free_dt_list.
	* lang.opt : Add the whole-file option.
	* invoke.texi : Document the whole-file option.
	* resolve.c (resolve_global_procedure): If the fwhole-file
	option is set, reorder gsymbols to ensure that translation is
	in the right order.  Resolve the gsymbol's namespace if that
	has not occurred and then check interfaces.
	(resolve_function): Move call to resolve_global_procedure.
	(resolve_call): The same.
	(resolve_codes): Store the current labels_obstack.
	(gfc_resolve) : Return if the namespace is already resolved.
	trans-decl.c (gfc_get_extern_function_decl): If the whole_file
	option is selected, use the backend_decl of a gsymbol, if it is
	available.
	parse.c (add_global_procedure, add_global_program): If the flag
	whole-file is set, add the namespace to the gsymbol.
	(gfc_parse_file): On -fwhole-file, put procedure namespaces on
	the global namespace list.  Rearrange to do resolution of all
	the procedures in a file, followed by their translation.
	* options.c (gfc_init_options): Add -fwhole-file.
	(gfc_handle_option): The same.

2009-03-30  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/22571
	* gfortran.dg/whole_file_1.f90: New test.
	PR fortran/26227
	* gfortran.dg/whole_file_2.f90: New test.
	* gfortran.dg/whole_file_3.f90: New test.
	PR fortran/24886
	* gfortran.dg/whole_file_4.f90: New test.

From-SVN: r145314
2009-03-30 19:35:14 +00:00
Tobias Schlüter
d80c695ff0 re PR fortran/38507 (Bogus Warning: Deleted feature: GOTO jumps to END of construct)
fortran/
PR fortran/38507
* gfortran.h (gfc_st_label): Fix comment.
(gfc_exec_op): Add statement code EXEC_END_BLOCK for end of block.
* parse.c (accept_statement): Use EXEC_END_BLOCK for END IF and
END SELECT with labels.
(check_do_closure): Fix formatting.
(parse_do_block): Fix typo in error message.
* resolve.c (code_stack): Remove tail member.  Update comment to
new use of reachable_labels.
(reachable_labels): Rename to ...
(find_reachable_labels): ... this.  Overhaul.  Update preceding
comment.
(resolve_branch): Fix comment preceding function.  Rewrite.
(resolve_code): Update call to find_reachable_labels.  Add code to
deal with EXEC_END_BLOCK.
* st.c (gfc_free_statement): Add code to deal with EXEC_END_BLOCK.
* trans.c (gfc_trans_code): Likewise.
testsuite/
* do_4.f: New.
* goto_2.f90: Correct expected warnings.
* goto_4.f90: Likewise.
* goto_5.f90: New.

From-SVN: r145245
2009-03-29 19:15:48 +02:00