Commit Graph

253 Commits

Author SHA1 Message Date
Janus Weil 8fb74da43b re PR fortran/32580 (iso_c_binding c_f_procpointer / procedure pointers)
2008-07-02  Janus Weil  <janus@gcc.gnu.org>
	    Tobias Burnus  <burnus@net-b.de>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/32580
	* gfortran.h (struct gfc_symbol): New member "proc_pointer".
	* check.c (gfc_check_associated,gfc_check_null): Implement
	procedure pointers.
	* decl.c (match_procedure_decl): Ditto.
	* expr.c (gfc_check_pointer_assign,gfc_check_assign_symbol): Ditto.
	* interface.c (compare_actual_formal): Ditto.
	* match.h: Ditto.
	* match.c (gfc_match_pointer_assignment): Ditto.
	* parse.c (parse_interface): Ditto.
	* primary.c (gfc_match_rvalue,match_variable): Ditto.
	* resolve.c (resolve_fl_procedure): Ditto.
	* symbol.c (check_conflict,gfc_add_external,gfc_add_pointer,
	gfc_copy_attr,gen_fptr_param,build_formal_args): Ditto.
	* trans-decl.c (get_proc_pointer_decl,gfc_get_extern_function_decl,
	create_function_arglist): Ditto.
	* trans-expr.c (gfc_conv_variable,gfc_conv_function_val,
	gfc_conv_function_call,gfc_trans_pointer_assignment): Ditto.


2008-07-02  Janus Weil  <janus@gcc.gnu.org>
	    Tobias Burnus  <burnus@net-b.de>

	PR fortran/32580
	* gfortran.dg/c_f_pointer_tests_3.f90: Updated.
	* gfortran.dg/proc_decl_1.f90: Updated.
	* gfortran.dg/proc_ptr_1.f90: New.
	* gfortran.dg/proc_ptr_2.f90: New.
	* gfortran.dg/proc_ptr_3.f90: New.
	* gfortran.dg/proc_ptr_4.f90: New.
	* gfortran.dg/proc_ptr_5.f90: New.
	* gfortran.dg/proc_ptr_6.f90: New.
	* gfortran.dg/proc_ptr_7.f90: New.
	* gfortran.dg/proc_ptr_8.f90: New.

Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r137386
2008-07-02 21:53:37 +02:00
Kaveh R. Ghazi ece3f6639d arith.c (hollerith2representation): Fix for -Wc++-compat.
* arith.c (hollerith2representation): Fix for -Wc++-compat.
	* array.c (gfc_get_constructor): Likewise.
	* decl.c (gfc_get_data_variable, gfc_get_data_value, gfc_get_data,
	create_enum_history, gfc_match_final_decl): Likewise.
	* error.c (error_char): Likewise.
	* expr.c (gfc_get_expr, gfc_copy_expr): Likewise.
	* gfortran.h (gfc_get_charlen, gfc_get_array_spec,
	gfc_get_component, gfc_get_formal_arglist, gfc_get_actual_arglist,
	gfc_get_namelist, gfc_get_omp_clauses, gfc_get_interface,
	gfc_get_common_head, gfc_get_dt_list, gfc_get_array_ref,
	gfc_get_ref, gfc_get_equiv, gfc_get_case, gfc_get_iterator,
	gfc_get_alloc, gfc_get_wide_string): Likewise.
	* interface.c (count_types_test): Likewise.
	* intrinsic.c (add_char_conversions, gfc_intrinsic_init_1):
	Likewise.
	* io.c (gfc_match_open, gfc_match_close, match_filepos, match_io,
	gfc_match_inquire, gfc_match_wait): Likewise.
	* match.c (gfc_match, match_forall_iterator): Likewise.
	* module.c (gfc_get_pointer_info, gfc_get_use_rename, add_fixup,
	add_true_name, parse_string, write_atom, quote_string,
	mio_symtree_ref, mio_gmp_real, write_common_0): Likewise.
	* options.c (gfc_post_options): Likewise.
	* primary.c (match_integer_constant, match_hollerith_constant,
	match_boz_constant, match_real_constant,
	gfc_get_structure_ctor_component, gfc_match_structure_constructor): Likewise.
	* scanner.c (gfc_widechar_to_char, add_path_to_list,
	add_file_change, load_line, get_file, preprocessor_line,
	load_file, unescape_filename, gfc_read_orig_filename): Likewise.
	* simplify.c (gfc_simplify_ibits, gfc_simplify_ishft,
	gfc_simplify_ishftc): Likewise.
	* symbol.c (gfc_get_st_label, gfc_get_namespace, gfc_new_symtree,
	gfc_get_uop, gfc_new_symbol, save_symbol_data, gfc_get_gsymbol):
	Likewise.
	* target-memory.c (gfc_target_interpret_expr): Likewise.
	* trans-const.c (gfc_build_wide_string_const): Likewise.
	* trans-expr.c (gfc_add_interface_mapping): Likewise.
	* trans-intrinsic.c (gfc_conv_intrinsic_conversion,
	gfc_conv_intrinsic_int, gfc_conv_intrinsic_lib_function,
	gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_ctime,
	gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam,
	gfc_conv_intrinsic_minmax, gfc_conv_intrinsic_minmax_char,
	gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_index_scan_verify,
	gfc_conv_intrinsic_merge, gfc_conv_intrinsic_trim): Likewise.
	* trans.c (gfc_get_backend_locus): Likewise.
	* trans.h (gfc_get_ss): Likewise.

From-SVN: r136982
2008-06-20 06:03:16 +00:00
Daniel Kraft 88fec49fbb re PR fortran/36112 (Bounds-checking on character length not working for array-constructors)
2008-06-17  Daniel Kraft  <d@domob.eu>

	PR fortran/36112
	* array.c (gfc_resolve_character_array_constructor):  Check that all
	elements with constant character length have the same one rather than
	fixing it if no typespec is given, emit an error if they don't.  Changed
	return type to "try" and return FAILURE for the case above.
	(gfc_resolve_array_constructor):  Removed unneeded call to
	gfc_resolve_character_array_constructor in this function.
	* gfortran.h (gfc_resolve_character_array_constructor):  Returns try.
	* trans-array.c (get_array_ctor_strlen):  Return length of first element
	rather than last element.
	* resolve.c (gfc_resolve_expr):  Handle FAILURE return from
	gfc_resolve_character_array_constructor.

2008-06-17  Daniel Kraft  <d@domob.eu>

	PR fortran/36112
	* gfortran.dg/bounds_check_array_ctor_1.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_2.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_3.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_4.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_5.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_6.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_7.f90:  New test.
	* gfortran.dg/bounds_check_array_ctor_8.f90:  New test.
	* gfortran.dg/arrayio_0.f90:  Fixed invalid array constructor.
	* gfortran.dg/char_cons_len.f90:  Ditto.
	* gfortran.dg/char_initializer_actual.f90:  Ditto.
	* gfortran.dg/pr15959.f90:  Ditto.
	* gfortran.dg/transfer_simplify_2.f90:  Ditto.
	* gfortran.dg/char_length_1.f90:  Changed expected error messages.

From-SVN: r136872
2008-06-17 22:24:20 +02:00
Jakub Jelinek a68ab35173 c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805.
* c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to
	200805.
	* langhooks.h (struct lang_hooks_for_decls): Add omp_finish_clause.
	Add omp_private_outer_ref hook, add another argument to
	omp_clause_default_ctor hook.
	* langhooks-def.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define.
	(LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define.
	(LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR): Change to
	hook_tree_tree_tree_tree_null.
	(LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_FINISH_CLAUSE and
	LANG_HOOKS_OMP_PRIVATE_OUTER_REF.
	* hooks.c (hook_tree_tree_tree_tree_null): New function.
	* hooks.h (hook_tree_tree_tree_tree_null): New prototype.
	* tree.def (OMP_TASK): New tree code.
	* tree.h (OMP_TASK_COPYFN, OMP_TASK_ARG_SIZE, OMP_TASK_ARG_ALIGN,
	OMP_CLAUSE_PRIVATE_OUTER_REF, OMP_CLAUSE_LASTPRIVATE_STMT,
	OMP_CLAUSE_COLLAPSE_ITERVAR, OMP_CLAUSE_COLLAPSE_COUNT,
	OMP_TASKREG_CHECK, OMP_TASKREG_BODY, OMP_TASKREG_CLAUSES,
	OMP_TASKREG_FN, OMP_TASKREG_DATA_ARG, OMP_TASK_BODY,
	OMP_TASK_CLAUSES, OMP_TASK_FN, OMP_TASK_DATA_ARG,
	OMP_CLAUSE_COLLAPSE_EXPR): Define.
	(enum omp_clause_default_kind): Add OMP_CLAUSE_DEFAULT_FIRSTPRIVATE.
	(OMP_DIRECTIVE_P): Add OMP_TASK.
	(OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): New clause codes.
	(OMP_CLAUSE_SCHEDULE_AUTO): New schedule kind.
	* tree.c (omp_clause_code_name): Add OMP_CLAUSE_COLLAPSE
	and OMP_CLAUSE_UNTIED entries.
	(omp_clause_num_ops): Likewise.  Increase OMP_CLAUSE_LASTPRIVATE
	num_ops to 2.
	(walk_tree_1): Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED.
	Walk OMP_CLAUSE_LASTPRIVATE_STMT.
	* tree-pretty-print.c (dump_omp_clause): Handle
	OMP_CLAUSE_SCHEDULE_AUTO, OMP_CLAUSE_UNTIED, OMP_CLAUSE_COLLAPSE,
	OMP_CLAUSE_DEFAULT_FIRSTPRIVATE.
	(dump_generic_node): Handle OMP_TASK and collapsed OMP_FOR loops.
	* c-omp.c (c_finish_omp_for): Allow pointer iterators.  Remove
	warning about unsigned iterators.  Change decl/init/cond/incr
	arguments to TREE_VECs, check arguments for all collapsed loops.
	(c_finish_omp_taskwait): New function.
	(c_split_parallel_clauses): Put OMP_CLAUSE_COLLAPSE clause to
	ws_clauses.
	* c-parser.c (c_parser_omp_for_loop): Parse collapsed loops.  Call
	default_function_array_conversion on init.  Add par_clauses argument.
	If decl is present in parallel's lastprivate clause, change it to
	shared and add lastprivate clause for decl to OMP_FOR_CLAUSES.
	Add clauses argument, on success set OMP_FOR_CLAUSES to it.  Look up
	collapse count in clauses.
	(c_parser_omp_for, c_parser_omp_parallel): Adjust
	c_parser_omp_for_loop callers.
	(OMP_FOR_CLAUSE_MASK): Add 1 << PRAGMA_OMP_CLAUSE_COLLAPSE.
	(c_parser_pragma): Handle PRAGMA_OMP_TASKWAIT.
	(c_parser_omp_clause_name): Handle collapse and untied clauses.
	(c_parser_omp_clause_collapse, c_parser_omp_clause_untied): New
	functions.
	(c_parser_omp_clause_schedule): Handle schedule(auto).
	Include correct location in the error message.
	(c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE
	and PRAGMA_OMP_CLAUSE_UNTIED.
	(OMP_TASK_CLAUSE_MASK): Define.
	(c_parser_omp_task, c_parser_omp_taskwait): New functions.
	(c_parser_omp_construct): Handle PRAGMA_OMP_TASK.
	* tree-nested.c (convert_nonlocal_omp_clauses,
	convert_local_omp_clauses): Handle OMP_CLAUSE_LASTPRIVATE_STMT,
	OMP_CLAUSE_REDUCTION_INIT, OMP_CLAUSE_REDUCTION_MERGE,
	OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED.
	Don't handle TREE_STATIC or DECL_EXTERNAL VAR_DECLs in
	OMP_CLAUSE_DECL.
	(conver_nonlocal_reference, convert_local_reference,
	convert_call_expr): Handle OMP_TASK the same as OMP_PARALLEL.  Use
	OMP_TASKREG_* macros rather than OMP_PARALLEL_*.
	(walk_omp_for): Adjust for OMP_FOR_{INIT,COND,INCR} changes.
	* tree-gimple.c (is_gimple_stmt): Handle OMP_TASK.
	* c-tree.h (c_begin_omp_task, c_finish_omp_task): New prototypes.
	* c-pragma.h (PRAGMA_OMP_TASK, PRAGMA_OMP_TASKWAIT): New.
	(PRAGMA_OMP_CLAUSE_COLLAPSE, PRAGMA_OMP_CLAUSE_UNTIED): New.
	* c-typeck.c (c_begin_omp_task, c_finish_omp_task): New functions.
	(c_finish_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and
	OMP_CLAUSE_UNTIED.
	* c-pragma.c (init_pragma): Init omp task and omp taskwait pragmas.
	* c-common.h (c_finish_omp_taskwait): New prototype.
	* gimple-low.c (lower_stmt): Handle OMP_TASK.
	* tree-parloops.c (create_parallel_loop): Create 1 entry
	vectors for OMP_FOR_{INIT,COND,INCR}.
	* tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers.
	(make_edges): Handle OMP_TASK.
	* tree-ssa-operands.c (get_expr_operands): Handle collapsed OMP_FOR
	loops, adjust for OMP_FOR_{INIT,COND,INCR} changes.
	* tree-inline.c (estimate_num_insns_1): Handle OMP_TASK.
	* builtin-types.def (BT_PTR_ULONGLONG, BT_PTR_FN_VOID_PTR_PTR,
	BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR,
	BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
	BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New.
	* omp-builtins.def (BUILT_IN_GOMP_TASK, BUILT_IN_GOMP_TASKWAIT,
	BUILT_IN_GOMP_LOOP_ULL_STATIC_START,
	BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ULL_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ULL_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ULL_STATIC_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_RUNTIME_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): New builtins.
	* gimplify.c (gimplify_omp_for): Allow pointer type for decl,
	handle POINTER_PLUS_EXPR.  If loop counter has been replaced and
	original iterator is present in lastprivate clause or if
	collapse > 1, set OMP_CLAUSE_LASTPRIVATE_STMT.  Handle collapsed
	OMP_FOR loops, adjust for OMP_FOR_{INIT,COND,INCR} changes.
	(gimplify_expr): Handle OMP_SECTIONS_SWITCH and OMP_TASK.
	(enum gimplify_omp_var_data): Add GOVD_PRIVATE_OUTER_REF.
	(omp_notice_variable): Set GOVD_PRIVATE_OUTER_REF if needed,
	if it is set, lookup var in outer contexts too.  Handle
	OMP_CLAUSE_DEFAULT_FIRSTPRIVATE.  Handle vars that are supposed
	to be implicitly determined firstprivate for task regions.
	(gimplify_scan_omp_clauses): Set GOVD_PRIVATE_OUTER_REF if needed,
	if it is set, lookup var in outer contexts too.  Set
	OMP_CLAUSE_PRIVATE_OUTER_REF if GOVD_PRIVATE_OUTER_REF is set.
	Handle OMP_CLAUSE_LASTPRIVATE_STMT, OMP_CLAUSE_COLLAPSE and
	OMP_CLAUSE_UNTIED.  Take region_type as last argument
	instead of in_parallel and in_combined_parallel.
	(gimplify_omp_parallel, gimplify_omp_for, gimplify_omp_workshare):
	Adjust callers.
	(gimplify_adjust_omp_clauses_1): Set OMP_CLAUSE_PRIVATE_OUTER_REF if
	GOVD_PRIVATE_OUTER_REF is set.  Call omp_finish_clause
	langhook.
	(new_omp_context): Set default_kind to
	OMP_CLAUSE_DEFAULT_UNSPECIFIED for OMP_TASK regions.
	(omp_region_type): New enum.
	(struct gimplify_omp_ctx): Remove is_parallel and is_combined_parallel
	fields, add region_type.
	(new_omp_context): Take region_type as argument instead of is_parallel
	and is_combined_parallel.
	(gimple_add_tmp_var, omp_firstprivatize_variable, omp_notice_variable,
	omp_is_private, omp_check_private): Adjust ctx->is_parallel and
	ctx->is_combined_parallel checks.
	(gimplify_omp_task): New function.
	(gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and
	OMP_CLAUSE_UNTIED.
	* omp-low.c (extract_omp_for_data): Use schedule(static)
	for schedule(auto).  Handle pointer and unsigned iterators.
	Compute fd->iter_type.  Handle POINTER_PLUS_EXPR increments.
	Add loops argument.  Extract data for collapsed OMP_FOR loops.
	(expand_parallel_call): Assert sched_kind isn't auto,
	map runtime schedule to index 3.
	(struct omp_for_data_loop): New type.
	(struct omp_for_data): Remove v, n1, n2, step, cond_code fields.
	Add loop, loops, collapse and iter_type fields.
	(workshare_safe_to_combine_p): Disallow combined for if
	iter_type is unsigned long long.  Don't combine collapse > 1 loops
	unless all bounds and steps are constant.  Adjust extract_omp_for_data
	caller.
	(expand_omp_for_generic): Handle pointer, unsigned and long long
	iterators.  Handle collapsed OMP_FOR loops.  Adjust
	for struct omp_for_data changes.  If libgomp function doesn't return
	boolean_type_node, add comparison of the return value with 0.
	(expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle
	pointer, unsigned and long long iterators.  Adjust for struct
	omp_for_data changes.
	(expand_omp_for): Assert sched_kind isn't auto, map runtime schedule
	to index 3.  Use GOMP_loop_ull*{start,next} if iter_type is
	unsigned long long.  Allocate loops array, pass it to
	extract_omp_for_data.  For collapse > 1 loops use always
	expand_omp_for_generic.
	(omp_context): Add sfield_map and srecord_type fields.
	(is_task_ctx, lookup_sfield): New functions.
	(use_pointer_for_field): Use is_task_ctx helper.  Change first
	argument's type from const_tree to tree.  Clarify comment.
	In OMP_TASK disallow copy-in/out sharing.
	(build_sender_ref): Call lookup_sfield instead of lookup_field.
	(install_var_field): Add mask argument.  Populate both record_type
	and srecord_type if needed.
	(delete_omp_context): Destroy sfield_map, clear DECL_ABSTRACT_ORIGIN
	in srecord_type.
	(fixup_child_record_type): Also remap FIELD_DECL's DECL_SIZE{,_UNIT}
	and DECL_FIELD_OFFSET.
	(scan_sharing_clauses): Adjust install_var_field callers.  For
	firstprivate clauses on explicit tasks allocate the var by value in
	record_type unconditionally, rather than by reference.
	Handle OMP_CLAUSE_PRIVATE_OUTER_REF.  Scan OMP_CLAUSE_LASTPRIVATE_STMT.
	Use is_taskreg_ctx instead of is_parallel_ctx.
	Handle OMP_CLAUSE_COLLAPSE and OMP_CLAUSE_UNTIED.
	(create_omp_child_function_name): Add task_copy argument, use
	*_omp_cpyfn* names if it is true.
	(create_omp_child_function): Add task_copy argument, if true create
	*_omp_cpyfn* helper function.
	(scan_omp_parallel): Adjust create_omp_child_function callers.
	Rename parallel_nesting_level to taskreg_nesting_level.
	(scan_omp_task): New function.
	(lower_rec_input_clauses): Don't run constructors for firstprivate
	explicit task vars which are initialized by *_omp_cpyfn*.  
	Pass outer var ref to omp_clause_default_ctor hook if
	OMP_CLAUSE_PRIVATE_OUTER_REF or OMP_CLAUSE_LASTPRIVATE.
	Replace OMP_CLAUSE_REDUCTION_PLACEHOLDER decls in
	OMP_CLAUSE_REDUCTION_INIT.
	(lower_send_clauses): Clear DECL_ABSTRACT_ORIGIN if in task to
	avoid duplicate setting of fields.  Handle
	OMP_CLAUSE_PRIVATE_OUTER_REF.
	(lower_send_shared_vars): Use srecord_type if non-NULL.  Don't
	copy-out if TREE_READONLY, only copy-in.
	(expand_task_copyfn): New function.
	(expand_task_call): New function.
	(struct omp_taskcopy_context): New type.
	(task_copyfn_copy_decl, task_copyfn_remap_type, create_task_copyfn):
	New functions.
	(lower_omp_parallel): Rename to...
	(lower_omp_taskreg): ... this.  Use OMP_TASKREG_* macros where needed.
	Call create_task_copyfn if srecord_type is needed.  Adjust
	sender_decl type.
	(task_shared_vars): New variable.
	(check_omp_nesting_restrictions): Warn if work-sharing,
	barrier, master or ordered region is closely nested inside OMP_TASK.
	Add warnings for barrier if closely nested inside of work-sharing,
	ordered, or master region.
	(scan_omp_1): Call check_omp_nesting_restrictions even for
	GOMP_barrier calls.  Rename parallel_nesting_level to
	taskreg_nesting_level.  Handle OMP_TASK.
	(lower_lastprivate_clauses): Even if some lastprivate is found on a
	work-sharing construct, continue looking for them on parent parallel
	construct.
	(lower_omp_for_lastprivate): Add lastprivate clauses
	to the beginning of dlist rather than end.  Adjust for struct
	omp_for_data changes.
	(lower_omp_for): Add rec input clauses before OMP_FOR_PRE_BODY,
	not after it.  Handle collapsed OMP_FOR loops, adjust for
	OMP_FOR_{INIT,COND,INCR} changes, adjust extract_omp_for_data
	caller.
	(get_ws_args_for): Adjust extract_omp_for_data caller.
	(scan_omp_for): Handle collapsed OMP_FOR
	loops, adjust for OMP_FOR_{INIT,COND,INCR} changes.
	(lower_omp_single_simple): If libgomp function doesn't return
	boolean_type_node, add comparison of the return value with 0.
	(diagnose_sb_1, diagnose_sb_2): Handle collapsed OMP_FOR
	loops, adjust for OMP_FOR_{INIT,COND,INCR} changes.  Handle OMP_TASK.
	(parallel_nesting_level): Rename to...
	(taskreg_nesting_level): ... this.
	(is_taskreg_ctx): New function.
	(build_outer_var_ref, omp_copy_decl): Use is_taskreg_ctx instead
	of is_parallel_ctx.
	(execute_lower_omp): Rename parallel_nesting_level to
	taskreg_nesting_level.
	(expand_omp_parallel): Rename to...
	(expand_omp_taskreg): ... this.  Use OMP_TASKREG_* macros where needed.
	Call omp_task_call for OMP_TASK regions.
	(expand_omp): Adjust caller, handle OMP_TASK.
	(lower_omp_1): Adjust lower_omp_taskreg caller, handle OMP_TASK.

	* bitmap.c (bitmap_default_obstack_depth): New variable.
	(bitmap_obstack_initialize, bitmap_obstack_release): Do nothing
	if argument is NULL and bitmap_default_obstack is already initialized.
	* ipa-struct-reorg.c (do_reorg_1): Call bitmap_obstack_release
	at the end.
	* matrix-reorg.c (matrix_reorg): Likewise.
cp/
	* cp-tree.h (cxx_omp_finish_clause, cxx_omp_create_clause_info,
	dependent_omp_for_p, begin_omp_task, finish_omp_task,
	finish_omp_taskwait): New prototypes.
	(cxx_omp_clause_default_ctor): Add outer argument.
	(finish_omp_for): Add new clauses argument.
	* cp-gimplify.c (cxx_omp_finish_clause): New function.
	(cxx_omp_predetermined_sharing): Moved from semantics.c, rewritten.
	(cxx_omp_clause_default_ctor): Add outer argument.
	(cp_genericize_r): Walk OMP_CLAUSE_LASTPRIVATE_STMT.
	* cp-objcp-common.h (LANG_HOOKS_OMP_FINISH_CLAUSE): Define.
	* parser.c (cp_parser_omp_for_loop): Parse collapsed for loops.
	Add par_clauses argument.  If decl is present in parallel's
	lastprivate clause, change that clause to shared and add
	a lastprivate clause for decl to OMP_FOR_CLAUSES.
	Fix wording of error messages.  Adjust finish_omp_for caller.
	Add clauses argument.  Parse loops with random access iterators.
	(cp_parser_omp_clause_collapse, cp_parser_omp_clause_untied): New
	functions.
	(cp_parser_omp_for, cp_parser_omp_parallel): Adjust
	cp_parser_omp_for_loop callers.
	(cp_parser_omp_for_cond, cp_parser_omp_for_incr): New helper
	functions.
	(cp_parser_omp_clause_name): Handle collapse and untied
	clauses.
	(cp_parser_omp_clause_schedule): Handle auto schedule.
	(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_COLLAPSE
	and PRAGMA_OMP_CLAUSE_UNTIED.
	(OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_COLLAPSE.
	(OMP_TASK_CLAUSE_MASK): Define.
	(cp_parser_omp_task, cp_parser_omp_taskwait): New functions.
	(cp_parser_omp_construct): Handle PRAGMA_OMP_TASK.
	(cp_parser_pragma): Handle PRAGMA_OMP_TASK and
	PRAGMA_OMP_TASKWAIT.
	* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_COLLAPSE and
	OMP_CLAUSE_UNTIED.  Handle OMP_CLAUSE_LASTPRIVATE_STMT.
	(tsubst_omp_for_iterator): New function.
	(dependent_omp_for_p): New function.
	(tsubst_expr) <case OMP_FOR>: Use it.  Handle collapsed OMP_FOR
	loops.  Adjust finish_omp_for caller.  Handle loops with random
	access iterators.  Adjust for OMP_FOR_{INIT,COND,INCR} changes.
	(tsubst_expr): Handle OMP_TASK.
	* semantics.c (cxx_omp_create_clause_info): New function.
	(finish_omp_clauses): Call it.  Handle OMP_CLAUSE_UNTIED and
	OMP_CLAUSE_COLLAPSE.
	(cxx_omp_predetermined_sharing): Removed.
	* semantics.c (finish_omp_for): Allow pointer iterators.  Use
	handle_omp_for_class_iterator and dependent_omp_for_p.  Handle
	collapsed for loops.  Adjust c_finish_omp_for caller.  Add new
	clauses argument.  Fix check for type dependent cond or incr.
	Set OMP_FOR_CLAUSES to clauses.  Use cp_convert instead of
	fold_convert to convert incr amount to difference_type.  Only
	fold if not in template.  If decl is mentioned in lastprivate
	clause, set OMP_CLAUSE_LASTPRIVATE_STMT.  Handle loops with random
	access iterators.  Adjust for OMP_FOR_{INIT,COND,INCR}
	changes.
	(finish_omp_threadprivate): Allow static class members of the
	current class.
	(handle_omp_for_class_iterator, begin_omp_task, finish_omp_task,
	finish_omp_taskwait): New functions.

	* parser.c (cp_parser_binary_expression): Add prec argument.
	(cp_parser_assignment_expression): Adjust caller.
	* cp-tree.h (outer_curly_brace_block): New prototype.
	* decl.c (outer_curly_brace_block): No longer static.
fortran/
	* scanner.c (skip_free_comments, skip_fixed_comments): Handle tabs.
	* parse.c (next_free): Allow tab after !$omp.
	(decode_omp_directive): Handle !$omp task, !$omp taskwait
	and !$omp end task.
	(case_executable): Add ST_OMP_TASKWAIT.
	(case_exec_markers): Add ST_OMP_TASK.
	(gfc_ascii_statement): Handle ST_OMP_TASK, ST_OMP_END_TASK and
	ST_OMP_TASKWAIT.
	(parse_omp_structured_block, parse_executable): Handle ST_OMP_TASK.
	* gfortran.h (gfc_find_sym_in_expr): New prototype.
	(gfc_statement): Add ST_OMP_TASK, ST_OMP_END_TASK and ST_OMP_TASKWAIT.
	(gfc_omp_clauses): Add OMP_SCHED_AUTO to sched_kind,
	OMP_DEFAULT_FIRSTPRIVATE to default_sharing.  Add collapse and
	untied fields.
	(gfc_exec_op): Add EXEC_OMP_TASK and EXEC_OMP_TASKWAIT.
	* f95-lang.c (LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
	LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, LANG_HOOKS_OMP_CLAUSE_DTOR,
	LANG_HOOKS_OMP_PRIVATE_OUTER_REF): Define.
	* trans.h (gfc_omp_clause_default_ctor): Add another argument.
	(gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op,
	gfc_omp_clause_dtor, gfc_omp_private_outer_ref): New prototypes.
	* types.def (BT_ULONGLONG, BT_PTR_ULONGLONG,
	BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR,
	BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
	BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
	BT_FN_VOID_PTR_PTR, BT_PTR_FN_VOID_PTR_PTR,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): New.
	(BT_BOOL): Use integer type with BOOL_TYPE_SIZE rather
	than boolean_type_node.
	* dump-parse-tree.c (gfc_show_omp_node): Handle EXEC_OMP_TASK,
	EXEC_OMP_TASKWAIT, OMP_SCHED_AUTO, OMP_DEFAULT_FIRSTPRIVATE,
	untied and collapse clauses.
	(gfc_show_code_node): Handle EXEC_OMP_TASK and EXEC_OMP_TASKWAIT.
	* trans.c (gfc_trans_code): Handle EXEC_OMP_TASK and
	EXEC_OMP_TASKWAIT.
	* st.c (gfc_free_statement): Likewise.
	* resolve.c (gfc_resolve_blocks, resolve_code): Likewise.
	(find_sym_in_expr): Rename to...
	(gfc_find_sym_in_expr): ... this.  No longer static.
	(resolve_allocate_expr, resolve_ordinary_assign): Adjust caller.
	* match.h (gfc_match_omp_task, gfc_match_omp_taskwait): New
	prototypes.
	* openmp.c (resolve_omp_clauses): Allow allocatable arrays in
	firstprivate, lastprivate, reduction, copyprivate and copyin
	clauses.
	(omp_current_do_code): Made static.
	(omp_current_do_collapse): New variable.
	(gfc_resolve_omp_do_blocks): Compute omp_current_do_collapse,
	clear omp_current_do_code and omp_current_do_collapse on return.
	(gfc_resolve_do_iterator): Handle collapsed do loops.
	(resolve_omp_do): Likewise, diagnose errorneous collapsed do loops.
	(OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED): Define.
	(gfc_match_omp_clauses): Handle default (firstprivate),
	schedule (auto), untied and collapse (n) clauses.
	(OMP_DO_CLAUSES): Add OMP_CLAUSE_COLLAPSE.
	(OMP_TASK_CLAUSES): Define.
	(gfc_match_omp_task, gfc_match_omp_taskwait): New functions.
	* trans-openmp.c (gfc_omp_private_outer_ref): New function.
	(gfc_omp_clause_default_ctor): Add outer argument.  For allocatable
	arrays allocate them with the bounds of the outer var if outer
	var is allocated.
	(gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op,
	gfc_omp_clause_dtor): New functions.
	(gfc_trans_omp_array_reduction): If decl is allocatable array,
	allocate it with outer var's bounds in OMP_CLAUSE_REDUCTION_INIT
	and deallocate it in OMP_CLAUSE_REDUCTION_MERGE.
	(gfc_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED
	for assumed-size arrays.
	(gfc_trans_omp_do): Add par_clauses argument.  If dovar is
	present in lastprivate clause and do loop isn't simple,
	set OMP_CLAUSE_LASTPRIVATE_STMT.  If dovar is present in
	parallel's lastprivate clause, change it to shared and add
	lastprivate clause to OMP_FOR_CLAUSES.  Handle collapsed do loops.
	(gfc_trans_omp_directive): Adjust gfc_trans_omp_do callers.
	(gfc_trans_omp_parallel_do): Likewise.  Move collapse clause to
	OMP_FOR from OMP_PARALLEL.
	(gfc_trans_omp_clauses): Handle OMP_SCHED_AUTO,
	OMP_DEFAULT_FIRSTPRIVATE, untied and collapse clauses.
	(gfc_trans_omp_task, gfc_trans_omp_taskwait): New functions.
	(gfc_trans_omp_directive): Handle EXEC_OMP_TASK and
	EXEC_OMP_TASKWAIT.
gcc/testsuite/
	* gcc.dg/gomp/collapse-1.c: New test.
	* gcc.dg/gomp/nesting-1.c: New test.
	* g++.dg/gomp/task-1.C: New test.
	* g++.dg/gomp/predetermined-1.C: New test.
	* g++.dg/gomp/tls-4.C: New test.
	* gfortran.dg/gomp/collapse1.f90: New test.
	* gfortran.dg/gomp/sharing-3.f90: New test.
	* gcc.dg/gomp/pr27499.c (foo): Remove is unsigned dg-warning.
	* g++.dg/gomp/pr27499.C (foo): Likewise.
	* g++.dg/gomp/for-16.C (foo): Likewise.
	* g++.dg/gomp/tls-3.C: Remove dg-error, add S::s definition.
	* g++.dg/gomp/pr34607.C: Adjust dg-error location.
	* g++.dg/gomp/for-16.C (foo): Add a new dg-error.
	* gcc.dg/gomp/appendix-a/a.35.4.c: Add dg-warning.
	* gcc.dg/gomp/appendix-a/a.35.6.c: Likewise.
	* gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise.
	* gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise.
	* gfortran.dg/gomp/omp_parse1.f90: Remove !$omp tab test.
	* gfortran.dg/gomp/appendix-a/a.33.4.f90: Remove dg-error
	about allocatable array.
	* gfortran.dg/gomp/reduction1.f90: Likewise.
libgomp/
	* configure.ac (LIBGOMP_GNU_SYMBOL_VERSIONING): New AC_DEFINE.
	Substitute also OMP_*LOCK_25*.
	* configure: Regenerated.
	* config.h.in: Regenerated.
	* Makefile.am (libgomp_la_SOURCES): Add loop_ull.c, iter_ull.c,
	ptrlock.c and task.c.
	* Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.
	* task.c: New file.
	* loop_ull.c: New file.
	* iter_ull.c: New file.
	* libgomp.h: Include ptrlock.h.
	(enum gomp_task_kind): New type.
	(struct gomp_team): Add task_lock, task_queue, task_count,
	task_running_count, single_count fields.  Add
	work_share_list_free_lock ifndef HAVE_SYNC_BUILTINS.
	Remove work_share_lock, generation_mask,
	oldest_live_gen, num_live_gen and init_work_shares fields, add
	work work_share_list_alloc, work_share_list_free and work_share_chunk
	fields.  Change work_shares from pointer to pointers into an array.
	Change ordered_release field into gomp_sem_t ** from flexible array
	member.  Add implicit_task and initial_work_shares fields.
	Move close to the end of the struct.
	(struct gomp_team_state): Add single_count, last_work_share,
	active_level and level fields, remove work_share_generation.
	(gomp_barrier_handle_tasks): New prototype.
	(gomp_finish_task): New inline function.
	(struct gomp_work_share): Move chunk_size, end, incr into
	transparent union/struct, add chunk_size_ull, end_ll, incr_ll and
	next_ll fields.  Reshuffle fields.  Add next_alloc,
	next_ws, next_free and inline_ordered_team_ids fields, change
	ordered_team_ids into pointer from flexible array member.
	Add mode field.  Put lock and next into a different cache line
	from most of the write-once fields.
	(gomp_iter_ull_static_next, gomp_iter_ull_dynamic_next_locked,
	gomp_iter_ull_guided_next_locked, gomp_iter_ull_dynamic_next,
	gomp_iter_ull_guided_next): New prototypes.
	(gomp_new_icv): New prototype.
	(struct gomp_thread): Add thread_pool and task fields.
	(struct gomp_thread_pool): New type.
	(gomp_new_team): New prototype.
	(gomp_team_start): Change type of last argument.
	(gomp_new_work_share): Removed.
	(gomp_init_work_share, gomp_fini_work_share): New prototypes.
	(gomp_work_share_init_done): New static inline.
	(gomp_throttled_spin_count_var, gomp_available_cpus,
	gomp_managed_threads): New extern decls.
	(gomp_init_task): New prototype.
	(gomp_spin_count_var): New extern var decl.
	(LIBGOMP_GNU_SYMBOL_VERSIONING): Undef if no visibility
	or no alias support, or if not PIC.
	(gomp_init_lock_30, gomp_destroy_lock_30, gomp_set_lock_30,
	gomp_unset_lock_30, gomp_test_lock_30, gomp_init_nest_lock_30,
	gomp_destroy_nest_lock_30, gomp_set_nest_lock_30,
	gomp_unset_nest_lock_30, gomp_test_nest_lock_30, gomp_init_lock_25,
	gomp_destroy_lock_25, gomp_set_lock_25, gomp_unset_lock_25,
	gomp_test_lock_25, gomp_init_nest_lock_25, gomp_destroy_nest_lock_25,
	gomp_set_nest_lock_25, gomp_unset_nest_lock_25,
	gomp_test_nest_lock_25): New prototypes.
	(omp_lock_symver, strong_alias): Define.
	(gomp_remaining_threads_count, gomp_remaining_threads_lock): New
	decls.
	(gomp_end_task): New.
	(struct gomp_task_icv, gomp_global_icv): New.
	(gomp_thread_limit_var, gomp_max_active_levels_var): New.
	(struct gomp_task): New.
	(gomp_nthreads_var, gomp_dyn_var, gomp_nest_var,
	gomp_run_sched_var, gomp_run_sched_chunk): Remove.
	(gomp_icv): New.
	(gomp_schedule_type): Reorder enum to match
	omp_sched_t.
	* team.c (struct gomp_thread_start_data): Add thread_pool and task
	fields.
	(gomp_thread_start): Add gomp_team_barrier_wait call.
	For non-nested case remove clearing of docked thread thr fields.
	Use pool fields instead of global gomp_* variables.  Use
	gomp_barrier_wait_last when needed.  Initialize ts.active_level.
	Create tasks for each member thread.
	(free_team): Only destroy team barrier, task_lock here and free it.
	(gomp_free_thread): Free last_team if non-NULL.
	(gomp_team_end): Call gomp_team_barrier_wait instead of
	gomp_barrier_wait.  For nested case call one extra
	gomp_barrier_wait.  Move here some destruction from free_team.
	Call free_team on pool->last_team if any, rather than freeing
	current team.  Destroy work_share_list_free_lock ifndef
	HAVE_SYNC_BUILTINS.
	(gomp_new_icv): New function.
	(gomp_threads, gomp_threads_size, gomp_threads_used,
	gomp_threads_dock): Removed.
	(gomp_thread_destructor): New variable.
	(gomp_new_thread_pool, gomp_free_pool_helper, gomp_free_thread): New
	functions.
	(gomp_team_start): Create new pool if current thread doesn't have
	one.  Use pool fields instead of global gomp_* variables. 
	Initialize thread_pool field for new threads.  Clear single_count.
	Change last argument from ws to team, don't create
	new team, set ts.work_share to &team->work_shares[0] and clear
	ts.last_work_share.  Don't clear ts.work_share_generation.
	If number of threads changed, adjust atomically gomp_managed_threads.
	Use gomp_init_task instead of gomp_new_task,
	set thr->task to the corresponding implicit_task array entry.
	Create tasks for each member thread.  Initialize ts.level.
	(initialize_team): Call pthread_key_create on
	gomp_thread_destructor.
	(team_destructor): New function.
	(new_team): Removed.
	(gomp_new_team): New function.
	(free_team): Free gomp_work_share blocks chained through next_alloc,
	instead of freeing work_shares and destroying work_share_lock.
	(gomp_team_end): Call gomp_fini_work_share.  If number of threads
	changed, adjust atomically gomp_managed_threads.  Use gomp_end_task.
	* barrier.c (GOMP_barrier): Call gomp_team_barrier_wait instead
	of gomp_barrier_wait.
	* single.c (GOMP_single_copy_start): Call gomp_team_barrier_wait
	instead of gomp_barrier_wait.  Call gomp_work_share_init_done
	if gomp_work_share_start returned true.  Don't unlock ws->lock.
	(GOMP_single_copy_end): Call gomp_team_barrier_wait instead
	of gomp_barrier_wait.
	(GOMP_single_start): Rewritten if HAVE_SYNC_BUILTINS.  Call
	gomp_work_share_init_done if gomp_work_share_start returned true.
	Don't unlock ws->lock.
	* work.c: Include stddef.h.
	(free_work_share): Use work_share_list_free_lock instead
	of atomic chaining ifndef HAVE_SYNC_BUILTINS.  Add team argument.
	Call gomp_fini_work_share and then either free ws if orphaned, or
	put it into work_share_list_free list of the current team.
	(alloc_work_share, gomp_init_work_share, gomp_fini_work_share): New
	functions.
	(gomp_work_share_start, gomp_work_share_end,
	gomp_work_share_end_nowait): Rewritten.
	* omp_lib.f90.in Change some tabs to spaces to prevent warnings.
	(openmp_version): Set to 200805.
	(omp_sched_kind, omp_sched_static, omp_sched_dynamic,
	omp_sched_guided, omp_sched_auto): New parameters.
	(omp_set_schedule, omp_get_schedule, omp_get_thread_limit,
	omp_set_max_active_levels, omp_get_max_active_levels,
	omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size,
	omp_get_active_level): New interfaces.
	* omp_lib.h.in (openmp_version): Set to 200805.
	(omp_sched_kind, omp_sched_static, omp_sched_dynamic,
	omp_sched_guided, omp_sched_auto): New parameters.
	(omp_set_schedule, omp_get_schedule, omp_get_thread_limit,
	omp_set_max_active_levels, omp_get_max_active_levels,
	omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size,
	omp_get_active_level): New externals.
	* loop.c: Include limits.h.
	(GOMP_loop_runtime_next, GOMP_loop_ordered_runtime_next): Handle
	GFS_AUTO.
	(GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start):
	Likewise.  Use gomp_icv.
	(gomp_loop_static_start, gomp_loop_dynamic_start): Clear
	ts.static_trip here.
	(gomp_loop_static_start, gomp_loop_ordered_static_start): Call
	gomp_work_share_init_done after gomp_loop_init.  Don't unlock ws->lock.
	(gomp_loop_dynamic_start, gomp_loop_guided_start): Call
	gomp_work_share_init_done after gomp_loop_init.  If HAVE_SYNC_BUILTINS,
	don't unlock ws->lock, otherwise lock it.
	(gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start): Call
	gomp_work_share_init_done after gomp_loop_init.  Lock ws->lock.
	(gomp_parallel_loop_start): Call gomp_new_team instead of
	gomp_new_work_share.  Call gomp_loop_init on &team->work_shares[0].
	Adjust gomp_team_start caller.  Pass 0 as second argument to
	gomp_resolve_num_threads.
	(gomp_loop_init): For GFS_DYNAMIC, multiply ws->chunk_size by incr.
	If adding ws->chunk_size nthreads + 1 times after end won't
	overflow, set ws->mode to 1.
	* libgomp_g.h (GOMP_loop_ull_static_start, GOMP_loop_ull_dynamic_start,
	GOMP_loop_ull_guided_start, GOMP_loop_ull_runtime_start,
	GOMP_loop_ull_ordered_static_start,
	GOMP_loop_ull_ordered_dynamic_start,
	GOMP_loop_ull_ordered_guided_start,
	GOMP_loop_ull_ordered_runtime_start, GOMP_loop_ull_static_next,
	GOMP_loop_ull_dynamic_next, GOMP_loop_ull_guided_next,
	GOMP_loop_ull_runtime_next, GOMP_loop_ull_ordered_static_next,
	GOMP_loop_ull_ordered_dynamic_next, GOMP_loop_ull_ordered_guided_next,
	GOMP_loop_ull_ordered_runtime_next, GOMP_task, GOMP_taskwait): New
	prototypes.
	* libgomp.map: Export lock routines also @@OMP_2.0.
	(GOMP_loop_ordered_dynamic_first,
	GOMP_loop_ordered_guided_first, GOMP_loop_ordered_runtime_first,
	GOMP_loop_ordered_static_first): Remove.
	(GOMP_loop_ull_dynamic_next, GOMP_loop_ull_dynamic_start,
	GOMP_loop_ull_guided_next, GOMP_loop_ull_guided_start,
	GOMP_loop_ull_ordered_dynamic_next,
	GOMP_loop_ull_ordered_dynamic_start,
	GOMP_loop_ull_ordered_guided_next,
	GOMP_loop_ull_ordered_guided_start,
	GOMP_loop_ull_ordered_runtime_next,
	GOMP_loop_ull_ordered_runtime_start,
	GOMP_loop_ull_ordered_static_next,
	GOMP_loop_ull_ordered_static_start,
	GOMP_loop_ull_runtime_next, GOMP_loop_ull_runtime_start,
	GOMP_loop_ull_static_next, GOMP_loop_ull_static_start,
	GOMP_task, GOMP_taskwait): Export @@GOMP_2.0.
	(omp_set_schedule, omp_get_schedule,
	omp_get_thread_limit, omp_set_max_active_levels,
	omp_get_max_active_levels, omp_get_level,
	omp_get_ancestor_thread_num, omp_get_team_size, omp_get_active_level,
	omp_set_schedule_, omp_set_schedule_8_,
	omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_,
	omp_set_max_active_levels_, omp_set_max_active_levels_8_,
	omp_get_max_active_levels_, omp_get_level_,
	omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_,
	omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_):
	New exports @@OMP_3.0.
	* omp.h.in (omp_sched_t): New type.
	(omp_set_schedule, omp_get_schedule, omp_get_thread_limit,
	omp_set_max_active_levels, omp_get_max_active_levels,
	omp_get_level, omp_get_ancestor_thread_num, omp_get_team_size,
	omp_get_active_level): New prototypes.
	* env.c (gomp_spin_count_var, gomp_throttled_spin_count_var,
	gomp_available_cpus, gomp_managed_threads, gomp_max_active_levels_var,
	gomp_thread_limit_var, gomp_remaining_threads_count,
	gomp_remaining_threads_lock): New variables.
	(parse_spincount): New function.
	(initialize_env): Call gomp_init_num_threads unconditionally.
	Initialize gomp_available_cpus.  Call parse_spincount,
	initialize gomp_{,throttled_}spin_count_var
	depending on presence and value of OMP_WAIT_POLICY and
	GOMP_SPINCOUNT env vars.  Handle GOMP_BLOCKTIME env var.
	Handle OMP_WAIT_POLICY, OMP_MAX_ACTIVE_LEVELS,
	OMP_THREAD_LIMIT, OMP_STACKSIZE env vars.  Handle unit specification
	for GOMP_STACKSIZE.  Initialize gomp_remaining_threads_count and
	gomp_remaining_threads_lock if needed.  Use gomp_global_icv.
	(gomp_nthreads_var, gomp_dyn_var, gomp_nest_var,
	gomp_run_sched_var, gomp_run_sched_chunk): Remove.
	(gomp_global_icv): New.
	(parse_schedule): Use it.  Parse "auto".
	(omp_set_num_threads): Use gomp_icv.
	(omp_set_dynamic, omp_get_dynamic, omp_set_nested, omp_get_nested):
	Likewise.
	(omp_get_max_threads): Move from parallel.c.
	(omp_set_schedule, omp_get_schedule, omp_get_thread_limit,
	omp_set_max_active_levels, omp_get_max_active_levels): New functions,
	add ialias.
	(parse_stacksize, parse_wait_policy): New functions.
	* fortran.c: Rewrite lock wrappers, if symbol versioning provide
	both wrappers for compatibility and new locks.
	(omp_set_schedule, omp_get_schedule,
	omp_get_thread_limit, omp_set_max_active_levels,
	omp_get_max_active_levels, omp_get_level,
	omp_get_ancestor_thread_num, omp_get_team_size,
	omp_get_active_level): New ialias_redirect.
	(omp_set_schedule_, omp_set_schedule_8_,
	omp_get_schedule_, omp_get_schedule_8_, omp_get_thread_limit_,
	omp_set_max_active_levels_, omp_set_max_active_levels_8_,
	omp_get_max_active_levels_, omp_get_level_,
	omp_get_ancestor_thread_num_, omp_get_ancestor_thread_num_8_,
	omp_get_team_size_, omp_get_team_size_8_, omp_get_active_level_):
	New functions.
	* parallel.c: Include limits.h.
	(gomp_resolve_num_threads): Add count argument.  Rewritten.
	(GOMP_parallel_start): Call gomp_new_team and pass that as last
	argument to gomp_team_start.  Pass 0 as second argument to
	gomp_resolve_num_threads.
	(GOMP_parallel_end): Decrease gomp_remaining_threads_count
	if gomp_thread_limit_var != ULONG_MAX.
	(omp_in_parallel): Implement using ts.active_level.
	(omp_get_max_threads): Move to env.c.
	(omp_get_level, omp_get_ancestor_thread_num,
	omp_get_team_size, omp_get_active_level): New functions,
	add ialias.
	* sections.c (GOMP_sections_start): Call gomp_work_share_init_done
	after gomp_sections_init.  If HAVE_SYNC_BUILTINS, call
	gomp_iter_dynamic_next instead of the _locked variant and don't take
	lock around it, otherwise acquire it before calling
	gomp_iter_dynamic_next_locked.
	(GOMP_sections_next): If HAVE_SYNC_BUILTINS, call
	gomp_iter_dynamic_next instead of the _locked variant and don't take
	lock around it.
	(GOMP_parallel_sections_start): Call gomp_new_team instead of
	gomp_new_work_share.  Call gomp_sections_init on &team->work_shares[0].
	Adjust gomp_team_start caller.  Pass count as second argument to
	gomp_resolve_num_threads, don't adjust num_threads after the call.
	Use gomp_icv.
	* iter.c (gomp_iter_dynamic_next_locked): Don't multiply
	ws->chunk_size by incr.
	(gomp_iter_dynamic_next): Likewise.  If ws->mode, use more efficient
	code.
	* libgomp_f.h.in (omp_lock_25_arg_t, omp_nest_lock_25_arg_t): New
	types.
	(omp_lock_25_arg, omp_nest_lock_25_arg): New macros.
	(omp_check_defines): Check even the compat defines.
	* config/linux/ptrlock.c: New file.
	* config/linux/ptrlock.h: New file.
	* config/linux/wait.h: New file.
	* config/posix/ptrlock.c: New file.
	* config/posix/ptrlock.h: New file.
	* config/linux/bar.h (gomp_team_barrier_wait,
	gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes.
	(gomp_team_barrier_set_task_pending,
	gomp_team_barrier_clear_task_pending,
	gomp_team_barrier_set_waiting_for_tasks,
	gomp_team_barrier_waiting_for_tasks,
	gomp_team_barrier_done): New inlines.
	(gomp_barrier_t): Rewritten.
	(gomp_barrier_state_t): New typedef.
	(gomp_barrier_init, gomp_barrier_reinit, gomp_barrier_destroy,
	gomp_barrier_wait_start): Rewritten.
	(gomp_barrier_wait_end): Change second argument to
	gomp_barrier_state_t.
	(gomp_barrier_last_thread, gomp_barrier_wait_last): New static
	inlines.
	* config/linux/bar.c: Include wait.h instead of libgomp.h and
	futex.h.
	(gomp_barrier_wait_end): Rewritten.
	(gomp_team_barrier_wait, gomp_team_barrier_wait_end,
	gomp_team_barrier_wake, gomp_barrier_wait_last): New functions.
	* config/posix/bar.h (gomp_barrier_t): Add generation field.
	(gomp_barrier_state_t): New typedef.
	(gomp_team_barrier_wait,
	gomp_team_barrier_wait_end, gomp_team_barrier_wake): New prototypes.
	(gomp_barrier_wait_start): Or all but low 2 bits from generation
	into the return value.  Return gomp_barrier_state_t.
	(gomp_team_barrier_set_task_pending,
	gomp_team_barrier_clear_task_pending,
	gomp_team_barrier_set_waiting_for_tasks,
	gomp_team_barrier_waiting_for_tasks,
	gomp_team_barrier_done): New inlines.
	(gomp_barrier_wait_end): Change second argument to
	gomp_barrier_state_t.
	(gomp_barrier_last_thread, gomp_barrier_wait_last): New static
	inlines.
	* config/posix/bar.c (gomp_barrier_init): Clear generation field.
	(gomp_barrier_wait_end): Change second argument to
	gomp_barrier_state_t. 
	(gomp_team_barrier_wait, gomp_team_barrier_wait_end,
	gomp_team_barrier_wake): New functions.
	* config/linux/mutex.c: Include wait.h instead of libgomp.h and
	futex.h.
	(gomp_futex_wake, gomp_futex_wait): New variables.
	(gomp_mutex_lock_slow): Call do_wait instead of futex_wait.
	* config/linux/lock.c: Rewrite to make locks task owned,
	for backwards compatibility provide the old entrypoints
	if symbol versioning.  Include wait.h instead of libgomp.h and
	futex.h.
	(gomp_set_nest_lock_25): Call do_wait instead of futex_wait.
	* config/posix95/lock.c: Rewrite to make locks task owned,
	for backwards compatibility provide the old entrypoints
	if symbol versioning.
	* config/posix/lock.c: Rewrite to make locks task owned,
	for backwards compatibility provide the old entrypoints
	if symbol versioning.
	* config/linux/proc.c (gomp_init_num_threads): Use gomp_global_icv.
	(get_num_procs, gomp_dynamic_max_threads): Use gomp_icv.
	* config/posix/proc.c, config/mingw32/proc.c: Similarly.
	* config/linux/powerpc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
	(sys_futex0): Return error code.
	(futex_wake, futex_wait): If ENOSYS was returned, clear
	FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
	(cpu_relax, atomic_write_barrier): New static inlines.
	* config/linux/alpha/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
	(futex_wake, futex_wait): If ENOSYS was returned, clear
	FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
	(cpu_relax, atomic_write_barrier): New static inlines.
	* config/linux/x86/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
	(sys_futex0): Return error code.
	(futex_wake, futex_wait): If ENOSYS was returned, clear
	FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
	(cpu_relax, atomic_write_barrier): New static inlines.
	* config/linux/s390/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
	(sys_futex0): Return error code.
	(futex_wake, futex_wait): If ENOSYS was returned, clear
	FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
	(cpu_relax, atomic_write_barrier): New static inlines.
	* config/linux/ia64/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
	(sys_futex0): Return error code.
	(futex_wake, futex_wait): If ENOSYS was returned, clear
	FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
	(cpu_relax, atomic_write_barrier): New static inlines.
	* config/linux/sparc/futex.h (FUTEX_WAIT, FUTEX_WAKE): Remove.
	(sys_futex0): Return error code.
	(futex_wake, futex_wait): If ENOSYS was returned, clear
	FUTEX_PRIVATE_FLAG in gomp_futex_wa{ke,it} and retry.
	(cpu_relax, atomic_write_barrier): New static inlines.
	* config/linux/sem.c: Include wait.h instead of libgomp.h and
	futex.h.
	(gomp_sem_wait_slow): Call do_wait instead of futex_wait.
	* config/linux/affinity.c: Assume HAVE_SYNC_BUILTINS.
	* config/linux/omp-lock.h (omp_lock_25_t, omp_nest_lock_25_t): New
	types.
	(omp_nest_lock_t): Change owner into void *, add lock field.
	* config/posix95/omp-lock.h: Include semaphore.h.
	(omp_lock_25_t, omp_nest_lock_25_t): New types.
	(omp_lock_t): Use sem_t instead of mutex if semaphores
	aren't broken.
	(omp_nest_lock_t): Likewise.  Change owner to void *.
	* config/posix/omp-lock.h: Include semaphore.h.
	(omp_lock_25_t, omp_nest_lock_25_t): New types.
	(omp_lock_t): Use sem_t instead of mutex if semaphores
	aren't broken.
	(omp_nest_lock_t): Likewise.  Add owner field.

	* testsuite/libgomp.c/collapse-1.c: New test.
	* testsuite/libgomp.c/collapse-2.c: New test.
	* testsuite/libgomp.c/collapse-3.c: New test.
	* testsuite/libgomp.c/icv-1.c: New test.
	* testsuite/libgomp.c/icv-2.c: New test.
	* testsuite/libgomp.c/lib-2.c: New test.
	* testsuite/libgomp.c/lock-1.c: New test.
	* testsuite/libgomp.c/lock-2.c: New test.
	* testsuite/libgomp.c/lock-3.c: New test.
	* testsuite/libgomp.c/loop-4.c: New test.
	* testsuite/libgomp.c/loop-5.c: New test.
	* testsuite/libgomp.c/loop-6.c: New test.
	* testsuite/libgomp.c/loop-7.c: New test.
	* testsuite/libgomp.c/loop-8.c: New test.
	* testsuite/libgomp.c/loop-9.c: New test.
	* testsuite/libgomp.c/nested-3.c: New test.
	* testsuite/libgomp.c/nestedfn-6.c: New test.
	* testsuite/libgomp.c/sort-1.c: New test.
	* testsuite/libgomp.c/task-1.c: New test.
	* testsuite/libgomp.c/task-2.c: New test.
	* testsuite/libgomp.c/task-3.c: New test.
	* testsuite/libgomp.c/task-4.c: New test.
	* testsuite/libgomp.c++/c++.exp: Add libstdc++-v3 build includes
	to C++ testsuite default compiler options.
	* testsuite/libgomp.c++/collapse-1.C: New test.
	* testsuite/libgomp.c++/collapse-2.C: New test.
	* testsuite/libgomp.c++/ctor-10.C: New test.
	* testsuite/libgomp.c++/for-1.C: New test.
	* testsuite/libgomp.c++/for-2.C: New test.
	* testsuite/libgomp.c++/for-3.C: New test.
	* testsuite/libgomp.c++/for-4.C: New test.
	* testsuite/libgomp.c++/for-5.C: New test.
	* testsuite/libgomp.c++/loop-8.C: New test.
	* testsuite/libgomp.c++/loop-9.C: New test.
	* testsuite/libgomp.c++/loop-10.C: New test.
	* testsuite/libgomp.c++/task-1.C: New test.
	* testsuite/libgomp.c++/task-2.C: New test.
	* testsuite/libgomp.c++/task-3.C: New test.
	* testsuite/libgomp.c++/task-4.C: New test.
	* testsuite/libgomp.c++/task-5.C: New test.
	* testsuite/libgomp.c++/task-6.C: New test.
	* testsuite/libgomp.fortran/allocatable1.f90: New test.
	* testsuite/libgomp.fortran/allocatable2.f90: New test.
	* testsuite/libgomp.fortran/allocatable3.f90: New test.
	* testsuite/libgomp.fortran/allocatable4.f90: New test.
	* testsuite/libgomp.fortran/collapse1.f90: New test.
	* testsuite/libgomp.fortran/collapse2.f90: New test.
	* testsuite/libgomp.fortran/collapse3.f90: New test.
	* testsuite/libgomp.fortran/collapse4.f90: New test.
	* testsuite/libgomp.fortran/lastprivate1.f90: New test.
	* testsuite/libgomp.fortran/lastprivate2.f90: New test.
	* testsuite/libgomp.fortran/lib4.f90: New test.
	* testsuite/libgomp.fortran/lock-1.f90: New test.
	* testsuite/libgomp.fortran/lock-2.f90: New test.
	* testsuite/libgomp.fortran/nested1.f90: New test.
	* testsuite/libgomp.fortran/nestedfn4.f90: New test.
	* testsuite/libgomp.fortran/strassen.f90: New test.
	* testsuite/libgomp.fortran/tabs1.f90: New test.
	* testsuite/libgomp.fortran/tabs2.f: New test.
	* testsuite/libgomp.fortran/task1.f90: New test.
	* testsuite/libgomp.fortran/task2.f90: New test.
	* testsuite/libgomp.fortran/vla4.f90: Add dg-warning.
	* testsuite/libgomp.fortran/vla5.f90: Likewise.
	* testsuite/libgomp.c/pr26943-2.c: Likewise.
	* testsuite/libgomp.c/pr26943-3.c: Likewise.
	* testsuite/libgomp.c/pr26943-4.c: Likewise.

Co-Authored-By: Jakob Blomer <jakob.blomer@ira.uka.de>
Co-Authored-By: Richard Henderson <rth@redhat.com>
Co-Authored-By: Ulrich Drepper <drepper@redhat.com>

From-SVN: r136433
2008-06-06 15:01:54 +02:00
Daniel Kraft 345235247a gfortran.h: New statement-type ST_FINAL for FINAL declarations.
2008-06-02  Daniel Kraft  <d@domob.eu>

        * gfortran.h:  New statement-type ST_FINAL for FINAL declarations.
        (struct gfc_symbol):  New member f2k_derived.
        (struct gfc_namespace):  New member finalizers, for use in the above
        mentioned f2k_derived namespace.
        (struct gfc_finalizer):  New type defined for finalizers linked list.
        * match.h (gfc_match_final_decl):  New function header.
        * decl.c (gfc_match_derived_decl):  Create f2k_derived namespace
        on constructed symbol node.
        (gfc_match_final_decl):  New function to match a FINAL declaration line.
        * parse.c (decode_statement):  match-call for keyword FINAL.
        (parse_derived):  Parse CONTAINS section and accept FINAL statements.
        * resolve.c (gfc_resolve_finalizers):  New function to resolve
        (that is in this case, check) a list of finalizer procedures.
        (resolve_fl_derived):  Call gfc_resolve_finalizers here.
        * symbol.c (gfc_get_namespace):  Initialize new finalizers to NULL.
        (gfc_free_namespace):  Free finalizers list.
        (gfc_new_symbol):  Initialize new f2k_derived to NULL.
        (gfc_free_symbol):  Free f2k_derived namespace.
        (gfc_free_finalizer):  New function to free a single gfc_finalizer node.
        (gfc_free_finalizer_list):  New function to free a linked list of
        gfc_finalizer nodes.

2008-06-02  Daniel Kraft  <d@domob.eu>

        * finalize_1.f08:  New test.
        * finalize_2.f03:  New test.
        * finalize_3.f03:  New test.
        * finalize_4.f03:  New test.
        * finalize_5.f03:  New test.
        * finalize_6.f90:  New test.
        * finalize_7.f03:  New test.
        * finalize_8.f03:  New test.

From-SVN: r136293
2008-06-02 22:03:03 +02:00
Francois-Xavier Coudert d393bbd737 intrinsic.c (char_conversions, ncharconv): New static variables.
* intrinsic.c (char_conversions, ncharconv): New static variables.
	(find_char_conv): New function.
	(add_functions): Add simplification functions for ADJUSTL and
	ADJUSTR. Don't check the kind of their argument. Add checking for
	LGE, LLE, LGT and LLT.
	(add_subroutines): Fix argument type for SLEEP. Fix argument name
	for SYSTEM.
	(add_char_conversions): New function.
	(gfc_intrinsic_init_1): Call add_char_conversions.
	(gfc_intrinsic_done_1): Free char_conversions.
	(check_arglist): Use kind == 0 as a signal that we don't want
	the kind value to be checked.
	(do_simplify): Also simplify character functions.
	(gfc_convert_chartype): New function
	* trans-array.c (gfc_trans_array_ctor_element): Don't force the
	use of default character type.
	(gfc_trans_array_constructor_value): Likewise.
	(get_array_ctor_var_strlen): Use integer kind to build an integer
	instead of a character kind!
	(gfc_build_constant_array_constructor): Don't force the use of
	default character type.
	(gfc_conv_loop_setup): Likewise.
	* trans-expr.c (gfc_conv_string_tmp): Don't force the use of
	default character type. Allocate enough memory for wide strings.
	(gfc_conv_concat_op): Make sure operand kind are the same.
	(string_to_single_character): Remove gfc_ prefix. Reindent.
	Don't force the use of default character type.
	(gfc_conv_scalar_char_value): Likewise.
	(gfc_build_compare_string): Call string_to_single_character.
	(fill_with_spaces): New function
	(gfc_trans_string_copy): Add kind arguments. Use them to deal
	with wide character kinds.
	(gfc_conv_statement_function): Whitespace fix. Call
	gfc_trans_string_copy with new kind arguments.
	(gfc_conv_substring_expr): Call gfc_build_wide_string_const
	instead of using gfc_widechar_to_char.
	(gfc_conv_string_parameter): Don't force the use of default
	character type.
	(gfc_trans_scalar_assign): Pass kind args to gfc_trans_string_copy.
	* intrinsic.h (gfc_check_lge_lgt_lle_llt, gfc_convert_char_constant,
	gfc_resolve_adjustl, gfc_resolve_adjustr): New prototypes.
	* decl.c (gfc_set_constant_character_len): Don't assert the
	existence of a single character kind.
	* trans-array.h (gfc_trans_string_copy): New prototype.
	* gfortran.h (gfc_check_character_range, gfc_convert_chartype):
	New prototypes.
	* error.c (print_wide_char_into_buffer): New function lifting
	code from gfc_print_wide_char. Fix order to output '\x??' instead
	of 'x\??'.
	(gfc_print_wide_char): Call print_wide_char_into_buffer.
	(show_locus): Call print_wide_char_into_buffer with buffer local
	to this function.
	* trans-const.c (gfc_build_wide_string_const): New function.
	(gfc_conv_string_init): Deal with wide characters strings
	constructors.
	(gfc_conv_constant_to_tree): Call gfc_build_wide_string_const.
	* trans-stmt.c (gfc_trans_label_assign): Likewise.
	(gfc_trans_character_select): Deal with wide strings.
	* expr.c (gfc_check_assign): Allow conversion between character
	kinds on assignment.
	* trans-const.h (gfc_build_wide_string_const): New prototype.
	* trans-types.c (gfc_get_character_type_len_for_eltype,
	gfc_get_character_type_len): Create too variants of the old
	gfc_get_character_type_len, one getting kind argument and the
	other one directly taking a type tree.
	* trans.h (gfor_fndecl_select_string_char4,
	gfor_fndecl_convert_char1_to_char4,
	gfor_fndecl_convert_char4_to_char1): New prototypes.
	* trans-types.h (gfc_get_character_type_len_for_eltype): New
	prototype.
	* resolve.c (resolve_operator): Exit early when kind mismatches
	are detected, because that makes us issue an error message later.
	(validate_case_label_expr): Fix wording of error message.
	* iresolve.c (gfc_resolve_adjustl, gfc_resolve_adjustr): New
	functions.
	(gfc_resolve_pack): Call _char4 variants of library function
	when dealing with wide characters.
	(gfc_resolve_reshape): Likewise.
	(gfc_resolve_spread): Likewise.
	(gfc_resolve_transpose): Likewise.
	(gfc_resolve_unpack): Likewise.
	* target-memory.c (size_character): Take character kind bit size
	correctly into account (not that it changes anything for now, but
	it's more generic).
	(gfc_encode_character): Added gfc_ prefix. Encoding each
	character of a string by calling native_encode_expr for the
	corresponding unsigned integer.
	(gfc_target_encode_expr): Add gfc_ prefix to encode_character.
	* trans-decl.c (gfc_build_intrinsic_function_decls): Build
	gfor_fndecl_select_string_char4, gfor_fndecl_convert_char1_to_char4
	and gfor_fndecl_convert_char4_to_char1.
	* target-memory.h (gfc_encode_character): New prototype.
	* arith.c (gfc_check_character_range): New function.
	(eval_intrinsic): Allow non-default character kinds.
	* check.c (gfc_check_access_func): Only allow default
	character kind arguments.
	(gfc_check_chdir): Likewise.
	(gfc_check_chdir_sub): Likewise.
	(gfc_check_chmod): Likewise.
	(gfc_check_chmod_sub): Likewise.
	(gfc_check_lge_lgt_lle_llt): New function.
	(gfc_check_link): Likewise.
	(gfc_check_link_sub): Likewise.
	(gfc_check_symlnk): Likewise.
	(gfc_check_symlnk_sub): Likewise.
	(gfc_check_rename): Likewise.
	(gfc_check_rename_sub): Likewise.
	(gfc_check_fgetputc_sub): Likewise.
	(gfc_check_fgetput_sub): Likewise.
	(gfc_check_stat): Likewise.
	(gfc_check_stat_sub): Likewise.
	(gfc_check_date_and_time): Likewise.
	(gfc_check_ctime_sub): Likewise.
	(gfc_check_fdate_sub): Likewise.
	(gfc_check_gerror): Likewise.
	(gfc_check_getcwd_sub): Likewise.
	(gfc_check_getarg): Likewise.
	(gfc_check_getlog): Likewise.
	(gfc_check_hostnm): Likewise.
	(gfc_check_hostnm_sub): Likewise.
	(gfc_check_ttynam_sub): Likewise.
	(gfc_check_perror): Likewise.
	(gfc_check_unlink): Likewise.
	(gfc_check_unlink_sub): Likewise.
	(gfc_check_system_sub): Likewise.
	* primary.c (got_delim): Perform correct character range checking
	for all kinds.
	* trans-intrinsic.c (gfc_conv_intrinsic_conversion): Generate
	calls to library functions convert_char4_to_char1 and
	convert_char1_to_char4 for character conversions.
	(gfc_conv_intrinsic_char): Allow all character kings.
	(gfc_conv_intrinsic_strcmp): Fix whitespace.
	(gfc_conv_intrinsic_repeat): Take care of all character kinds.
	* intrinsic.texi: For all GNU intrinsics accepting character
	arguments, mention that they're restricted to the default kind.
	* simplify.c (simplify_achar_char): New function.
	(gfc_simplify_achar, gfc_simplify_char): Call simplify_achar_char.
	gfc_simplify_ichar): Don't error out for wide characters.
	(gfc_convert_char_constant): New function.

	* gfortran.dg/achar_3.f90: Adjust error messages.
	* gfortran.dg/achar_5.f90: New test.
	* gfortran.dg/achar_6.F90: New test.
	* gfortran.dg/widechar_1.f90: New test.
	* gfortran.dg/widechar_2.f90: New test.
	* gfortran.dg/widechar_3.f90: New test.
	* gfortran.dg/widechar_4.f90: New test.
	* gfortran.dg/widechar_intrinsics_1.f90: New test.
	* gfortran.dg/widechar_intrinsics_2.f90: New test.
	* gfortran.dg/widechar_intrinsics_3.f90: New test.
	* gfortran.dg/widechar_intrinsics_4.f90: New test.
	* gfortran.dg/widechar_intrinsics_5.f90: New test.
	* gfortran.dg/widechar_select_1.f90: New test.
	* gfortran.dg/widechar_select_2.f90: New test.

From-SVN: r135515
2008-05-18 22:45:05 +00:00
Daniel Kraft c03fc95db3 re PR fortran/27997 (Fortran 2003: Support type-spec for array constructor)
2008-04-16  Daniel Kraft  <d@domob.eu>

        PR fortran/27997
        * gfortran.h:  Added field "length_from_typespec" to gfc_charlength.
        * aray.c (gfc_match_array_constructor):  Added code to parse
        * typespec.
        (check_element_type, check_constructor_type, gfc_check_constructor_type):
        Extended to support explicit typespec on constructor.
        (gfc_resolve_character_array_constructor):  Pad strings correctly for
        explicit, constant character length.
        * trans-array.c:  New static global variable
        * "typespec_chararray_ctor"
        (gfc_trans_array_constructor):  New code to support explicit but dynamic
        character lengths.

2008-04-16  Daniel Kraft  <d@domob.eu>

        PR fortran/27997
        * gfortran.dg/array_constructor_type_1.f03:  New test
        * gfortran.dg/array_constructor_type_2.f03:  New test
        * gfortran.dg/array_constructor_type_3.f03:  New test
        * gfortran.dg/array_constructor_type_4.f03:  New test
        * gfortran.dg/array_constructor_type_5.f03:  New test
        * gfortran.dg/array_constructor_type_6.f03:  New test
        * gfortran.dg/array_constructor_type_7.f03:  New test
        * gfortran.dg/array_constructor_type_8.f03:  New test
        * gfortran.dg/array_constructor_type_9.f:  New test
        * gfortran.dg/array_constructor_type_10.f03:  New test
        * gfortran.dg/array_constructor_type_11.f03:  New test
        * gfortran.dg/array_constructor_type_12.f03:  New test
        * gfortran.dg/array_constructor_type_13.f90:  New test
        * gfortran.dg/array_constructor_type_14.f03:  New test
        * gfortran.dg/array_constructor_type_15.f03:  New test
        * gfortran.dg/array_constructor_type_16.f03:  New test
        * gfortran.dg/array_constructor_type_17.f03:  New test
        * gfortran.dg/array_constructor_type_18.f03:  New test

From-SVN: r135439
2008-05-16 21:50:04 +02:00
Francois-Xavier Coudert 374929b22f trans-expr.c (gfc_conv_concat_op): Take care of nondefault character kinds.
* trans-expr.c (gfc_conv_concat_op): Take care of nondefault
	character kinds.
	(gfc_build_compare_string): Add kind argument and use it.
	(gfc_conv_statement_function): Fix indentation.
	* gfortran.h (gfc_character_info): New structure.
	(gfc_character_kinds): New array.
	* trans-types.c (gfc_character_kinds, gfc_character_types,
	gfc_pcharacter_types): New array.
	(gfc_init_kinds): Fill character kinds array.
	(validate_character): Take care of nondefault character kinds.
	(gfc_build_uint_type): New function.
	(gfc_init_types): Take care of nondefault character kinds.
	(gfc_get_char_type, gfc_get_pchar_type): New functions.
	(gfc_get_character_type_len): Use gfc_get_char_type.
	* trans.h (gfc_build_compare_string): Adjust prototype.
	(gfor_fndecl_compare_string_char4, gfor_fndecl_concat_string_char4,
	gfor_fndecl_string_len_trim_char4, gfor_fndecl_string_index_char4,
	gfor_fndecl_string_scan_char4, gfor_fndecl_string_verify_char4,
	gfor_fndecl_string_trim_char4, gfor_fndecl_string_minmax_char4,
	gfor_fndecl_adjustl_char4, gfor_fndecl_adjustr_char4): New
	prototypes.
	* trans-types.h (gfc_get_char_type, gfc_get_pchar_type): New
	prototypes.
	* trans-decl.c (gfor_fndecl_compare_string_char4,
	gfor_fndecl_string_len_trim_char4, gfor_fndecl_string_index_char4,
	gfor_fndecl_string_scan_char4, gfor_fndecl_string_verify_char4,
	gfor_fndecl_string_trim_char4, gfor_fndecl_string_minmax_char4,
	gfor_fndecl_adjustl_char4, gfor_fndecl_adjustr_char4,
	gfor_fndecl_concat_string_char4): New function decls.
	(gfc_build_intrinsic_function_decls): Define new *_char4 function
	decls.
	* trans-intrinsic.c (gfc_conv_intrinsic_minmax_char,
	gfc_conv_intrinsic_len_trim, gfc_conv_intrinsic_ichar,
	gfc_conv_intrinsic_strcmp, gfc_conv_intrinsic_trim,
	gfc_conv_intrinsic_function): Deal with nondefault character kinds.

From-SVN: r135397
2008-05-15 21:12:53 +00:00
Sa Liu 7306b62814 Add new parameter to NAMED_INTCST.
From-SVN: r135337
2008-05-15 12:45:49 +00:00
Francois-Xavier Coudert 006601890b arith.c: (gfc_arith_concat...
* arith.c: (gfc_arith_concat, gfc_compare_string,
	gfc_compare_with_Cstring, hollerith2representation,
	gfc_hollerith2int, gfc_hollerith2real, gfc_hollerith2complex,
	gfc_hollerith2character, gfc_hollerith2logical): Use wide
	characters for character constants.
	* data.c (create_character_intializer): Likewise.
	* decl.c (gfc_set_constant_character_len): Likewise.
	* dump-parse-tree.c (show_char_const): Correctly dump wide
	character strings.
	error.c (print_wide_char): Rename into gfc_print_wide_char.
	(show_locus): Adapt to new prototype of gfc_print_wide_char.
	expr.c (free_expr0): Representation is now disjunct from
	character string value, so we always free it.
	(gfc_copy_expr, find_substring_ref, gfc_simplify_expr): Adapt
	to wide character strings.
	* gfortran.h (gfc_expr): Make value.character.string a wide string.
	(gfc_wide_toupper, gfc_wide_strncasecmp, gfc_wide_memset,
	gfc_widechar_to_char, gfc_char_to_widechar): New prototypes.
	(gfc_get_wide_string): New macro.
	(gfc_print_wide_char): New prototype.
	* io.c (format_string): Make a wide string.
	(next_char, gfc_match_format, compare_to_allowed_values, 
	gfc_match_open): Deal with wide strings.
	* module.c (mio_expr): Convert between wide strings and ASCII ones.
	* primary.c (match_hollerith_constant, match_charkind_name): 
	Handle wide strings.
	* resolve.c (build_default_init_expr): Likewise.
	* scanner.c (gfc_wide_toupper, gfc_wide_memset,
	gfc_char_to_widechar): New functions.
	(wide_strchr, gfc_widechar_to_char, gfc_wide_strncasecmp):
	Changes in prototypes.
	(gfc_define_undef_line, load_line, preprocessor_line,
	include_line, load_file, gfc_read_orig_filename): Handle wide
	strings.
	* simplify.c (gfc_simplify_achar, gfc_simplify_adjustl,
	gfc_simplify_adjustr, gfc_simplify_char, gfc_simplify_iachar,
	gfc_simplify_ichar, simplify_min_max, gfc_simplify_new_line,
	gfc_simplify_repeat): Handle wide strings.
	(wide_strspn, wide_strcspn): New helper functions.
	(gfc_simplify_scan, gfc_simplify_trim, gfc_simplify_verify):
	Handle wide strings.
	* symbol.c (generate_isocbinding_symbol): Likewise.
	* target-memory.c (size_character, gfc_target_expr_size,
	encode_character, gfc_target_encode_expr, gfc_interpret_character,
	gfc_target_interpret_expr): Handle wide strings.
	* trans-const.c (gfc_conv_string_init): Lower wide strings to
	narrow ones.
	(gfc_conv_constant_to_tree): Likewise.
	* trans-expr.c (gfc_conv_substring_expr): Handle wide strings.
	* trans-io.c (gfc_new_nml_name_expr): Likewise.
	* trans-stmt.c (gfc_trans_label_assign): Likewise.

From-SVN: r135006
2008-05-06 21:06:20 +00:00
Francois-Xavier Coudert 8fc541d3a5 openmp.c (gfc_match_omp_eos): Use gfc_next_ascii_char and gfc_peek_ascii_char.
* openmp.c (gfc_match_omp_eos): Use gfc_next_ascii_char and
	gfc_peek_ascii_char.
	* decl.c (gfc_match_kind_spec, gfc_match_type_spec,
	gfc_match_implicit_none, match_implicit_range, gfc_match_implicit,
	match_string_p, match_attr_spec, gfc_match_suffix,
	match_procedure_decl, gfc_match_entry, gfc_match_subroutine):
	Likewise.
	* gfortran.h (gfc_char_t): New type.
	(gfc_linebuf): Make line member a gfc_char_t.
	(locus): Make nextc member a gfc_char_t.
	(gfc_wide_is_printable, gfc_wide_is_digit, gfc_wide_fits_in_byte,
	gfc_wide_tolower, gfc_wide_strlen, gfc_next_ascii_char,
	gfc_peek_ascii_char, gfc_check_digit): New prototypes.
	* error.c (print_wide_char): New function.
	(show_locus): Use print_wide_char and gfc_wide_strlen.
	* io.c (next_char): Use gfc_char_t type.
	(match_io): Use gfc_peek_ascii_char and gfc_next_ascii_char.
	* match.c (gfc_match_parens, gfc_match_eos,
	gfc_match_small_literal_int, gfc_match_name, gfc_match_name_C,
	gfc_match_intrinsic_op, gfc_match_char,  gfc_match_return,
	gfc_match_common): Likewise.
	* match.h (gfc_match_special_char): Change prototype.
	* parse.c (decode_specification_statement, decode_statement,
	decode_omp_directive, next_free, next_fixed): Use
	gfc_peek_ascii_char and gfc_next_ascii_char.
	* primary.c (gfc_check_digit): Change name.
	(match_digits, match_hollerith_constant, match_boz_constant,
	match_real_constant, next_string_char, match_charkind_name,
	match_string_constant, match_logical_constant_string,
	match_complex_constant, match_actual_arg, match_varspec,
	gfc_match_rvalue, match_variable): Use gfc_peek_ascii_char and
	gfc_next_ascii_char.
	* scanner.c (gfc_wide_fits_in_byte, wide_is_ascii,
	gfc_wide_is_printable, gfc_wide_tolower, gfc_wide_is_digit,
	gfc_wide_is_digit, wide_atoi, gfc_wide_strlen, wide_strcpy,
	wide_strchr, widechar_to_char, wide_strncmp, wide_strncasecmp,
	gfc_next_ascii_char, gfc_peek_ascii_char):
	New functions.
	(next_char, gfc_define_undef_line, skip_free_comments,
	gfc_next_char_literal, gfc_next_char, gfc_peek_char,
	gfc_error_recovery, load_line, preprocessor_line, include_line,
	load_file, gfc_read_orig_filename): Use gfc_char_t for source
	characters and the {gfc_,}wide_* functions to manipulate wide
	strings.

From-SVN: r134992
2008-05-06 18:28:32 +00:00
Jerry DeLisle ad7ee6f8d5 re PR fortran/33268 (read ('(f3.3)'), a rejected due to the extra (...))
2008-05-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/33268
	* gfortran.h: Add extra_comma pointer to gfc_dt structure. Add iokind to
	gfc_expr value union. Add io_kind enum to here from io.c.
	* io.c (gfc_free_dt): Free extra_comma.
	(gfc_resolve_dt): If an extra comma was encountered and io_unit is type
	BT_CHARACTER, resolve to format_expr and set default unit.  Error if
	io_kind is M_WRITE. (match_io):  Match the extra comma and set new
	pointer, extra_comma.

From-SVN: r134900
2008-05-03 15:11:33 +00:00
Janus Weil 32d99e6869 gfortran.h (struct gfc_symbol): Moving "interface" member to gfc_typespec (plus fixing a small docu error).
* gfortran.h (struct gfc_symbol): Moving "interface" member to
	gfc_typespec (plus fixing a small docu error).
	* interface.c (gfc_procedure_use): Ditto.
	* decl.c (match_procedure_decl): Ditto.
	* resolve.c (resolve_specific_f0,
	resolve_specific_f0, resolve_symbol): Ditto.

From-SVN: r134867
2008-05-01 19:38:04 +00:00
François-Xavier Coudert a39faface6 intrinsic.c (add_functions): Add SELECTED_CHAR_KIND intrinsic.
* intrinsic.c (add_functions): Add SELECTED_CHAR_KIND intrinsic.
	* intrinsic.h (gfc_check_selected_char_kind,
	gfc_simplify_selected_char_kind): New prototypes.
	* gfortran.h (gfc_isym_id): Add GFC_ISYM_SC_KIND.
	* trans.h (gfor_fndecl_sc_kind): New function decl.
	* trans-decl.c (gfor_fndecl_sc_kind): Build new decl.
	* arith.c (gfc_compare_with_Cstring): New function.
	* arith.h (gfc_compare_with_Cstring): New prototype.
	* check.c (gfc_check_selected_char_kind): New function.
	* primary.c (match_string_constant, match_kind_param): Mark
	symbols used as literal constant kind param as referenced.
	* trans-intrinsic.c (gfc_conv_intrinsic_sc_kind): New function.
	(gfc_conv_intrinsic_function): Call gfc_conv_intrinsic_sc_kind.
	* intrinsic.texi (SELECTED_CHAR_KIND): Document new intrinsic.
	* simplify.c (gfc_simplify_selected_char_kind): New function.

	* intrinsics/selected_char_kind.c: New file.
	* Makefile.am: Add intrinsics/selected_char_kind.c.
	* Makefile.in: Regenerate.

	* gfortran.dg/selected_char_kind_1.f90: New test.
	* gfortran.dg/selected_char_kind_2.f90: New test.
	* gfortran.dg/selected_char_kind_3.f90: New test.

From-SVN: r134839
2008-04-30 21:45:02 +00:00
François-Xavier Coudert 6c1abb5c58 dump-parse-tree.c: Use fprintf, fputs and fputc instead of gfc_status and gfc_status_char.
* dump-parse-tree.c: Use fprintf, fputs and fputc instead of
	gfc_status and gfc_status_char. Remove gfc_ prefix of the gfc_show_*
	functions and make them static. Add new gfc_dump_parse_tree
	function.
	* gfortran.h (gfc_option_t): Rename verbose into dump_parse_tree.
	(gfc_status, gfc_status_char): Delete prototypes.
	* error.c (gfc_status, gfc_status_char): Remove functions.
	* scanner.c (gfc_new_file): Use printf instead of gfc_status.
	* options.c (gfc_init_options): Rename verbose into dump_parse_tree.
	(gfc_handle_module_path_options): Use gfc_fatal_error instead of
	gfc_status and exit.
	(gfc_handle_option): Rename verbose into dump_parse_tree.

From-SVN: r133958
2008-04-06 12:17:33 +00:00
Jerry DeLisle 6f0f0b2eca PR fortran/25829 28655
2008-04-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR fortran/25829 28655
	* dump-parse-tree.c (gfc_show_code_node): Show new I/O parameters.
	* gfortran.h (gfc_statement): Add ST_WAIT enumerator.
	(gfc_open): Add pointers for decimal, encoding, round, sign,
	asynchronous. (gfc_inquire): Add pointers for asynchronous, decimal,
	encoding, pending, round, sign, size, id.
	(gfc_wait): New typedef struct. (gfc_dt): Add pointers for id, pos,
	asynchronous, blank, decimal, delim, pad, round, sign.
	(gfc_exec_op): Add EXEC_WAIT enumerator. (gfc_code): Add pointer for
	wait. (gfc_free_wait), (gfc_resolve_wait): New function prototypes.
	* trans-stmt.h (gfc_trans_wait): New function prototype.
	* trans.c (gfc_trans_code): Add case for EXEC_WAIT.
	* io.c (io_tag): Add new tags for DECIMAL, ENCODING, ROUND, SIGN,
	ASYCHRONOUS, ID. (match_open_element): Add matchers for new tags.
	(gfc_free_open): Free new pointers. (gfc_resolve_open): Resolve new
	tags. (gfc_resolve_open): Remove comment around check for allowed
	values and ASYNCHRONOUS, update it.  Likewise for DECIMAL, ENCODING,
	ROUND, and SIGN. (match_dt_element): Add matching for new tags.
	(gfc_free_wait): New function. (gfc_resolve_wait): New function.
	(match_wait_element): New function. (gfc_match_wait): New function.
	* resolve.c (gfc_resolve_blocks): Add case for EXEC_WAIT.
	(resolve_code): Add case for EXEC_WAIT. 
	* st.c (gfc_free_statement): Add case for EXEC_WAIT.
	* trans-io.c (ioparam_type): Add IOPARM_ptype_wait. (gfc_st_parameter):
	Add "wait" entry. (iocall): Add IOCALL_WAIT enumerator.
	(gfc_build_io_library_fndecls): Add function declaration for st_wait.
	(gfc_trans_open): Add mask bits for new I/O tags.
	(gfc_trans_inquire): Add mask bits for new I/O tags.
	(gfc_trans_wait): New translation function.
	(build_dt): Add mask bits for new I/O tags.
	* match.c (gfc_match_if) Add matcher for "wait".
	* match.h (gfc_match_wait): Prototype for new function.
	* ioparm.def: Add new I/O parameter definitions.
	* parse.c (decode_statement): Add match for "wait" statement.
	(next_statement): Add case for ST_WAIT. (gfc_ascii_statement): Same.

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

From-SVN: r133944
2008-04-05 22:23:27 +00:00
François-Xavier Coudert f489fba128 re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197

gcc/fortran/
	* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
	ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
	ERFC_SCALED, LOG_GAMMA and HYPOT.
	* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
	gfc_resolve_hypot): New prototypes.
	* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
	ACOSH, ASINH and ATANH available.
	* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
	* lang.opt: Add -std=f2008 option.
	* libgfortran.h: Define GFC_STD_F2008.
	* lang-specs.h: Add .f08 and .F08 file suffixes.
	* iresolve.c (gfc_resolve_hypot): New function.
	* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
	* check.c (gfc_check_hypot): New function.
	* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
	* options.c (set_default_std_flags): Allow Fortran 2008 by default.
	(form_from_filename): Add .f08 suffix.
	(gfc_handle_option): Handle -std=f2008 option.
	* simplify.c (gfc_simplify_hypot): New function.
	* gfortran.texi: Document Fortran 2008 status and file extensions.
	* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
	as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
	ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
	* invoke.texi: Document the new -std=f2008 option.

libgomp/
	* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
	.F08 file suffixes.

gcc/testsuite/
	* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
	* gfortran.dg/dg.exp: Likewise.
	* gfortran.dg/vect/vect.exp: Likewise.
	* gfortran.fortran-torture/execute/execute.exp: Likewise.
	* gfortran.fortran-torture/compile/compile.exp: Likewise.
	* gfortran.dg/gamma_1.f90: Also check log_gamma.
	* gfortran.dg/invalid_contains_1.f90: Remove warning about
	empty CONTAINS.
	* gfortran.dg/gamma_2.f90: Add a few error messages.
	* gfortran.dg/invalid_contains_2.f90: Remove warning about
	empty CONTAINS.
	* gfortran.dg/gamma_3.f90: Adjust error message.
	* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
	* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
	* gfortran.dg/bessel_1.f90: New test.
	* gfortran.dg/recursive_check_3.f90: Remove warnings.
	* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
	* gfortran.dg/derived_function_interface_1.f90: Remove warning.
	* gfortran.dg/contains_empty_1.f03: New test.
	* gfortran.dg/erfc_scaled_1.f90: New test.
	* gfortran.dg/hypot_1.f90: New test.
	* gfortran.dg/contains_empty_2.f03: New test.

libgfortran/
	* intrinsics/erfc_scaled_inc.c: New file.
	* intrinsics/erfc_scaled.c: New file.
	* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
	* Makefile.am: Add intrinsics/erfc_scaled.c.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

From-SVN: r132846
2008-03-03 23:46:20 +00:00
Tom Tromey 2d593c86cf system.h (USE_MAPPED_LOCATION): Poison.
gcc
	* system.h (USE_MAPPED_LOCATION): Poison.
	* Makefile.in (GTFILES): Put CPP_ID_DATA_H first.
	* tree-cfg.c (make_cond_expr_edges): Remove old location code.
	(make_goto_expr_edges): Likewise.
	(remove_bb): Likewise.
	(execute_warn_function_return): Likewise.
	* basic-block.h (struct edge_def) <goto_locus>: Change type to
	location_t.
	* c-common.c (fname_decl): Remove old location code.
	* tree-vect-transform.c (vect_finish_stmt_generation): Remove old
	location code.
	* rtl.h (ASM_OPERANDS_SOURCE_LOCATION): Remove old-location
	variant.
	(ASM_INPUT_SOURCE_LOCATION): Likewise.
	(gen_rtx_ASM_INPUT): Likewise.
	(gen_rtx_ASM_INPUT_loc): Likewise.
	(get_rtx_asm_OPERANDS): Remove.
	* cfglayout.c (insn_locators_alloc): Remove old location code.
	(set_curr_insn_source_location): Likewise.
	(curr_insn_locator): Likewise.
	* print-tree.c (print_node): Remove old location code.
	* tree-mudflap.c (mf_varname_tree): Remove old location code.
	(mf_file_function_line_tree): Remove test of USE_MAPPED_LOCATION.
	* cfgexpand.c (expand_gimple_cond_expr): Don't use
	location_from_locus.
	(construct_exit_block): Remove old location code.
	* emit-rtl.c (force_next_line_note): Remove old location code.
	* profile.c (branch_prob): Remove old location code.
	* tree-vectorizer.h (LOC, UNKNOWN_LOC, EXPR_LOC, LOC_FILE,
	LOC_LINE): Remove old-location variants.
	* langhooks.c (lhd_print_error_function): Remove old location
	code.
	* configure, config.in: Rebuilt.
	* configure.ac (--enable-mapped-location): Remove.
	* c-decl.c (c_init_decl_processing): Remove old location code.
	(finish_function): Likewise.
	* recog.c (decode_asm_operands): Remove old location code.
	* c-pch.c (c_common_read_pch): Remove old location code.
	* rtl.def (ASM_INPUT, ASM_OPERANDS): Remove old location
	variants.
	* gimple-low.c (lower_function_body): Remove old location code.
	* toplev.c (unknown_location): Remove.
	(push_srcloc): Remove old-location variant.
	(process_options): Remove old location code.
	(lang_dependent_init): Likewise.
	* input.h (UNKNOWN_LOCATION): Move definition.
	(location_t): Undeprecate.
	(source_locus): Remove.
	(location_from_locus): Remove.
	(struct location_s): Remove.
	Remove all old-location code.
	(input_line, input_filename): Remove.
	* final.c (final_scan_insn): Remove old location code.
	* diagnostic.c (diagnostic_build_prefix): Remove
	USE_MAPPED_LOCATION test.
	* tree.h (gimple_stmt) <locus>: Now a location_t.
	(tree_exp) <locus>: Likewise.
	(DECL_IS_BUILTIN): Remove old-location variant.
	(annotate_with_file_line, annotate_with_locus): Likewise.
	(expr_locus, set_expr_locus): Update.
	* tree.c (build1_stat): Remove old location code.
	(last_annotated_node): Remove.
	(annotate_with_file_line): Remove old-location variant.
	(annotate_with_locus): Likewise.
	(expr_location): Remove old location code.
	(set_expr_location): Likewise.
	(expr_has_location): Likewise.
	(expr_locus): Likewise.
	(set_expr_locus): Likewise.
	(expr_filename): Don't use location_from_locus.
	(expr_lineno): Likewise.
	* rtl-error.c (location_for_asm): Remove old location code.
	* c-lex.c (cb_line_change): Remove old location code.
	(fe_file_change): Likewise.
	(cb_def_pragma): Likewise.
	(c_lex_with_flags): Likewise.
	* gengtype.c (do_typedef): Don't special-case location types.
	(define_location_structures): Remove.
	(main): Don't call define_location_structures.
	* tree-pretty-print.c (dump_implicit_edges): Remove old location
	code.
gcc/ada
	* misc.c (internal_error_function): Remove test of
	USE_MAPPED_LOCATION.
	* trans.c (gigi): Remove test of USE_MAPPED_LOCATION.
	(Sloc_to_locus): Remove old location code.
gcc/cp
	* parser.c (eof_token): Remove old location code.
	(check_empty_body): Remove test of USE_MAPPED_LOCATION.
	* decl2.c (generate_ctor_or_dtor_function): Remove old location
	code.
	(cp_write_global_declarations): Likewise.
	* lex.c (cxx_init): Remove old location code.
	(handle_pragma_implementation): Remove test of
	USE_MAPPED_LOCATION.
	* pt.c (tsubst): Remove old location code.
	* error.c (cp_print_error_function): Remove test of
	USE_MAPPED_LOCATION.
	* decl.c (pop_label): Remove old location code.
	(finish_function): Likewise.
gcc/fortran
	* trans-io.c (set_error_locus): Remove old location code.
	* trans-decl.c (gfc_set_decl_location): Remove old location code.
	* f95-lang.c (gfc_init): Remove test of USE_MAPPED_LOCATION.
	* scanner.c (gfc_gobble_whitespace): Remove old location code.
	(get_file): Likewise.
	(preprocessor_line): Likewise.
	(load_file): Likewise.
	(gfc_new_file): Likewise.
	* trans.c (gfc_trans_runtime_check): Remove old location code.
	(gfc_get_backend_locus): Likewise.
	(gfc_set_backend_locus): Likewise.
	* data.c (gfc_assign_data_value): Remove old location code.
	* error.c (show_locus): Remove old location code.
	* gfortran.h (gfc_linebuf): Remove old location code.
	(gfc_linebuf_linenum): Remove old-location variant.
gcc/java
	* lang.c (java_post_options): Remove conditional.
	* expr.c (expand_byte_code): Remove old location code.
	* jcf-parse.c (set_source_filename): Remove old location code.
	(give_name_to_class): Likewise.
	(jcf_parse): Likewise.
	(duplicate_class_warning): Likewise.
	(parse_class_file): Likewise.
	(java_parse_file): Likewise.
	* decl.c (finish_method): Remove old location code.
	* class.c (push_class): Remove old location code.
gcc/objc
	* objc-act.c (objc_init): Remove old location code.
gcc/treelang
	* tree1.c (treelang_init): Remove old location code.
	(treelang_parse_file): Likewise.
	* lex.l (LINEMAP_POSITION_FOR_COLUMN): Remove.
	(update_lineno_charno): Remove old location code.

From-SVN: r132679
2008-02-26 16:05:24 +00:00
Tobias Schlüter 835aac9231 arith.c: Update copyright years.
* arith.c: Update copyright years.
* arith.h: Likewise.
* array.c: Likewise.
* bbt.c: Likewise.
* check.c: Likewise.
* data.c: Likewise.
* data.h: Likewise.
* decl.c: Likewise.
* dependency.c: Likewise.
* dependency.h: Likewise.
* dump-parse-tree.c: Likewise.
* error.c: Likewise.
* expr.c: Likewise.
* gfc-internals.texi: Likewise.
* gfortran.h: Likewise.
* gfortran.texi: Likewise.
* gfortranspec.c: Likewise.
* interface.c: Likewise.
* intrinsic.c: Likewise.
* intrinsic.h: Likewise.
* intrinsic.texi: Likewise.
* invoke.texi: Likewise.
* io.c: Likewise.
* iresolve.c: Likewise.
* iso-c-binding.def: Likewise.
* iso-fortran-env.def: Likewise.
* lang-specs.h: Likewise.
* lang.opt: Likewise.
* libgfortran.h: Likewise.
* match.c: Likewise.
* match.h: Likewise.
* matchexp.c: Likewise.
* misc.c: Likewise.
* module.c: Likewise.
* openmp.c: Likewise.
* options.c: Likewise.
* parse.c: Likewise.
* parse.h: Likewise.
* primary.c: Likewise.
* resolve.c: Likewise.
* scanner.c: Likewise.
* simplify.c: Likewise.
* st.c: Likewise.
* symbol.c: Likewise.
* target-memory.c: Likewise.
* target-memory.h: Likewise.
* trans-array.h: Likewise.
* trans-const.h: Likewise.
* trans-stmt.h: Likewise.
* trans-types.c: Likewise.
* trans-types.h: Likewise.
* types.def: Likewise.

From-SVN: r132600
2008-02-24 22:43:48 +01:00
Paul Thomas a99d95a270 re PR fortran/34975 (Bogus error with USEing modules)
2008-01-30  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34975
	* symbol.c (gfc_delete_symtree, gfc_undo_symbols): Rename
	delete_symtree to gfc_delete_symtree.
	* gfortran.h : Add prototype for gfc_delete_symtree.
	* module.c (load_generic_interfaces): Transfer symbol to a
	unique symtree and delete old symtree, instead of renaming.
	(read_module): The rsym and the found symbol are the same, so
	the found symtree can be deleted.

	PR fortran/34429
	* decl.c (match_char_spec): Remove the constraint on deferred
	matching of functions and free the length expression.
	delete_symtree to gfc_delete_symtree.
	(gfc_match_type_spec): Whitespace.
	(gfc_match_function_decl): Defer characteristic association for
	all types except BT_UNKNOWN.
	* parse.c (decode_specification_statement): Only derived type
	function matching is delayed to the end of specification.

2008-01-30  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34975
	* gfortran.dg/use_only_3.f90: New test.
	* gfortran.dg/use_only_3.inc: Modules for new test.

	PR fortran/34429
	* gfortran.dg/function_charlen_2.f90: New test.

From-SVN: r131956
2008-01-30 06:56:10 +00:00
Daniel Franke 79f40de682 re PR fortran/33375 (ICE (segfault) gfortran.dg/common_6.f90)
2008-01-24  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/33375
        PR fortran/34858
        * gfortran.h: Revert changes from 2008-01-17.
        * match.c: Likewise.
        * symbol.c: Likewise.
        (gfc_undo_symbols): Undo namespace changes related to common blocks.

From-SVN: r131811
2008-01-24 16:36:14 -05:00
H.J. Lu c018444469 re PR fortran/33375 (ICE (segfault) gfortran.dg/common_6.f90)
2008-01-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR fortran/33375
	* symbol.c (free_common_tree): Renamed to ...
	(gfc_free_common_tree): This.  Remove static.
	(gfc_free_namespace): Updated.

	* gfortran.h (gfc_free_common_tree): New.

	* match.c (gfc_match_common): Call gfc_free_common_tree () with
	gfc_current_ns->common_root and set gfc_current_ns->common_root
	to NULL on syntax error.

From-SVN: r131621
2008-01-17 17:29:11 -08:00
Paul Thomas 1c8bcdf715 re PR fortran/34429 (Fails: character(len=use_associated_const) function foo())
2008-01-17  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34429
	PR fortran/34431
	PR fortran/34471
	* decl.c : Remove gfc_function_kind_locus and
	gfc_function_type_locus. Add gfc_matching_function.
	(match_char_length): If matching a function and the length
	does not match, return MATCH_YES and try again later.
	(gfc_match_kind_spec): The same.
	(match_char_kind): The same.
	(gfc_match_type_spec): The same for numeric and derived types.
	(match_prefix): Rename as gfc_match_prefix.
	(gfc_match_function_decl): Except for function valued character
	lengths, defer applying kind, type and charlen info until the
	end of specification block.
	gfortran.h (gfc_statement): Add ST_GET_FCN_CHARACTERISTICS.
	parse.c (decode_specification_statement): New function.
	(decode_statement): Call it when a function has kind = -1. Set
	and reset gfc_matching function, as function statement is being
	matched.
	(match_deferred_characteristics): Simplify with a single call
	to gfc_match_prefix. Do appropriate error handling. In any
	case, make sure that kind = -1 is reset or corrected.
	(parse_spec): Call above on seeing ST_GET_FCN_CHARACTERISTICS.
	Throw an error if kind = -1 after last specification statement.
	parse.h : Prototype for gfc_match_prefix.

2008-01-17  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34429
	* gfortran.dg/function_charlen_1.f90: New test.

	PR fortran/34431
	* gfortran.dg/function_types_1.f90: New test.
	* gfortran.dg/function_types_2.f90: New test.

	PR fortran/34471
	* gfortran.dg/function_kinds_4.f90: New test.
	* gfortran.dg/function_kinds_5.f90: New test.

	* gfortran.dg/defined_operators_1.f90: Errors now at function
	declarations.
	* gfortran.dg/private_type_4.f90: The same.
	* gfortran.dg/interface_15.f90: The same.
	* gfortran.dg/elemental_args_check_2.f90: The same.
	* gfortran.dg/auto_internal_assumed.f90: The same.

From-SVN: r131592
2008-01-17 07:19:04 +00:00
Paul Thomas 0a164a3cd0 re PR fortran/31213 (ICE on valid code with gfortran)
2007-12-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31213
	PR fortran/33888
	PR fortran/33998
	* trans-array.c (gfc_trans_array_constructor_value): If the
	iterator variable does not have a backend_decl, use a local
	temporary.
	(get_elemental_fcn_charlen): New function to map the character
	length of an elemental function onto its actual arglist.
	(gfc_conv_expr_descriptor): Call the above so that the size of
	the temporary can be evaluated.
	* trans-expr.c : Include arith.h and change prototype of
	gfc_apply_interface_mapping_to_expr to return void.  Change all
	references to gfc_apply_interface_mapping_to_expr accordingly.
	(gfc_free_interface_mapping): Free the 'expr' field.
	(gfc_add_interface_mapping): Add an argument for the actual
	argument expression. This is copied to the 'expr' field of the
	mapping.  Only stabilize the backend_decl if the se is present.
	Copy the character length expression and only add it's backend
	declaration if se is present.  Return without working on the
	backend declaration for the new symbol if se is not present.
	(gfc_map_intrinsic_function) : To simplify intrinsics 'len',
	'size', 'ubound' and 'lbound' and then to map the result.
	(gfc_map_fcn_formal_to_actual): Performs the formal to actual
	mapping for the case of a function found in a specification
	expression in the interface being mapped.
	(gfc_apply_interface_mapping_to_ref): Remove seen_result and
	all its references. Remove the inline simplification of LEN
	and call gfc_map_intrinsic_function instead.  Change the
	order of mapping of the actual arguments and simplifying
	intrinsic functions.  Finally, if a function maps to an
	actual argument, call gfc_map_fcn_formal_to_actual.
	(gfc_conv_function_call): Add 'e' to the call to
	gfc_add_interface_mapping.
	* dump-parse-tree.c (gfc_show_symbol_n): New function for
	diagnostic purposes.
	* gfortran.h : Add prototype for gfc_show_symbol_n.
	* trans.h : Add 'expr' field to gfc_add_interface_mapping.
	Add 'expr' to prototype for gfc_show_symbol_n.
	* resolve.c (resolve_generic_f0): Set specific function as
	referenced.

2007-12-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31213
	PR fortran/33888
	PR fortran/33998
	* gfortran.dg/mapping_1.f90: New test.
	* gfortran.dg/mapping_2.f90: New test.
	* gfortran.dg/mapping_3.f90: New test.

From-SVN: r130988
2007-12-16 11:34:08 +00:00
Paul Thomas 28d08315ed re PR fortran/32129 (ICE: Procedure call with array-section-actual to scalar dummy)
2007-12-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/32129
	* dump-parse-tree.c (gfc_show_expr_n): New function for
	debugging.
	* gfortran.h : Add prototype for gfc_show_expr_n.
	* expr.c (simplify_constructor): Copy the constructor
	expression and try to simplify that.  If success, replace the
	original.  Otherwise discard the copy, keep going through
	the structure and return success.

	PR fortran/31487
	* decl.c (build_struct): Pad out default initializers with
	spaces to the component character length.

2007-12-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/32129
	* gfortran.dg/derived_comp_array_ref_6.f90: New test.
	* gfortran.dg/derived_comp_array_ref_7.f90: New test.

	PR fortran/31487
	* gfortran.dg/char_component_initializer_1.f90: New test.

From-SVN: r130719
2007-12-09 09:17:24 +00:00
Tobias Burnus 00a4618b3f re PR fortran/34342 (BOZ extensions not diagnosed as such with -std=f95)
2007-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34342
        PR fortran/34345
        PR fortran/18026
        PR fortran/29471

        * gfortran.texi (BOZ literal constants): Improve documentation
        and adapt for BOZ changes.
        * Make-lang.ini (resolve.o): Add target-memory.h dependency.
        * gfortran.h (gfc_expr): Add is_boz flag.
        * expr.c: Include target-memory.h.
        (gfc_check_assign): Support transferring BOZ for real/cmlx.
        * resolve.c: Include target-memory.h
        (resolve_ordinary_assign): Support transferring BOZ for real/cmlx.
        * target-memory.c (gfc_convert_boz): New function.
        * target-memory.c (gfc_convert_boz): Add prototype.
        * primary.c (match_boz_constant): Set is_boz, enable F95 error
        also without -pedantic, and allow for Fortran 2003 BOZ.
        (match_real_constant): Fix comment.
        * simplify.c
        * (simplify_cmplx,gfc_simplify_dble,gfc_simplify_float,
        gfc_simplify_real): Support Fortran 2003 BOZ.

2007-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34342
        PR fortran/34345
        PR fortran/18026
        PR fortran/29471

        * gfortran.dg/boz_8.f90: New.
        * gfortran.dg/boz_9.f90: New.
        * gfortran.dg/boz_10.f90: New.
        * gfortran.dg/boz_7.f90: Update dg-warning.
        * gfortran.dg/pr16433.f: Add dg-error.
        * gfortan.dg/ibits.f90: Update dg-warning.
        * gfortran.dg/unf_io_convert_1.f90: Update/delete dg-warning.
        * gfortran.dg/unf_io_convert_2.f90: Ditto.

From-SVN: r130713
2007-12-08 22:46:56 +01:00
Jakub Jelinek 1b271c9ba3 re PR fortran/34359 (ICE in December 6 version of gfortran when compiling a file with two routines that contain INCLUDE statements)
PR fortran/34359
	* gfortran.h (gfc_file): Remove sibling and down fields.
	* scanner.c (file_changes, file_changes_cur, file_changes_count,
	file_changes_allocated): New variables.
	(add_file_change, report_file_change): New functions.
	(change_file): Remove.
	(gfc_start_source_files, gfc_end_source_files): Call
	report_file_change instead of change_file.
	(gfc_advance_line): Call report_file_change instead of change_file,
	call it even if lb->file == lb->next->file.
	(get_file): Revert last changes.
	(preprocessor_line): Call add_file_change when entering or leaving
	a file.
	(load_file): Likewise.  Set file_change[...].lb for all newly added
	file changes.

	* gfortran.dg/include_1.f90: New test.
	* gfortran.dg/include_1.inc: New.
	* gfortran.dg/include_2.f90: New test.

From-SVN: r130712
2007-12-08 22:00:06 +01:00
Jakub Jelinek 60332588d6 re PR debug/33739 (Failure of gfortran.dg/literal_character_constant_1_*.F with -m64 -g on Darwin)
PR debug/33739
	* gfortran.h (gfc_file): Remove included_by field, add sibling and
	down.
	(gfc_start_source_files, gfc_end_source_files): New prototypes.
	* parse.c (gfc_parse_file): Call gfc_start_source_files and
	gfc_end_source_files instead of calling the debugging hooks directly.
	* error.c (show_locus): Use up field instead of included_by.
	* scanner.c (change_file, gfc_start_source_files,
	gfc_end_source_files): New functions.
	(gfc_advance_line): Call change_file instead of calling debug hooks
	directly.
	(get_file): Set up rather than included_by.  Initialize down and
	sibling.
	(preprocessor_line, load_file): Don't set up field here.

	* gfortran.dg/debug_2.f: New test.

From-SVN: r130629
2007-12-05 20:50:56 +01:00
Paul Thomas 0e5a218b31 re PR fortran/33541 (gfortran wrongly imports renamed-use-associated symbol unrenamed)
2007-11-27  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/33541
	*interface.c (compare_actual_formal): Exclude assumed size
	arrays from the possibility of scalar to array mapping.
	* decl.c (get_proc_name): Fix whitespace problem.

	PR fortran/34231
	* gfortran.h : Add 'use_rename' bit to symbol_attribute.
	* module.c : Add 'renamed' field to pointer_info.u.rsym.
	(load_generic_interfaces): Add 'renamed' that is set after the
	number_use_names is called.  This is used to set the attribute
	use_rename, which, in its turn identifies those symbols that
	have not been renamed.
	(load_needed): If pointer_info.u.rsym->renamed is set, then
	set the use_rename attribute of the symbol.
	(read_module): Correct an erroneous use of use_flag. Use the
	renamed flag and the use_rename attribute to determine which
	symbols are not renamed.

2007-11-27  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/33541
	* gfortran.dg/use_11.f90: New test.

	PR fortran/34231
	* gfortran.dg/generic_15.f90: New test.

From-SVN: r130471
2007-11-27 19:21:52 +00:00
Francois-Xavier Coudert 2b77e90812 re PR fortran/25252 (ICE on invalid code)
PR fortran/25252

	* interface.c (gfc_current_interface_head,
	gfc_set_current_interface_head): New functions.
	* decl.c (gfc_match_modproc): Move check for syntax error earlier.
	On syntax error, restore previous state of the interface.
	* gfortran.h (gfc_current_interface_head,
	gfc_set_current_interface_head): New prototypes.

	* gfortran.dg/interface_22.f90: New test.

From-SVN: r130259
2007-11-17 17:49:45 +00:00
Francois-Xavier Coudert ecf24057f8 gfortran.h: Shorten comment.
* gfortran.h: Shorten comment.
	* trans-types.c (gfc_get_function_type): Allow argument to have
	flavor FL_PROGRAM.
	* trans-decl.c (gfc_sym_mangled_function_id): Mangle main program
	name into MAIN__.
	(build_function_decl): Fix comment.
	* parse.c (main_program_symbol): Give the main program its proper
	name, if any. Set its flavor to FL_PROGRAM.
	(gfc_parse_file): Likewise.

From-SVN: r129869
2007-11-03 14:51:51 +00:00
Paul Thomas 640670c7f4 [multiple changes]
2007-10-29  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/31217
        PR fortran/33811
        PR fortran/33686
        * trans-array.c (gfc_conv_loop_setup): Send a complete type to
        gfc_trans_create_temp_array if the temporary is character.
        * trans-stmt.c (gfc_trans_assign_need_temp): Do likewise for
        allocate_temp_for_forall_nest.
        (forall_replace): New function.
        (forall_replace_symtree): New function.
        (forall_restore): New function.
        (forall_restore_symtree): New function.
        (forall_make_variable_temp): New function.
        (check_forall_dependencies): New function.
        (cleanup_forall_symtrees): New function.
        gfc_trans_forall_1): Add and initialize pre and post blocks.
        Call check_forall_dependencies to check for all dependencies
        and either trigger second forall block to copy temporary or
        copy lval, outside the forall construct and replace all
        dependent references. After assignment clean-up and coalesce
        the blocks at the end of the function.
        * gfortran.h : Add prototypes for gfc_traverse_expr and
        find_forall_index.
        expr.c (gfc_traverse_expr): New function to traverse expression
        and visit all subexpressions, under control of a logical flag,
        a symbol and an integer pointer. The slave function is caller
        defined and is only called on EXPR_VARIABLE.
        (expr_set_symbols_referenced): Called by above to set symbols
        referenced.
        (gfc_expr_set_symbols_referenced): Rework of this function to
        use two new functions above.
        * resolve.c (find_forall_index): Rework with gfc_traverse_expr,
        using forall_index.
        (forall_index): New function used by previous.
        * dependency.c (gfc_check_dependency): Use gfc_dep_resolver for
        all references, not just REF_ARRAY.
        (gfc_dep_resolver): Correct the logic for substrings so that
        overlapping arrays are handled correctly.

2007-10-29 Paul Thomas <pault@gcc.gnu.org>

        PR fortran/31217
        PR fortran/33811
        * gfortran.dg/forall_12.f90: New test.

        PR fortran/33686
        * gfortran.dg/forall_13.f90: New test.

From-SVN: r129720
2007-10-29 15:13:44 +01:00
Steven G. Kargl f2112868c6 re PR fortran/31244 (data initialization with more than 2**32 elements)
2007-10-22  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/31244
        * gfortran.h (gfc_data_value): Change repeat from unsigned int
        to mpz_t.
        * decl.c(top_val_list): Remove msg variable.  Use mpz_t for
        repeat count.
        * resolve.c (values):  Change left from unsigned int to mpz_t.
        (next_data_value): Change for mpz_t.
        (check_data_variable): Change ??? to FIXME in a comment.  Use
        "mpz_t left".
        (resolve_data ): Use "mpz_t left".

From-SVN: r129561
2007-10-22 22:10:42 +00:00
Francois-Xavier Coudert ca39e6f200 gfortran.h (gfc_get_data_variable, [...]): Move to decl.c.
* gfortran.h (gfc_get_data_variable, gfc_get_data_value,
	gfc_get_data): Move to decl.c.
	(global_used): Rename into gfc_global_used.
	(gfc_formalize_init_value, gfc_get_section_index,
	gfc_assign_data_value, gfc_assign_data_value_range,
	gfc_advance_section): Move to data.h.
	(gfc_set_in_match_data): Remove.
	* decl.c (gfc_get_data_variable, gfc_get_data_value,
	gfc_get_data): Move here.
	(gfc_set_in_match_data): Rename into set_in_match_data.
	(gfc_match_data): Likewise.
	(add_global_entry): Rename global_used into gfc_global_used.
	* data.c: Include data.h.
	* trans.h (gfc_todo_error): Remove.
	* trans-array.c (gfc_trans_array_constructor,
	gfc_conv_ss_startstride, gfc_conv_loop_setup): Change
	gfc_todo_error into assertions.
	* resolve.c (resolve_global_procedure): Rename global_used into
	gfc_global_used.
	* parse.c (gfc_global_used, parse_module, add_global_procedure,
	add_global_program): Likewise.
	* trans-intrinsic.c (gfc_walk_intrinsic_function): Rename
	global_used into gfc_global_used.
	* Make-lang.in: Add dependencies on fortran/data.h.
	* data.h: New file.

From-SVN: r129034
2007-10-05 12:33:07 +00:00
Francois-Xavier Coudert 9e8a672069 re PR fortran/33502 (gfortran with .F suffix and -g3 option chokes on preprocessor syntax)
PR fortran/33502
	* scanner.c (gfc_advance_line): Call debug_hooks->end_source_file
	and debug_hooks->start_source_file when appropriate, and set
	dbg_emitted.
	(gfc_define_undef_line): New function.
	(load_file): Don't error out on #define and #undef lines.
	* parse.c (next_statement): Call gfc_define_undef_line.
	(gfc_parse_file): Call debug_hooks->start_source_file and
	debug_hooks->end_source_file for the main source file if
	required.
	* gfortran.h (gfc_linebuf): Add dbg_emitted field.
	(gfc_define_undef_line): New prototype.

From-SVN: r129011
2007-10-04 15:04:09 +00:00
Francois-Xavier Coudert 7b7bdf67e0 re PR fortran/33538 (bootstrap break in fortran on *-apple-darwin r128671)
PR fortran/33538
	* scanner.c, parse.c, gfortran.h: Revert revision 128671.

From-SVN: r128724
2007-09-24 20:24:11 +00:00
Francois-Xavier Coudert a3b2d4e56c re PR fortran/33502 (gfortran with .F suffix and -g3 option chokes on preprocessor syntax)
PR fortran/33502
	* scanner.c (gfc_advance_line): Call debug_hooks->start_source_file
	and debug_hooks->end_source_file when entering and exiting
	included files.
	(gfc_define_undef_line): New function.
	(load_file): Ignore #define and #undef preprocessor lines
	while reading source files.
	* parse.c (next_statement): Handle #define and #undef
	preprocessor lines.
	(gfc_parse_file): Call debug_hooks->start_source_file and
	debug_hooks->end_source_file for the main source file if
	requested by the debug format.
	* gfortran.h (gfc_define_undef_line): Add prototype.

From-SVN: r128671
2007-09-22 15:03:24 +00:00
Asher Langton 51b09ce3d9 re PR fortran/20441 (-finit-local-zero is missing from gfortran)
PR fortran/20441
        * gfortran.h : Add init_local_* enums and init_flag_* flags to
	gfc_option_t.
	* lang.opt: Add -finit-local-zero, -finit-real, -finit-integer,
	-finit-character, and -finit-logical flags.
	* invoke.texi: Document new options.
	* resolve.c (build_init_assign): New function.
	(apply_init_assign): Move part of function into build_init_assign.
	(build_default_init_expr): Build local initializer (-finit-*).
	(apply_default_init_local): Apply local initializer (-finit-*).
	(resolve_fl_variable): Try to add local initializer (-finit-*).
	* options.c (gfc_init_options, gfc_handle_option,
	gfc_post_options): Handle -finit-local-zero, -finit-real,
	-finit-integer, -finit-character, and -finit-logical flags.

	PR fortran/20441
	* gfortran.dg/init_flag_1.f90: New.
	* gfortran.dg/init_flag_2.f90: New.
	* gfortran.dg/init_flag_3.f90: New.
	* gfortran.dg/init_flag_4.f90: New.
	* gfortran.dg/init_flag_5.f90: New.
	* gfortran.dg/init_flag_6.f90: New.
	* gfortran.dg/init_flag_7.f90: New.

From-SVN: r128643
2007-09-21 02:34:14 +00:00
Francois-Xavier Coudert 9fa6b0af1f re PR fortran/33221 (Cannot declare variables of TYPE without components)
PR fortran/33221

	* gfortran.h (symbol_attribute): Add zero_comp field.
	* symbol.c (gfc_use_derived): Handle case of emtpy derived types.
	* decl.c (gfc_match_data_decl): Likewise.
	(gfc_match_derived_decl): Likewise.
	* module.c (ab_attribute, attr_bits): Add AB_ZERO_COMP member.
	(mio_symbol_attribute): Write and read AB_ZERO_COMP.
	* resolve.c (resolve_symbol): Handle case of emtpy derived types.
	* parse.c (parse_derived): Likewise.

	* gfortran.dg/used_types_18.f90: Declare variable of empty
	derived type.

From-SVN: r128633
2007-09-20 22:03:22 +00:00
Paul Thomas 1d6b7f396a re PR fortran/29396 (segfault with character pointer association)
2007-09-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/29396
	PR fortran/29606
	PR fortran/30625
	PR fortran/30871
	* trans.h : Add extra argument to gfc_build_array_ref. Rename
	gfc_conv_aliased_arg to gfc_conv_subref_array_arg.  Move
	prototype of is_aliased_array to gfortran.h and rename it
	gfc_is_subref_array.  Add field span to lang_decl, add a new
	decl lang specific flag accessed by GFC_DECL_SUBREF_ARRAY_P
	and a new type flag GFC_DECL_SUBREF_ARRAY_P.
	* trans.c (gfc_build_array_ref): Add the new argument, decl.
	If this is a subreference array pointer, use the lang_decl
	field 'span' to calculate the offset in bytes and use pointer
	arithmetic to address the element.
	* trans-array.c (gfc_conv_scalarized_array_ref,
	gfc_conv_array_ref): Add the backend declaration as the third
	field, if it is likely to be a subreference array pointer.
	(gfc_conv_descriptor_dimension, gfc_trans_array_ctor_element,
	gfc_trans_array_constructor_element, structure_alloc_comps,
	gfc_conv_array_index_offset): For all other references to
	gfc_build_array_ref, set the third argument to NULL.
	(gfc_get_dataptr_offset): New function.
	(gfc_conv_expr_descriptor): If the rhs of a pointer assignment
	is a subreference array, then calculate the offset to the
	subreference of the first element and set the descriptor data
	pointer to this, using gfc_get_dataptr_offset.
	trans-expr.c (gfc_get_expr_charlen): Use the expression for the
	character length for a character subreference.
	(gfc_conv_substring, gfc_conv_subref_array_arg): Add NULL for
	third argument in call to gfc_build_array_ref.
	(gfc_conv_aliased_arg): Rename to gfc_conv_subref_array_arg.
	(is_aliased_array): Remove.
	(gfc_conv_function_call): Change reference to is_aliased_array
	to gfc_is_subref_array and reference to gfc_conv_aliased_arg to
	gfc_conv_subref_array_arg.
	(gfc_trans_pointer_assignment): Add the array element length to
	the lang_decl 'span' field.
	* gfortran.h : Add subref_array_pointer to symbol_attribute and
	add the prototype for gfc_is_subref_array.
	* trans-stmt.c : Add NULL for third argument in all references
	to gfc_build_array_ref.
	* expr.c (gfc_is_subref_array): Renamed is_aliased_array.
	If this is a subreference array pointer, return true.
	(gfc_check_pointer_assign): If the rhs is a subreference array,
	set the lhs subreference_array_pointer attribute.
	* trans-decl.c (gfc_get_symbol_decl): Allocate the lang_decl
	field if the symbol is a subreference array pointer and set an
	initial value of zero for the 'span' field.
	* trans-io.c (set_internal_unit): Refer to is_subref_array and
	gfc_conv_subref_array_arg.
	(nml_get_addr_expr): Add NULL third argument to
	gfc_build_array_ref. 
	(gfc_trans_transfer): Use the scalarizer for a subreference
	array.

2007-09-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/29396
	PR fortran/29606
	PR fortran/30625
	PR fortran/30871
	* gfortran.dg/subref_array_pointer_1.f90: New test.
	* gfortran.dg/subref_array_pointer_2.f90: New test.

From-SVN: r128523
2007-09-16 09:17:49 +00:00
Tom Tromey 5ffeb913b1 tree-cfg.c (remove_bb): Only warn if line is non-zero.
gcc:
	* tree-cfg.c (remove_bb): Only warn if line is non-zero.
	* c-pch.c (c_common_read_pch): Restore current location after
	reading PCH file.
	* tree.c (expand_location): Update.
	(expr_filename): Changed return type.  Unified the two cases.
	(expr_lineno): Likewise.
	(annotate_with_file_line): Don't use EXPR_LINENO and EXPR_FILENAME
	as lvalues.
	* toplev.c (line_table): Changed type.
	(general_init): Update.
	(realloc_for_line_map): New function.
	(general_init): Allocate line_table using GC.
	* fix-header.c (line_table): Changed type.
	(read_scan_file): Update.
	(read_scan_file): Update.
	* c-ppoutput.c (maybe_print_line): Update.
	(print_line): Update.
	(cb_line_change): Update.
	(cb_define): Update.
	(pp_file_change): Update.
	* c-opts.c (c_common_init_options): Update.
	(finish_options): Update.
	(push_command_line_include): Update.
	* c-lex.c (cb_line_change): Update.
	(cb_def_pragma): Update.
	(cb_define): Update.
	(cb_undef): Update.
	(c_lex_with_flags): Use cpp_get_token_with_location.
	* input.h (line_table): Changed type.
	(location_from_locus): New macro.
	* tree.h (EXPR_FILENAME): No longer an lvalue.
	(EXPR_LINENO): Likewise.
	(expr_locus, set_expr_locus): Declare separately for
	USE_MAPPED_LOCATION.
	(expr_filename, expr_lineno): Changed return type.
	* gimplify.c (tree_to_gimple_tuple): Use SET_EXPR_LOCUS.
	* cfgexpand.c (expand_gimple_cond_expr): Use location_from_locus.
	(expand_gimple_basic_block): Likewise.
	* final.c (final_scan_insn): Use expanded_location.
gcc/cp:
	* decl.c (finish_function): Put return's location on line zero of
	file.
gcc/fortran:
	* scanner.c (get_file): Update.
	(load_file): Update.
	(gfc_next_char_literal): Use gfc_linebuf_linenum.
	* f95-lang.c (gfc_init): Update.
	* gfortran.h (gfc_linebuf_linenum): New macro.
gcc/java:
	* lang.c (java_post_options): Update.
	* jcf-parse.c (set_source_filename): Update.
	(give_name_to_class): Update.
	(jcf_parse): Update.
	(duplicate_class_warning): Update.
	(parse_class_file): Update.
	(java_parse_file): Update.
	* expr.c (expand_byte_code): Update.
gcc/testsuite:
	* lib/g++.exp (g++_target_compile): Use -fno-show-column.
gcc/treelang:
	* tree1.c (treelang_init): Update.
	(treelang_parse_file): Update.
	(treelang_parse_file): Update.
	(treelang_parse_file): Update.
	* lex.l: Update.
	(update_lineno_charno): Likewise.
libcpp:
	* internal.h (struct cpp_reader) <invocation_location>: New
	field.
	(struct cpp_reader) <set_invocation_location>: Likewise.
	* init.c (cpp_set_line_map): New function.
	* line-map.c (linemap_add): Use linemap's allocator.
	* include/line-map.h (GTY): Define.
	(line_map_realloc): New typedef.
	(struct line_map): Mark with GTY.
	(struct line_maps): Likewise.
	(struct line_maps) <maps>: Likewise.
	(struct line_maps) <reallocator>: New field.
	* include/symtab.h (GTY): Conditionally define.
	* include/cpplib.h (cpp_set_line_map): Declare.
	(cpp_get_token_with_location): Declare.
	* macro.c (cpp_get_token): Set invocation_location on the reader.
	(cpp_get_token_with_location): New function.

From-SVN: r128190
2007-09-06 16:24:05 +00:00
Janus Weil 6977374226 decl.c (match_procedure_decl,match_procedure_in_interface, [...]): Handle PROCEDURE statements.
2007-09-04  Janus Weil  <jaydub66@gmail.com>
	    Paul Thomas  <pault@gcc.gnu.org>

	* decl.c (match_procedure_decl,match_procedure_in_interface,
	gfc_match_procedure): Handle PROCEDURE statements.
	* gfortran.h (struct gfc_symbol): New member "gfc_symbol *interface".
	(enum gfc_statement): New element "ST_PROCEDURE".
	(strcut symbol_attribute): New member "unsigned procedure".
	* interface.c (check_interface0): Extended error checking.
	* match.h: Add gfc_match_procedure prototype.
	* parse.c (decode_statement,next_statement,gfc_ascii_statement,
	parse_derived,parse_interface): Implement PROCEDURE statements.
	* resolve.c (resolve_symbol): Ditto.
	* symbol.c (check_conflict): Ditto.
	(gfc_add_proc): New function for setting the procedure attribute.
	(copy_formal_args): New function for copying formal argument lists.


2007-09-04  Janus Weil  <jaydub66@gmail.com>
	    Tobias Burnus  <burnus@net-b.de>

	* gfortran.dg/proc_decl_1.f90: New.
	* gfortran.dg/proc_decl_2.f90: New.
	* gfortran.dg/proc_decl_3.f90: New.
	* gfortran.dg/proc_decl_4.f90: New.


Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r128081
2007-09-04 15:50:35 +02:00
Francois-Xavier Coudert d74b97cc7e re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675

	* libgfortran.h: New file.
	* iso-fortran-env.def: Use macros in the new header instead of
	hardcoded integer constants.
	* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
	fortran/libgfortran.h.
	* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
	ioerror_codes): Remove.
	* trans.c (ERROR_ALLOCATION): Remove.
	(gfc_call_malloc, gfc_allocate_with_status,
	gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
	* trans-types.h (GFC_DTYPE_*): Remove.
	* trans-decl.c (gfc_generate_function_code): Use
	GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
	* trans-io.c (set_parameter_value, set_parameter_ref): Use
	LIBERROR_* macros instead of IOERROR_ macros.
	* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
	LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
	* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
	CONVERT_NATIVE.
	(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.

	* libgfortran.h: Include gcc/fortran/libgfortran.h.
	Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
	error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
	* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
	of hardcoded constants.
	(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
	CONVERT_*.
	* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
	of ERROR_BAD_OPTION.
	* runtime/error.c (translate_error, generate_error): Use
	LIBERROR_* macros instead of ERROR_*.
	* io/file_pos.c (formatted_backspace, unformatted_backspace,
	st_backspace, st_rewind, st_flush): Rename macros.
	* io/open.c (convert_opt, edit_modes, new_unit, already_open,
	st_open): Likewise.
	* io/close.c (st_close): Likewise.
	* io/list_read.c (next_char, convert_integer, parse_repeat,
	read_logical, read_integer, read_character, parse_real,
	check_type, list_formatted_read_scalar, namelist_read,
	nml_err_ret): Likewise.
	* io/read.c (convert_real, read_l, read_decimal, read_radix,
	read_f): Likewise.
	* io/inquire.c (inquire_via_unit): Likewise.
	* io/unit.c (get_internal_unit): Likewise.
	* io/transfer.c (read_sf, read_block, read_block_direct,
	write_block, write_buf, unformatted_read, unformatted_write,
	formatted_transfer_scalar, us_read, us_write, data_transfer_init,
	skip_record, next_record_r, write_us_marker, next_record_w_unf,
	next_record_w, finalize_transfer, st_read, st_write_done):
	Likewise.
	* io/format.c (format_error): Likewise.

From-SVN: r128050
2007-09-03 16:44:15 +00:00
Paul Thomas 07368af083 re PR fortran/31879 (ICE with function having array of character variables argument)
2007-08-31  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31879
	PR fortran/31197
	PR fortran/31258
	PR fortran/32703
	* gfortran.h : Add prototype for gfc_resolve_substring_charlen.
	* resolve.c (gfc_resolve_substring_charlen): New function.
	(resolve_ref): Call gfc_resolve_substring_charlen.
	(gfc_resolve_character_operator): New function.
	(gfc_resolve_expr): Call the new functions in cases where the
	character length is missing.
	* iresolve.c (cshift, eoshift, merge, pack, reshape, spread,
	transpose, unpack): Call gfc_resolve_substring_charlen for
	source expressions that are character and have a reference.
	* trans.h (gfc_trans_init_string_length) Change name to
	gfc_conv_string_length; modify references in trans-expr.c,
	trans-array.c and trans-decl.c.
	* trans-expr.c (gfc_trans_string_length): Handle case of no
	backend_decl.
	(gfc_conv_aliased_arg): Remove code for treating substrings
	and replace with call to gfc_trans_string_length.
	* trans-array.c (gfc_conv_expr_descriptor): Remove code for
	treating strings and call gfc_trans_string_length instead.

2007-08-31  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31879
	* gfortran.dg/char_length_7.f90: New test.
	* gfortran.dg/char_length_9.f90: New test.
	* gfortran.dg/char_assign_1.f90: Add extra warning.

	PR fortran/31197
	PR fortran/31258
	* gfortran.dg/char_length_8.f90: New test.

From-SVN: r127939
2007-08-30 22:10:55 +00:00
François-Xavier Coudert bae891736b re PR fortran/33105 (F2003: Support is_iostat_end & is_iostat_eor intrinsics)
PR fortran/33105

	* intrinsic.c (add_functions): Add IS_IOSTAT_END and
	IS_IOSTAT_EOR intrinsics.
	* gfortran.h (gfc_isym_id): Add GFC_ISYM_IS_IOSTAT_END and
	GFC_ISYM_IS_IOSTAT_EOR.
	* trans-intrinsic.c (gfc_conv_has_intvalue): New function.
	(gfc_conv_intrinsic_function): Call gfc_conv_has_intvalue for
	GFC_ISYM_IS_IOSTAT_END and GFC_ISYM_IS_IOSTAT_EOR.
	* intrinsic.texi: Add IS_IOSTAT_END and IS_IOSTAT_EOR.

	* gfortran.dg/is_iostat_end_eor_1.f90: New test.

From-SVN: r127903
2007-08-29 15:16:00 +00:00
H.J. Lu 88607a9ace gfortran.h (gfc_isym_id): Add GFC_ISYM_GAMMA and GFC_ISYM_LGAMMA.
2007-08-26  H.J. Lu  <hongjiu.lu@intel.com>

	* gfortran.h (gfc_isym_id): Add GFC_ISYM_GAMMA and
	GFC_ISYM_LGAMMA.

From-SVN: r127814
2007-08-26 11:59:32 -07:00
Asher Langton 1e7de83b40 gfortran.h (gfc_option_t): Add flag_recursive.
2007-08-26  Asher Langton  <langton2@llnl.gov>
	    Tobias Burnus  <burnus@net-b.de>

        * gfortran.h (gfc_option_t): Add flag_recursive.
	* lang.opt: Add -frecursive option and update -fopenmp.
	* invoke.texi (-frecursive): Document new option.
	(-fopenmp,-fno-automatic,-fmax-stack-var-size): Update.
	* options.c (gfc_init_options, gfc_post_options,
	gfc_handle_option): Add -frecursive and modify -fopenmp.
	(gfc_post_options): Add warning for conflicting flags.

2007-08-26  Asher Langton  <langton2@llnl.gov>

	* gfortran.dg/recursive_stack.f90: New.
	* gfortran.dg/openmp_stack.f90: New.


Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r127813
2007-08-26 20:48:10 +02:00
Roger Sayle ba3ba492cd match.c (intrinsic_operators): Make static.
* match.c (intrinsic_operators): Make static.
	(gfc_op2string): New function for converting a gfc_intrinsic_op to
	to a "const char*", replacing the macro of the same name.
	* gfortran.h (intrinsic_operators): Delete prototype.
	(gfc_op2string): Replace macro with function prototype.

From-SVN: r127636
2007-08-20 06:11:15 +00:00
Tobias Burnus e9c0656362 [multiple changes]
2007-08-18  Tobias Burnus  <burnus@net-b.de>

	* gfortran.h (gfc_is_intrinsic_typename): Add declaration.
	* symbol.c (gfc_is_intrinsic_typename): New function.
	* parse.c (decode_statement): Check for space in ABSTRACT INTERFACE.
	(parse_interface): Use gfc_is_intrinsic_typename.
	* decl.c (gfc_match_derived_decl): Ditto.
	* module.c (gfc_match_use): Use gcc_unreachable() for
	INTERFACE_ABSTRACT in switch().

2007-08-19  Tobias Burnus  <burnus@net-b.de>

	* gfortran.dg/interface_abstract_2.f90: New.
	* gfortran.dg/interface_abstract_1.f90: Fix typo.

From-SVN: r127626
2007-08-19 22:08:14 +02:00
Tobias Burnus 9e1d712c40 [multiple changes]
2007-08-18  Paul Thomas  <pault@gcc.gnu.org>
	    Janus Weil  <jaydub66@gmail.com>

	* interface.c (gfc_match_interface,gfc_match_abstract_interface,
	gfc_match_end_interface,gfc_add_interface): Add abstract interface.
	* dump-parse-tree.c (gfc_show_attr): Ditto.
	* gfortran.h (interface_type,symbol_attribute): Ditto.
	* module.c (gfc_match_use,ab_attribute,attr_bits,
	mio_symbol_attribute): Ditto.
	* resolve.c (resolve_function): Ditto.
	* match.h: Ditto.
	* parse.c (decode_statement): Ditto.
	(parse_interface): Ditto, check for C1203 (name of abstract interface
	cannot be the same as an intrinsic type).
	* decl.c (gfc_match_bind_c): Check for NAME= with abstract interfaces.
	(access_attr_decl): Handle Abstract interfaces.


2007-08-17  Tobias Burnus  <burnus@net-b.de>

	* gfortran.dg/interface_abstract_1.f90: New.

From-SVN: r127612
2007-08-18 16:57:21 +02:00