Commit Graph

4960 Commits

Author SHA1 Message Date
Richard Sandiford 899ca90e6d Add SET_DECL_MODE
This may no longer be necessary with the current version
of the SVE patches, but it does at least make things consistent
with the TYPE_MODE/SET_TYPE_MODE split.

gcc/ada/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* gcc-interface/utils.c (create_label_decl): Use SET_DECL_MODE.

gcc/c/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* c-decl.c (merge_decls): Use SET_DECL_MODE.
	(make_label, finish_struct): Likewise.

gcc/cp/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* class.c (finish_struct_bits): Use SET_DECL_MODE.
	(build_base_field_1, layout_class_type, finish_struct_1): Likewise.
	* decl.c (make_label_decl): Likewise.
	* pt.c (tsubst_decl): Likewise.

gcc/fortran/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* trans-common.c (build_common_decl): Use SET_DECL_MODE.
	* trans-decl.c (gfc_build_label_decl): Likewise.
	* trans-types.c (gfc_get_array_descr_info): Likewise.

gcc/lto/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* lto.c (offload_handle_link_vars): Use SET_DECL_MODE.

gcc/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* tree.h (SET_DECL_MODE): New macro.
	* cfgexpand.c (avoid_deep_ter_for_debug): Use SET_DECL_MODE.
	(expand_gimple_basic_block): Likewise.
	* function.c (split_complex_args): Likeise.
	* ipa-prop.c (ipa_modify_call_arguments): Likewise.
	* omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise.
	* stor-layout.c (layout_decl, relayout_decl): Likewise.
	(finish_bitfield_representative): Likewise.
	* tree.c (make_node_stat): Likewise.
	* tree-inline.c (remap_ssa_name): Likewise.
	(tree_function_versioning): Likewise.
	* tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise.
	* tree-sra.c (sra_ipa_reset_debug_stmts): Likewise.
	* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise.
	* tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise.
	* tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
	* tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise.
	* varasm.c (make_debug_expr_from_rtl): Likewise.

libcc1/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* plugin.cc (plugin_build_add_field): Use SET_DECL_MODE.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r242585
2016-11-18 10:03:12 +00:00
Janus Weil 04f1c83099 re PR fortran/66227 ([OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type)
2016-11-17  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/66227
	* simplify.c (gfc_simplify_extends_type_of): Fix missed optimization.
	Prevent over-simplification. Fix a comment. Add a comment.

2016-11-17  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/66227
	* gfortran.dg/extends_type_of_3.f90: Fix and extend the test case.

From-SVN: r242535
2016-11-17 08:52:24 +01:00
Steven G. Kargl 99c7213097 re PR fortran/58001 (Make it possible to silence "Extension: Tab character in format" warning)
2016-11-16  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/58001
	* io.c (next_char_not_space): Update handling of a 'tab' in a FORMAT.
 	(format_lex): Adjust invocations of next_char_not_space().
 
2016-11-16  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/58001
	* gfortran.dg/fmt_tab_1.f90: Adjust testcase.
	* gfortran.dg/fmt_tab_2.f90: Ditto.

From-SVN: r242530
2016-11-17 00:18:18 +00:00
Andre Vehreschild dc9e0b66b2 re PR fortran/78356 ([OOP] segfault allocating polymorphic variable with polymorphic component with allocatable component)
gcc/fortran/ChangeLog:

2016-11-16  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78356
	* class.c (gfc_is_class_scalar_expr): Prevent taking an array ref for
	a component ref.
	* trans-expr.c (gfc_trans_assignment_1): Ensure a reference to the
	object to copy is generated, when assigning class objects.

gcc/testsuite/ChangeLog:

2016-11-16  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78356
	* gfortran.dg/class_allocate_23.f08: New test.

From-SVN: r242490
2016-11-16 14:45:29 +01:00
Thomas Koenig d32e1fd8b9 dump-parse-tree.c (show_code): Add prototype.
2016-11-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* dump-parse-tree.c (show_code):  Add prototype.
	(gfc_debug_code):  New function.
	(show_code_node):  Add space after SELECT TYPE.

From-SVN: r242393
2016-11-14 18:15:36 +00:00
Janus Weil d809e15a19 re PR fortran/78300 ([OOP] Failure to compile a F03 code with an optional dummy procedure argument)
2016-11-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78300
	* resolve.c (resolve_procedure_interface): Properly handle CLASS-valued
	function results.

2016-11-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78300
	* gfortran.dg/class_result_3.f90: New test.

From-SVN: r242392
2016-11-14 17:55:01 +01:00
Janus Weil f9d49cd1d0 re PR fortran/60952 ([F03] Problem using "end" as a type-bound procedure and contained procedure)
2016-11-13  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/60952
	* decl.c (match_procedure_in_type): Apply the FL_PROCEDURE attribute
	to the target procedure.

2016-11-13  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/60952
	* gfortran.dg/typebound_proc_34.f90: New test.

From-SVN: r242352
2016-11-13 12:12:05 +01:00
Janus Weil 9cbf867310 re PR fortran/66366 ([OOP] ICE on invalid with non-allocatable CLASS variable)
2016-11-13  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/66366
	* resolve.c (resolve_component): Move check for C437
	to ...
	* decl.c (build_struct): ... here. Fix indentation.

2016-11-13  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/66366
	* gfortran.dg/class_57.f90: Changed error message.
	* gfortran.dg/class_60.f90: New test.

From-SVN: r242351
2016-11-13 10:56:10 +01:00
Janus Weil b93d8a3f16 re PR fortran/77501 ([F03] ICE in gfc_match_generic, at fortran/decl.c:9429)
2016-11-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/77501
	* class.c (gfc_find_typebound_intrinsic_op): Remove an unnecessary
	assert and nullification.
	* decl.c (gfc_match_decl_type_spec): Use gfc_get_tbp_symtree,
	fix indentation.
	(gfc_match_generic): Remove an unnecessary assert.
	Use gfc_get_tbp_symtree to avoid ICE.

2016-11-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/77501
	* gfortran.dg/typebound_generic_16.f90: New test.

From-SVN: r242335
2016-11-12 10:25:47 +01:00
Fritz O. Reese 9490321264 Fix ICE and improve errors for invalid anonymous structure declarations.
PR fortran/78277
	* gcc/fortran/decl.c (gfc_match_data_decl): Gracefully handle bad
	anonymous structure declarations.

	PR fortran/78277
	* gcc/testsuite/gfortran.dg/dec_structure_17.f90: New test.

From-SVN: r242058
2016-11-10 21:57:13 +00:00
Fritz O. Reese 05b8fcb4d2 Fix some whitespace.
gcc/fortran/
	* decl.c (get_struct_decl, gfc_match_map, gfc_match_union): Fix
	whitespace.
	* interface.c (gfc_compare_union_types): Likewise.

From-SVN: r242057
2016-11-10 21:54:48 +00:00
Jakub Jelinek 8ebd1b3182 cpp.c (cpp_define_builtins): Define _OPENMP to 201511 instead of 201307.
gcc/fortran/
	* cpp.c (cpp_define_builtins): Define _OPENMP to 201511 instead
	of 201307.
	* gfortran.texi: Mention partial OpenMP 4.5 support.
	* intrinsic.texi: Update for OpenMP 4.5.
gcc/testsuite/
	* gfortran.dg/openmp-define-3.f90: Expect 201511 instead of
	201307.
libgomp/
	* omp_lib.f90.in (openmp_version): Change to 201511 from 201307.
	* omp_lib.h.in (openmp_version): Likewise.
	* testsuite/libgomp.fortran/openmp_version-1.f: Expect 201511 instead
	of 201307.
	* testsuite/libgomp.fortran/openmp_version-2.f90: Likewise.

From-SVN: r242044
2016-11-10 18:05:18 +01:00
Jakub Jelinek b4c3a85be9 omp-low.c (lower_omp_target): Fix up argument to is_reference.
gcc/
	* omp-low.c (lower_omp_target): Fix up argument to is_reference.
	(expand_omp_ordered_sink): Handle TREE_PURPOSE of deps being
	TRUNC_DIV_EXPR.
	* gimplify.c (gimplify_scan_omp_clauses): Likewise.  Set
	ctx->target_map_scalars_firstprivate on OMP_TARGET even for Fortran.
	Remove omp_no_lastprivate callers.  Propagate lastprivate on combined
	teams distribute parallel for simd even to distribute and teams
	construct.  For OMP_CLAUSE_DEPEND add missing break at the end of
	OMP_CLAUSE_DEPEND_SINK case.
	(omp_notice_variable): Use lang_hooks.decls.omp_scalar_p.
	(omp_no_lastprivate): Removed.
	(gimplify_adjust_omp_clauses): Remove omp_no_lastprivate callers.
	(gimplify_omp_for): Likewise.
	(computable_teams_clause): Fail for automatic vars from current
	function not yet seen in bind expr.
	* langhooks.c (lhd_omp_scalar_p): New function.
	* langhooks.h (struct lang_hooks_for_decls): Add omp_scalar_p.
	* varpool.c (varpool_node::get_create): Set node->offloading
	even for DECL_EXTERNAL decls.
	* langhooks-def.h (lhd_omp_scalar_p): New prototype.
	(LANG_HOOKS_OMP_SCALAR_P): Define.
	(LANG_HOOKS_DECLS): Use it.
gcc/fortran/
	* openmp.c (gfc_free_omp_clauses): Free critical_name, grainsize,
	hint, num_tasks, priority and if_exprs.
	(gfc_match_omp_to_link, gfc_match_omp_depend_sink): New functions.
	(enum omp_mask1, enum omp_mask2): New enums.
	Change all OMP_CLAUSE_* defines into enum values, and change their
	values from ((uint64_t) 1 << bit) to just bit.
	(omp_mask, omp_inv_mask): New classes.  Add ctors and operators.
	(gfc_match_omp_clauses): Change mask argument from uint64_t to
	const omp_mask.  Assert OMP_MASK1_LAST and OMP_MASK2_LAST are
	at most 64.  Move delete clause handling to where it
	alphabetically belongs.  Parse defaultmap, grainsize, hint,
	is_device_ptr, nogroup, nowait, num_tasks, priority, simd, threads
	and use_device_ptr clauses.  Parse if clause modifier.  Parse map
	clause always modifier, and release and delete kinds.  Parse ordered
	clause with argument.  Parse schedule clause modifiers.  Differentiate
	device clause parsing based on openacc flag.  Guard link clause
	parsing with openacc flag.  Add support for parsing
	linear clause modifiers.  Parse depend(source) and depend(sink: ...).
	Use gfc_match_omp_to_link for to and link clauses in declare target
	construct.
	(match_acc): Change mask type from uint64_t to const omp_mask.
	(OMP_SINGLE_CLAUSES, OMP_ORDERED_CLAUSES,
	OMP_DECLARE_TARGET_CLAUSES, OMP_TASKLOOP_CLAUSES,
	OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES): Define.
	(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES,
	OACC_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES, OACC_DECLARE_CLAUSES,
	OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES, OACC_WAIT_CLAUSES,
	OACC_ROUTINE_CLAUSES, OMP_PARALLEL_CLAUSES, OMP_DECLARE_SIMD_CLAUSES,
	OMP_SECTIONS_CLAUSES, OMP_TEAMS_CLAUSES, OMP_DISTRIBUTE_CLAUSES):
	Replace first or only OMP_CLAUSE_* value in bitset with
	omp_mask (OMP_CLAUSE_*).
	(OMP_DO_CLAUSES): Likewise.  Add OMP_CLAUSE_LINEAR.
	(OMP_SIMD_CLAUSES): Replace first or only OMP_CLAUSE_* value in
	bitset with omp_mask (OMP_CLAUSE_*).  Add OMP_CLAUSE_SIMDLEN.
	(OACC_UPDATE_CLAUSES): Replace first or only OMP_CLAUSE_* value in
	bitset with omp_mask (OMP_CLAUSE_*).  Replace OMP_CLAUSE_OACC_DEVICE
	with OMP_CLAUSE_DEVICE.
	(OMP_TASK_CLAUSES): Replace first or only OMP_CLAUSE_* value in
	bitset with omp_mask (OMP_CLAUSE_*).  Add OMP_CLAUSE_PRIORITY.
	(OMP_TARGET_CLAUSES): Replace first or only OMP_CLAUSE_* value in
	bitset with omp_mask (OMP_CLAUSE_*).  Add OMP_CLAUSE_DEPEND,
	OMP_CLAUSE_NOWAIT, OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE,
	OMP_CLAUSE_DEFAULTMAP and OMP_CLAUSE_IS_DEVICE_PTR.
	(OMP_TARGET_DATA_CLAUSES): Replace first or only OMP_CLAUSE_* value in
	bitset with omp_mask (OMP_CLAUSE_*).  Add OMP_CLAUSE_USE_DEVICE_PTR.
	(OMP_TARGET_UPDATE_CLAUSES): Replace first or only OMP_CLAUSE_* value
	in bitset with omp_mask (OMP_CLAUSE_*).  Add OMP_CLAUSE_DEPEND and
	OMP_CLAUSE_NOWAIT.
	(match_omp): Change mask argument from unsigned int to
	const omp_mask.
	(gfc_match_omp_critical): Parse optional clauses and use omp_clauses
	union member instead of omp_name.
	(gfc_match_omp_end_critical): New function.
	(gfc_match_omp_distribute_parallel_do): Remove ordered and linear
	clauses from the mask.
	(gfc_match_omp_distribute_parallel_do_simd): Use
	& ~(omp_mask (OMP_CLAUSE_*)) instead of & ~OMP_CLAUSE_*.
	(gfc_match_omp_target_teams_distribute_parallel_do_simd): Likewise.
	(gfc_match_omp_teams_distribute_parallel_do_simd): Likewise.
	(gfc_match_omp_do_simd): Likewise.  Don't remove ordered clause from
	the mask.
	(gfc_match_omp_parallel_do_simd): Likewise.
	(gfc_match_omp_target_teams_distribute_parallel_do): Likewise.
	(gfc_match_omp_teams_distribute_parallel_do): Likewise.
	(gfc_match_omp_declare_simd): If not using the form with
	(proc-name), require space before first clause.  Make (proc-name)
	optional.  If not present, set proc_name to NULL.
	(gfc_match_omp_declare_target): Rewritten for OpenMP 4.5.
	(gfc_match_omp_single): Use OMP_SINGLE_CLAUSES.
	(gfc_match_omp_task, gfc_match_omp_taskwait, gfc_match_omp_taskyield):
	Move around to where they belong alphabetically.
	(gfc_match_omp_target_enter_data, gfc_match_omp_target_exit_data,
	gfc_match_omp_target_parallel, gfc_match_omp_target_parallel_do,
	gfc_match_omp_target_parallel_do_simd, gfc_match_omp_target_simd,
	gfc_match_omp_taskloop, gfc_match_omp_taskloop_simd):
	New functions.
	(gfc_match_omp_ordered): Parse clauses.
	(gfc_match_omp_ordered_depend): New function.
	(gfc_match_omp_cancel, gfc_match_omp_end_single): Use
	omp_mask (OMP_CLAUSE_*) instead of OMP_CLAUSE_*.
	(resolve_oacc_scalar_int_expr): Renamed to ...
	(resolve_scalar_int_expr): ... this.  Fix up formatting.
	(resolve_oacc_positive_int_expr): Renamed to ...
	(resolve_positive_int_expr): ... this.  Fix up formatting.
	(resolve_nonnegative_int_expr): New function.
	(resolve_omp_clauses): Adjust callers, use the above functions
	even for OpenMP clauses, add handling of new OpenMP 4.5 clauses.
	Require orderedc >= collapse if specified. Handle depend(sink:)
	and depend(source) restrictions.  Disallow linear clause when
	orderedc is non-zero.  Diagnose linear clause modifiers when not in
	declare simd.  Only check for integer type if ref modifier
	is not used.  Remove diagnostics for required VALUE attribute.
	Diagnose VALUE attribute with ref or uval modifiers.  Allow
	non-constant linear-step, if it is a dummy argument alone and is
	mentioned in uniform clause.  Diagnose map kinds not allowed
	for various constructs.  Diagnose target {enter ,exit ,}data without
	any map clauses.  Add dummy OMP_LIST_IS_DEVICE_PTR and
	OMP_LIST_USE_DEVICE_PTR cases.
	(gfc_resolve_omp_do_blocks): Set omp_current_do_collapse to orderedc
	if non-zero.
	(gfc_resolve_omp_parallel_blocks): Handle new OpenMP 4.5 constructs,
	replace underscores with spaces in a few construct names.
	(resolve_omp_do): Set collapse to orderedc if non-zero.  Handle new
	OpenMP 4.5 constructs.
	(resolve_oacc_loop_blocks): Call resolve_positive_int_expr instead
	of resolve_oacc_positive_int_expr.
	(gfc_resolve_omp_directive): Handle new OpenMP 4.5 constructs.
	(gfc_resolve_omp_declare_simd): Allow ods->proc_name to be NULL.
	* trans-openmp.c (gfc_omp_scalar_p): New function.
	(doacross_steps): New variable.
	(gfc_trans_omp_clauses): Handle new OpenMP 4.5 clauses and new clause
	modifiers.
	(gfc_trans_omp_critical): Adjust EXEC_OMP_CRITICAL handling.
	(gfc_trans_omp_do): Handle doacross loops.  Clear sched_simd flag.
	Handle EXEC_OMP_TASKLOOP.
	(gfc_trans_omp_ordered): Translate omp clauses, allow NULL
	code->block.
	(GFC_OMP_SPLIT_TASKLOOP, GFC_OMP_MASK_TASKLOOP): New enum constants.
	(gfc_split_omp_clauses): Copy orderedc together with ordered.  Change
	firstprivate and lastprivate handling for OpenMP 4.5.
	Handle EXEC_OMP_TARGET_SIMD, EXEC_OMP_TARGET_PARALLEL{,_DO,_DO_SIMD}
	and EXEC_OMP_TASKLOOP{,_SIMD}.  Add handling for new OpenMP 4.5
	clauses and clause modifiers and handle if clause without/with
	modifiers.
	(gfc_trans_omp_teams): Add omp_clauses argument, add it to other
	teams clauses.  Don't wrap into OMP_TEAMS if -fopenmp-simd.
	(gfc_trans_omp_target): For -fopenmp, translate num_teams and
	thread_limit clauses on combined target teams early and pass to
	gfc_trans_omp_teams.  Set OMP_TARGET_COMBINED if needed.
	Handle EXEC_OMP_TARGET_PARALLEL{,_DO,_DO_SIMD} and
	EXEC_OMP_TARGET_SIMD.
	(gfc_trans_omp_taskloop, gfc_trans_omp_target_enter_data,
	gfc_trans_omp_target_exit_data): New functions.
	(gfc_trans_omp_directive): Handle EXEC_OMP_TARGET_{ENTER,EXIT}_DATA
	EXEC_OMP_TASKLOOP{,_SIMD}, EXEC_OMP_TARGET_PARALLEL{,_DO,_DO_SIMD}
	and EXEC_OMP_TARGET_SIMD.  Adjust gfc_trans_omp_teams caller.
	* symbol.c (check_conflict): Handle omp_declare_target_link.
	(gfc_add_omp_declare_target_link): New function.
	(gfc_copy_attr): Copy omp_declare_target_link.
	* dump-parse-tree.c (show_omp_namelist): Handle OMP_DEPEND_SINK_FIRST
	depend_op.  Print linear clause modifiers.
	(show_omp_clauses): Adjust for OpenMP 4.5 clause changes.
	(show_omp_node): Print clauses for EXEC_OMP_ORDERED.  Allow NULL
	c->block for EXEC_OMP_ORDERED.  Formatting fixes.  Adjust handling of
	EXEC_OMP_CRITICAL, handle new OpenMP 4.5 constructs and some
	forgotten OpenMP 4.0 constructs.
	(show_code_node): Handle new OpenMP 4.5 constructs and some forgotten
	OpenMP 4.0 constructs.
	* gfortran.h (symbol_attribute): Add omp_declare_target_link bitfield.
	(struct gfc_omp_namelist): Add u.common and u.linear_op fields.
	(struct gfc_common_head): Change omp_declare_target into bitfield.
	Add omp_declare_target_link bitfield.
	(gfc_add_omp_declare_target_link): New prototype.
	(enum gfc_statement): Add ST_OMP_TARGET_PARALLEL,
	ST_OMP_END_TARGET_PARALLEL, ST_OMP_TARGET_PARALLEL_DO,
	ST_OMP_END_TARGET_PARALLEL_DO, ST_OMP_TARGET_PARALLEL_DO_SIMD,
	ST_OMP_END_TARGET_PARALLEL_DO_SIMD, ST_OMP_TARGET_ENTER_DATA,
	ST_OMP_TARGET_EXIT_DATA, ST_OMP_TARGET_SIMD, ST_OMP_END_TARGET_SIMD,
	ST_OMP_TASKLOOP, ST_OMP_END_TASKLOOP, ST_OMP_TASKLOOP_SIMD,
	ST_OMP_END_TASKLOOP_SIMD and ST_OMP_ORDERED_DEPEND.
	(enum gfc_omp_depend_op): Add OMP_DEPEND_SINK_FIRST and
	OMP_DEPEND_SINK.
	(enum gfc_omp_linear_op): New.
	(struct gfc_omp_clauses): Add critical_name, depend_source,
	orderedc, defaultmap, nogroup, sched_simd, sched_monotonic,
	sched_nonmonotonic, simd, threads, grainsize, hint, num_tasks,
	priority and if_exprs fields.
	(enum gfc_exec_op): Add EXEC_OMP_END_CRITICAL,
	EXEC_OMP_TARGET_ENTER_DATA, EXEC_OMP_TARGET_EXIT_DATA,
	EXEC_OMP_TARGET_PARALLEL, EXEC_OMP_TARGET_PARALLEL_DO,
	EXEC_OMP_TARGET_PARALLEL_DO_SIMD, EXEC_OMP_TARGET_SIMD,
	EXEC_OMP_TASKLOOP, EXEC_OMP_TASKLOOP_SIMD.
	(enum gfc_omp_map_op): Add OMP_MAP_RELEASE,
	OMP_MAP_ALWAYS_TO, OMP_MAP_ALWAYS_FROM and OMP_MAP_ALWAYS_TOFROM.
	(OMP_LIST_IS_DEVICE_PTR, OMP_LIST_USE_DEVICE_PTR): New.
	(enum gfc_omp_if_kind): New.
	* module.c (enum ab_attribute): Add AB_OMP_DECLARE_TARGET_LINK.
	(attr_bits): Add AB_OMP_DECLARE_TARGET_LINK entry.
	(mio_symbol_attribute): Save and restore omp_declare_target_link bit.
	* trans.h (gfc_omp_scalar_p): New prototype.
	* frontend-passes.c (gfc_code_walker): Handle new OpenMP 4.5
	expressions.
	* trans.c (trans_code): Handle new OpenMP 4.5 constructs.
	* resolve.c (gfc_resolve_blocks): Likewise.
	(gfc_resolve_code): Likewise.
	* f95-lang.c (LANG_HOOKS_OMP_SCALAR_P): Redefine to gfc_omp_scalar_p.
	(gfc_attribute_table): Add "omp declare target link".
	* st.c (gfc_free_statement): Handle EXEC_OMP_END_CRITICAL like
	EXEC_OMP_CRITICAL before, free clauses for EXEC_OMP_CRITICAL
	and new OpenMP 4.5 constructs.  Free omp clauses even for
	EXEC_OMP_ORDERED.
	* match.c (match_exit_cycle): Rename collapse variable to count,
	set it to orderedc if non-zero, instead of collapse.
	* trans-decl.c (add_attributes_to_decl): Add "omp declare target link"
	instead of "omp declare target" for omp_declare_target_link.
	* trans-common.c (build_common_decl): Likewise.
	* match.h (gfc_match_omp_target_enter_data,
	gfc_match_omp_target_exit_data, gfc_match_omp_target_parallel,
	gfc_match_omp_target_parallel_do,
	gfc_match_omp_target_parallel_do_simd, gfc_match_omp_target_simd,
	gfc_match_omp_taskloop, gfc_match_omp_taskloop_simd,
	gfc_match_omp_end_critical, gfc_match_omp_ordered_depend): New
	prototypes.
	* parse.c (decode_omp_directive): Use gfc_match_omp_end_critical
	instead of gfc_match_omp_critical for !$omp end critical.
	Handle new OpenMP 4.5 constructs.  If ordered directive has
	depend clause as the first of the clauses, use
	gfc_match_omp_ordered_depend and ST_OMP_ORDERED_DEPEND instead of
	gfc_match_omp_ordered and ST_OMP_ORDERED.
	(case_executable): Add ST_OMP_TARGET_ENTER_DATA,
	ST_OMP_TARGET_EXIT_DATA and ST_OMP_ORDERED_DEPEND cases.
	(case_exec_markers): Add ST_OMP_TARGET_PARALLEL,
	ST_OMP_TARGET_PARALLEL_DO, ST_OMP_TARGET_PARALLEL_DO_SIMD,
	ST_OMP_TARGET_SIMD, ST_OMP_TASKLOOP and ST_OMP_TASKLOOP_SIMD cases.
	(gfc_ascii_statement): Handle new OpenMP 4.5 constructs.
	(parse_omp_do): Handle ST_OMP_TARGET_PARALLEL_DO,
	ST_OMP_TARGET_PARALLEL_DO_SIMD, ST_OMP_TASKLOOP and
	ST_OMP_TASKLOOP_SIMD.
	(parse_omp_structured_block): Handle EXEC_OMP_END_CRITICAL instead
	of EXEC_OMP_CRITICAL, adjust for EXEC_OMP_CRITICAL having omp clauses
	now.
	(parse_executable): Handle ST_OMP_TARGET_PARALLEL,
	ST_OMP_TARGET_PARALLEL_DO, ST_OMP_TARGET_PARALLEL_DO_SIMD,
	ST_OMP_TASKLOOP and ST_OMP_TASKLOOP_SIMD.
gcc/testsuite/
	* gfortran.dg/gomp/pr77516.f90: Add dg-warning.
	* gfortran.dg/gomp/target1.f90: Remove ordered clause where it is
	no longer allowed and corresponding ordered construct.
	* gfortran.dg/gomp/linear-1.f90: New test.
	* gfortran.dg/gomp/declare-simd-2.f90: New test.
	* gfortran.dg/gomp/declare-target-1.f90: New test.
	* gfortran.dg/gomp/declare-target-2.f90: New test.
libgomp/
	* testsuite/libgomp.fortran/examples-4/declare_target-1.f90
	(fib_wrapper): Add map(from: x) clause.
	* testsuite/libgomp.fortran/examples-4/declare_target-2.f90
	(e_53_2): Likewise.
	* testsuite/libgomp.fortran/examples-4/declare_target-4.f90
	(accum): Add map(tmp) clause.
	* testsuite/libgomp.fortran/examples-4/declare_target-5.f90
	(accum): Add map(tofrom: tmp) clause.
	* testsuite/libgomp.fortran/examples-4/target_data-3.f90
	(gramSchmidt): Likewise.
	* testsuite/libgomp.fortran/examples-4/teams-2.f90 (dotprod): Add
	map(tofrom: sum) clause.
	* testsuite/libgomp.fortran/nestedfn5.f90 (foo): Add twice
	map (alloc: a, l) clause.  Add defaultmap(tofrom: scalar) clause.
	* testsuite/libgomp.fortran/pr66199-2.f90: Adjust for linear clause
	only allowed on the loop iterator.
	* testsuite/libgomp.fortran/target4.f90 (foo): Add map(t) clause.
	* testsuite/libgomp.fortran/taskloop2.f90: New test.
	* testsuite/libgomp.fortran/taskloop4.f90: New test.
	* testsuite/libgomp.fortran/doacross1.f90: New test.
	* testsuite/libgomp.fortran/doacross3.f90: New test.
	* testsuite/libgomp.fortran/taskloop1.f90: New test.
	* testsuite/libgomp.fortran/taskloop3.f90: New test.
	* testsuite/libgomp.fortran/doacross2.f90: New test.
	* testsuite/libgomp.c/doacross-1.c (main): Add missing
	#pragma omp atomic read.
	* testsuite/libgomp.c/doacross-2.c (main): Likewise.
	* testsuite/libgomp.c/doacross-3.c (main): Likewise.

From-SVN: r242037
2016-11-10 12:38:05 +01:00
Janus Weil 271dd55c78 [multiple changes]
2016-11-09  Mikael Morin  <mikael@gcc.gnu.org>
	    Janus Weil  <janus@gcc.gnu.org>

	PR fortran/46459
	* interface.c (compare_actual_formal): Add safety checks to avoid ICE.

2016-11-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/46459
	* gfortran.dg/volatile14.f90: New test.

From-SVN: r242020
2016-11-09 21:33:24 +01:00
Fritz O. Reese f31adad4cb Fix ICE in gfc_trans_subcomponent_assign due to NULL components.
PR fortran/78259
	* gcc/fortran/trans-expr.c (gfc_trans_subcomponent_assign): Guard
	against NULL values.

	PR fortran/78259
	* gcc/testsuite/gfortran.dg/pr78259.f90: New test.

From-SVN: r242010
2016-11-09 17:31:27 +00:00
Janus Weil b349a81aa0 [multiple changes]
2016-11-09  Steve Kargl <kargl@gcc.gnu.org>
	    Janus Weil  <janus@gcc.gnu.org>

	PR fortran/60777
	* expr.c (external_spec_function): Allow recursive specification
	functions in F03.

2016-11-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/60777
	* gfortran.dg/spec_expr_7.f90: New test.

From-SVN: r242009
2016-11-09 18:22:02 +01:00
Paul Thomas bfcb501d83 check.c (gfc_check_move_alloc): Prevent error that avoids aliasing between to and from arguments from rejecting...
2016-11-09  Paul Thomas  <pault@gcc.gnu.org>

	* check.c (gfc_check_move_alloc): Prevent error that avoids
	aliasing between to and from arguments from rejecting valid
	code.

2016-11-09  Paul Thomas  <pault@gcc.gnu.org>

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

From-SVN: r241995
2016-11-09 10:10:41 +00:00
Janus Weil 5f39558007 re PR fortran/71894 ([OOP] ICE in gfc_add_component_ref, at fortran/class.c:227)
2016-11-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/71894
	* class.c (gfc_add_component_ref): Add safety checks to avoid ICE.

2016-11-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/71894
	* gfortran.dg/class_59.f90: New test.

From-SVN: r241993
2016-11-09 10:22:52 +01:00
Janus Weil 103c4f759a re PR fortran/68440 ([OOP] ICE on declaring class variable with wrong attribute)
2016-11-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/68440
	* expr.c (check_alloc_comp_init): Loosen an assert.
	* resolve.c (resolve_fl_parameter): Reject class parameters.

2016-11-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/68440
	* gfortran.dg/class_58.f90: New test.

From-SVN: r241979
2016-11-08 23:07:21 +01:00
Janus Weil eba5aec8e3 re PR fortran/77596 ([F03] procedure pointer component with implicit interface can point to a function)
2016-11-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/77596
	* expr.c (gfc_check_pointer_assign): Add special check for procedure-
	pointer component with absent interface.

2016-11-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/77596
	* gfortran.dg/proc_ptr_comp_46.f90: New test.

From-SVN: r241972
2016-11-08 17:10:56 +01:00
Thomas Koenig 39b4b34de0 re PR fortran/78226 (Fill out location information everywhere)
2016-11-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78226
	* expr.c (gfc_generate_initializer):  Add where to EXPR_NULL
	statement.
	* iresolve.c (gfc_resolve_extends_type_of):  Add where to
	both arguments of the function.
	* resolve.c (resolve_select_type):  Add where to the
	second argument of the new statement.

From-SVN: r241927
2016-11-07 19:33:27 +00:00
Thomas Koenig c939044ae5 Fixed PR in ChangeLog entry.
From-SVN: r241910
2016-11-07 15:29:20 +00:00
Thomas Koenig ce38615375 re PR fortran/78226 (Fill out location information everywhere)
2016-11-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78826
	* match.c (gfc_match_select_type):  Add where for expr1.
	* resolve.c (resolev_select_type): Add where for expr1 of new
	statement.

From-SVN: r241909
2016-11-07 15:25:21 +00:00
Thomas Koenig eb950bf834 re PR fortran/78226 (Fill out location information everywhere)
2016-11-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78226
	resolve.c (build_loc_call): Add location to return value.

From-SVN: r241887
2016-11-06 21:27:32 +00:00
Andre Vehreschild cc03bf7a7b allocate_with_source_14.f03: Fixed number mallocs occuring.
gcc/testsuite/ChangeLog:

2016-11-06  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/allocate_with_source_14.f03: Fixed number mallocs
	occuring.

gcc/fortran/ChangeLog:

2016-11-06  Andre Vehreschild  <vehre@gcc.gnu.org>

	* expr.c (is_non_empty_structure_constructor): New function to detect
	non-empty structure constructor.
	(gfc_has_default_initializer): Analyse initializers.
	* resolve.c (cond_init): Removed.
	(resolve_allocate_expr): Removed dead code.  Moved invariant code out
	of the loop over all objects to allocate.
	(resolve_allocate_deallocate): Added the invariant code remove from
	resolve_allocate_expr.
	* trans-array.c (gfc_array_allocate): Removed nullify of structure
	components in favour of doing this in gfc_trans_allocate for both
	scalars and arrays in the same place.
	* trans-expr.c (gfc_trans_init_assign): Always using _vptr->copy for
	class objects.
	* trans-stmt.c (allocate_get_initializer): Get the initializer
	expression for object allocated.
	(gfc_trans_allocate): Nullify a derived type only, when no SOURCE=
	or MOLD= is present preventing duplicate work.  Moved the creation
	of the init-expression here to prevent code for conditions that
	can not occur on freshly allocated object, like checking for the need
	to free allocatable components.

From-SVN: r241885
2016-11-06 17:10:22 +01:00
Thomas Koenig 18bb8b8a2a re PR fortran/78221 (bogus warning: Non-zero imaginary part discarded in conversion [-Wconversion])
2016-11-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/78221
        * arith.c (gfc_complex2real):  Change gfc_warning_now to
        gfc_warning.

2016-11-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/78221
        * gfortran.dg/warn_conversion_9.f90:  New test.

From-SVN: r241884
2016-11-06 12:27:51 +00:00
Paul Thomas c7f587bd0f check.c (gfc_check_move_alloc): Introduce error to prevent aliasing between to and from arguments.
2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	* check.c (gfc_check_move_alloc): Introduce error to prevent
	aliasing between to and from arguments.

2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	* gfortran.dg/move_alloc_17.f03: New test.

From-SVN: r241872
2016-11-05 14:25:25 +00:00
Janus Weil 28ce22e6cb re PR fortran/69495 (unused-label warning does not tell which flag triggered it)
2016-11-05  Janus Weil  <janus@gcc.gnu.org>
	    Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR fortran/69495
	* invoke.texi: Mention -Wpedantic as an alias of -pedantic.
	* check.c (gfc_check_transfer): Mention responsible flag in warning
	message.
	* frontend-passes.c (do_warn_function_elimination): Ditto.
	* resolve.c (resolve_elemental_actual): Ditto.
	(resolve_operator): Ditto.
	(warn_unused_fortran_label): Ditto.
	* trans-common.c (translate_common): Ditto.


2016-11-05  Janus Weil  <janus@gcc.gnu.org>
	    Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/69495
	* gfortran.dg/elemental_optional_args_6.f90: Use -Wpedantic flag.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>
Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r241870
2016-11-05 11:35:23 +01:00
Paul Thomas d233ee5f50 re PR fortran/67564 (Segfault on sourced allocattion statement with class(*) arrays)
2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/67564
	* trans-expr.c (gfc_conv_class_to_class): Return _len component
	of unlimited polymorphic entities.

2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/67564
	* gfortran.dg/select_type_39.f03: New test.

From-SVN: r241869
2016-11-05 07:11:24 +00:00
Paul Thomas b125dc1e1b re PR fortran/64933 (ASSOCIATE on a character variable does not allow substring expressions)
2016-04-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/64933
	* primary.c (gfc_match_varspec): If selector expression is
	unambiguously an array, make sure that the associate name
	is an array and has an array spec. Modify the original
	condition for doing this to exclude character types.

2016-04-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/64933
	* gfortran.dg/associate_23.f90: New test.

From-SVN: r241860
2016-11-04 19:23:44 +00:00
Fritz Reese 6869e9c69f Default missing exponents to 0 with -fdec.
gcc/fortran/
	* gfortran.texi: Document.
	* gfortran.h (gfc_dt): New field default_exp.
	* primary.c (match_real_constant): Default exponent with -fdec.
	* io.c (match_io): Set dt.default_exp with -fdec.
	* ioparm.def (IOPARM_dt_default_exp): New.
	* trans-io.c (build_dt): Set IOPARM_dt_default_exp with -fdec.

	libgfortran/io/
	* io.h (IOPARM_DT_DEFAULT_EXP): New flag bit.
	* list_read.c (parse_real, read_real): Allow omission of exponent with
	IOPARM_DT_DEFAULT_EXP.
	* read.c (read_f): Ditto.

	gcc/testsuite/gfortran.dg/
	* dec_exp_1.f90, dec_exp_2.f90, dec_exp_3.f90: New testcases.

From-SVN: r241828
2016-11-03 18:09:44 +00:00
Fritz O. Reese 35ea947ffa Support legacy PARAMETER statements with -std=legacy.
gcc/fortran/
	* decl.c (gfc_match_parameter): Allow omitted '()' with -std=legacy.
	* parse.c (decode_statement): Match "parameter" before assignments.
	* gfortran.texi: Document.

	gcc/testsuite/gfortran.dg/
	* dec_parameter_1.f: New test.
	* dec_parameter_2.f90: Likewise.
	* dec_parameter_3.f90: Likewise.
	* dec_parameter_4.f90: Likewise.

From-SVN: r241823
2016-11-03 16:00:58 +00:00
Fritz O. Reese 3df19fa0d4 New warning -Wargument-mismatch for function argument mismatches.
gcc/fortran/
	* lang.opt, invoke.texi: New argument -Wargument-mismatch.
	* interface.c (compare_parameter, compare_actual_formal,
	gfc_check_typebound_override, argument_rank_mismatch): Control argument
	mismatch warnings with -Wargument-mismatch.
	* resolve.c (resolve_structure_cons, resolve_global_procedure): Ditto.

	gcc/testsuite/gfortran.dg/
	* warn_argument_mismatch_1.f90: New test.

From-SVN: r241795
2016-11-02 14:56:41 +00:00
Fritz Reese eab1ee2254 Allow warning flags to associate through gfc_error.
gcc/fortran/
	* gfortran.h (gfc_error): New declaration for gfc_error with 'opt'.
	* error.c (gfc_error): Add optional 'opt' argument.
	* error.c (gfc_notify_std): Call fully-qualified gfc_error.

From-SVN: r241794
2016-11-02 14:46:33 +00:00
Thomas Koenig 5b7c051940 re PR fortran/78178 (ICE in WHERE statement with diagnostic)
2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78178
	* match.c (match_simple_where):  Fill in locus for assigment
	in simple WHERE statement.

2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/69544
	* gfortran.dg/where_6.f90:  New test.

From-SVN: r241756
2016-11-01 21:16:46 +00:00
Thomas Koenig 7f4266d4fd re PR fortran/69544 (Internal compiler error with -Wall and where)
2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/69544
	* match.c (gfc_match_where):  Fill in locus for assigment
	in simple WHERE statement.

2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/69544
	* gfortran.dg/where_5.f90:  New test.

From-SVN: r241745
2016-11-01 16:18:18 +00:00
Jerry DeLisle 120a4c4573 re PR fortran/54679 (Erroneous "Expected P edit descriptor" in conjunction with L descriptor)
2016-10-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/54679
	* io.c (check_format): Adjust checks for FMT_L to treat a zero
	width as an extension, giving warnings or error as appropriate.
	Improve messages.
	PR libgfortran/54679
	* io/format.c (parse_format_list): Adjust checks for FMT_L to
	treat a zero width as an extension, giving warnings or error
	as appropriate. Improve messages.
	PR fortran/54679
	* gfortran.dg/fmt_l.f90: Update test.
	* gfortran.dg/fmt_l0.f90: New test.

From-SVN: r241720
2016-10-31 19:59:04 +00:00
Jakub Jelinek 5cea3ad6b5 dwarf2out.h (struct dw_loc_descr_node): Adjust comment for frame_offset_rel bit.
* dwarf2out.h (struct dw_loc_descr_node): Adjust comment
	for frame_offset_rel bit.
	(struct array_descr_info): Add rank field.
	* dwarf2out.c (struct loc_descr_context): Add placeholder_arg
	and placeholder_seen fields.
	(resolve_args_picking_1): Handle also frame_offset_rel DW_OP_dup
	and DW_OP_over.  Optimize DW_OP_pick 0 into DW_OP_dup and
	DW_OP_pick 1 into DW_OP_over.
	(function_to_dwarf_procedure, type_byte_size, field_byte_offset,
	gen_variant_part): Clear placeholder_{arg,seen}.
	(loc_list_from_tree_1): Drop const from context argument.
	Handle integral PLACEHOLDER_EXPR if context->placeholder_arg.
	(loc_list_for_address_of_addr_expr_of_indirect_ref,
	loc_list_from_tree, loc_descriptor_from_tree): Drop const from
	context argument.
	(add_scalar_info): Drop const from context argument.  Handle
	context->placeholder_arg.
	(add_bound_info): Drop const from context argument.
	(gen_descr_array_type_die): Drop const from ctx variable.
	Initialize placeholder_arg and placeholder_seen.  Add DW_AT_rank
	attribute and use a single DW_TAG_generic_subrange instead of
	7 DW_TAG_subrange_type for assumed rank arrays.
fortran/
	* trans-types.c (gfc_get_array_descr_info): For -gdwarf-5 or
	-gno-strict-dwarf, handle assumed rank arrays the way dwarf2out
	expects.
ada/
	* gcc-interface/misc.c (gnat_get_array_descr_info): Clear rank
	field.

From-SVN: r241719
2016-10-31 20:35:47 +01:00
Thomas Koenig 396e56d2da re PR fortran/67219 (Incorrect conversion warning)
2016-10-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/67219
	* arith.c (gfc_int2real):  Change gfc_warning_now
	to gfc_warning.
	* primary.c (match_complex_constant):  If there
	is no comma, throw away any warning which might have
	been issued by gfc_int2real.

2016-10-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/67219
	* gfortran.dg/pr67219.f90:  New test.

From-SVN: r241689
2016-10-30 17:48:27 +00:00
Steven G. Kargl fdfc9e44c5 re PR fortran/71891 (fortran/symbol.c:4864: suspicious if ?)
2016-10-28  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/71891
	* symbol.c (gfc_type_compatible): Fix typo.

From-SVN: r241668
2016-10-28 23:37:03 +00:00
Jakub Jelinek 6f21288f8c re PR fortran/78026 (ICE in gfc_resolve_omp_declare_simd, at fortran/openmp.c:5190)
PR fortran/78026
	* parse.c (decode_statement): Don't create namespace for possible
	select type here and destroy it afterwards.
	(parse_select_type_block): Set gfc_current_ns to new_st.ext.block.ns.
	(parse_executable, gfc_parse_file): Formatting fixes.
	* match.c (gfc_match_select_type): Create namespace for select type
	here, only after matching select type.  Formatting fixes.  Free that
	namespace if not returning MATCH_YES, after gfc_undo_symbols,
	otherwise remember it in new_st.ext.block.ns and switch to parent
	namespace anyway.

	* gfortran.dg/gomp/pr78026.f03: New test.
	* gfortran.dg/select_type_38.f03: New test.

From-SVN: r241630
2016-10-27 21:55:12 +02:00
Fritz Reese f8da53e093 Fix initialization of UNIONs with -finit-derived.
gcc/fortran/
	* expr.c (generate_union_initializer, get_union_initializer): New.
	* expr.c (component_initializer): Consider BT_UNION specially.
	* resolve.c (resolve_structure_cons): Hack for BT_UNION.
	* trans-expr.c (gfc_trans_subcomponent_assign): Ditto.
	* trans-expr.c (gfc_conv_union_initializer): New.
	* trans-expr.c (gfc_conv_structure): Replace UNION handling code with
	new function gfc_conv_union_initializer.

	gcc/testsuite/gfortran.dg/
	* dec_init_1.f90, dec_init_2.f90: Remove -fdump-tree-original.
	* dec_init_3.f90, dec_init_4.f90: New tests.

From-SVN: r241626
2016-10-27 17:21:46 +00:00
Steven G. Kargl fe14572b1a re PR fortran/78092 (ICE when calling SIZEOF on CLASS(*) entry)
2016-10-26  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/78092
	* trans-intrinsic.c (gfc_conv_intrinsic_sizeof):  Fix reference to an
	array element of type CLASS.

2016-10-26  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/78092
	* gfortran.dg/pr78092.f90: New test.

From-SVN: r241610
2016-10-27 03:08:13 +00:00
Paul Thomas cd612e8a01 re PR fortran/78108 (Generic type-bound operator conflicts)
2016-10-26  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78108
	* resolve.c (resolve_typebound_intrinsic_op): For submodules
	suppress the error and return if the same procedure symbol
	is added more than once to the interface.

2016-10-26  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78108
	* gfortran.dg/submodule_18.f08: New test.
	* gfortran.dg/submodule_19.f08: New test.

From-SVN: r241555
2016-10-26 14:48:02 +00:00
Fritz Reese 0ef33d4462 New I/O specifiers CARRIAGECONTROL, READONLY, SHARE with -fdec.
gcc/fortran/
	* gfortran.texi: Document.
	* frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL.
	* io.c (gfc_free_open, gfc_resolve_open, gfc_match_open): Ditto.
	* gfortran.h (gfc_open): Add SHARE, CARRIAGECONTROL, and READONLY.
	* io.c (io_tag, match_open_element): Ditto.
	* ioparm.def: Ditto.
	* trans-io.c (gfc_trans_open): Ditto.
	* io.c (match_dec_etag, match_dec_ftag): New functions.

	libgfortran/io/
	* libgfortran.h (IOPARM_OPEN_HAS_READONLY, IOPARM_OPEN_HAS_SHARE,
	IOPARM_OPEN_HAS_CC): New for READONLY, SHARE, and CARRIAGECONTROL.
	* close.c (st_close): Support READONLY.
	* io.h (st_parameter_open, unit_flags): Support SHARE, CARRIAGECONTROL,
	and READONLY.
	* open.c (st_open): Ditto.
	* transfer.c (data_transfer_init): Ditto.
	* io.h (st_parameter_dt): New member 'cc' for CARRIAGECONTROL.
	* write.c (write_check_cc, write_cc): New functions for CARRIAGECONTROL.
	* transfer.c (next_record_cc): Ditto.
	* file_pos.c (st_endfile): Support SHARE and CARRIAGECONTROL.
	* io.h (st_parameter_inquire): Ditto.
	* open.c (edit_modes, new_unit): Ditto.
	* inquire.c (inquire_via_unit, inquire_via_filename): Ditto.
	* io.h (unit_share, unit_cc, cc_fortran, IOPARM_INQUIRE_HAS_SHARE,
	IOPARM_INQUIRE_HAS_CC): New for SHARE and CARRIAGECONTROL.
	* open.c (share_opt, cc_opt): Ditto.
	* read.c (read_x): Support CARRIAGECONTROL.
	* transfer.c (read_sf, next_record_r, next_record_w): Ditto.
	* write.c (list_formatted_write_scalar, write_a): Ditto.
	* unix.h (close_share): New prototype.
	* unix.c (open_share, close_share): New functions to handle SHARE.
	* unix.c (open_external): Handle READONLY. Call open_share.
	* close.c (st_close): Call close_share.

	gcc/testsuite/
	* dec_io_1.f90: New test.
        * dec_io_2.f90: New test.
        * dec_io_3.f90: New test.
        * dec_io_4.f90: New test.
        * dec_io_5.f90: New test.
        * dec_io_6.f90: New test.

From-SVN: r241550
2016-10-26 12:11:44 +00:00
Fritz Reese dd90ca33e8 Convert logical ops on integers to bitwise equivalent with -fdec.
gcc/fortran/
	* gfortran.texi: Document.
	* resolve.c (logical_to_bitwise): New function.
	* resolve.c (resolve_operator): Wrap operands with logical_to_bitwise.

	gcc/testsuite/gfortran.dg/
	* dec_bitwise_ops_1.f90, dec_bitwise_ops_2.f90: New testcases.

From-SVN: r241534
2016-10-25 18:27:51 +00:00
Andre Vehreschild cef026ecaf re PR fortran/72770 (ICE in make_ssa_name_fn, at tree-ssanames.c:263)
gcc/testsuite/ChangeLog:

2016-10-25  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/72770
	* gfortran.dg/alloc_comp_class_5.f03: Added test again that caused
	this pr.

gcc/fortran/ChangeLog:

2016-10-25  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/72770
	* class.c (find_intrinsic_vtab): No longer encode the string length
	into vtype's name and use the char's kind for the size instead of
	the string_length time the size.
	* trans-array.c (gfc_conv_ss_descriptor): For deferred length char
	arrays the dynamically sized type needs to be declared.
	(build_class_array_ref): Address the i-th array element by multiplying
	it with the _vptr->_size and the _len to make sure char arrays are
	addressed correctly.
	* trans-expr.c (gfc_conv_intrinsic_to_class): Made comment more
	precise.

From-SVN: r241528
2016-10-25 19:01:58 +02:00
Cesar Philippidis 8c78afcec8 intrinsic.texi (cosd): New mathop.
gcc/fortran/
	* intrinsic.texi (cosd): New mathop.

From-SVN: r241523
2016-10-25 08:47:12 -07:00
Fritz Reese 1cf1719bc0 Enable .XOR. operator with -std=legacy.
gcc/fortran/
	* match.c (gfc_match_intrinsic_op): Match ".XOR." with -std=legacy.
	* gfortran.texi: Document.

	gcc/testsuite/gfortran.dg/
	* dec_logical_xor_1.f90: New.
        * dec_logical_xor_2.f90: New.
        * dec_logical_xor_3.f03: New.

From-SVN: r241520
2016-10-25 15:30:51 +00:00
Fritz Reese cd714e1e56 Enable %LOC as an rvalue with -std=legacy.
gcc/fortran/
        * primary.c (gfc_match_rvalue): Match %LOC as LOC with -std=legacy.
        * gfortran.texi: Document.

	gcc/testsuite/gfortran.dg/
	* dec_loc_rval_1.f90: New test.
        * dec_loc_rval_2.f90: New test.
        * dec_loc_rval_3.f90: New test.

From-SVN: r241519
2016-10-25 15:27:39 +00:00