Commit Graph

5135 Commits

Author SHA1 Message Date
Steven G. Kargl c6a8a62985 re PR fortran/83900 (ICE in gfc_simplify_matmul, at fortran/simplify.c:4593)
2018-01-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/83900
    * simplify.c (gfc_simplify_matmul): Set return type correctly.

2018-01-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/83900
	* gfortran.dg/matmul_18.f90: New test.

From-SVN: r256920
2018-01-20 20:45:50 +00:00
Steven G. Kargl 0ba299611d re PR fortran/83900 (ICE in gfc_simplify_matmul, at fortran/simplify.c:4593)
2018-01-19  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/83900
	* simplify.c (gfc_simplify_matmul): Delete bogus assertion.

2018-01-19  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/83900
	* gfortran.dg/matmul_17.f90: New test.

From-SVN: r256913
2018-01-20 07:00:43 +00:00
Steven G. Kargl 7d94fb328d backport: re PR fortran/80768 (NULL pointer dereferenced in gfc_check_num_images at fortran/check.c)
2018-01-19  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport of r250734 from mainline
	PR fortran/80768
	* check.c (gfc_check_num_images): Fix typo.

2018-01-19  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/80768
	* gfortran.dg/num_images_1.f90:  New test that tests fix in r250734.

From-SVN: r256907
2018-01-19 23:37:29 +00:00
Harald Anlauf 8f87c1ab9b backport: re PR fortran/83864 (ICE in gfc_apply_init, at fortran/expr.c:4271)
2018-01-18  Harald Anlauf  <anlauf@gmx.de>

	Backport from mainline
	PR fortran/83864
	* expr.c (gfc_apply_init): Do not dereference NULL pointer.

2018-01-18  Harald Anlauf  <anlauf@gmx.de>

	Backport from mainline
	PR fortran/83864
	* gfortran.dg/pr83864.f90: New test.

From-SVN: r256857
2018-01-18 18:27:22 +00:00
Steven G. Kargl a38e64ad03 backport: re PR fortran/83874 (ICE initializing character array from derived type)
2018-01-17  Harald Anlauf  <anlauf@gmx.de>

	Backport from mainline
	PR fortran/83874
	* decl.c (add_init_expr_to_sym): Do not dereference NULL pointer.

2018-01-17  Harald Anlauf  <anlauf@gmx.de>

	Backport from mainline
	PR fortran/83874
	* gfortran.dg/pr83874.f90: New test.

From-SVN: r256829
2018-01-18 00:30:42 +00:00
Steven G. Kargl e2be496352 backport: re PR fortran/78814 (ICE in symbol_rank, at fortran/interface.c:1265)
2012-01-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from mainline
        PR fortran/78814
        * interface.c (symbol_rank): Check for NULL pointer.

2012-01-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from mainline
        PR fortran/78814
        * gfortran.dg/interface_40.f90: New testcase.

From-SVN: r256646
2018-01-13 18:58:56 +00:00
Steven G. Kargl 91716fe0dd re PR fortran/82367 (ICE with deferred length string allocate on non-deferred length argument)
2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82367
	* resolve.c (resolve_allocate_expr): Check for NULL pointer.

2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82367
	* gfortran.dg/deferred_character_18.f90: New test.

From-SVN: r256466
2018-01-10 23:41:48 +00:00
Steven G. Kargl 7a760f1977 backport: re PR fortran/83093 (ICE in fold_convert_loc, at fold-const.c:2266)
2018-01-10 Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from trunk
	PR fortran/83093
	* resolve.c (resolve_charlen): Check the type of cl->length
	after resolution.

2018-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from trunk
	PR fortran/83093
	* gfortran.dg/allocate_with_typespec_7.f90: New test.

From-SVN: r256459
2018-01-10 22:35:00 +00:00
Steven G. Kargl ee30b822e5 backport: re PR fortran/82841 (Segfault in gfc_simplify_transfer)
2018-01-10  Steven G. Kargl  <kargl@kgcc.gnu.org>

	Backport r254555 from trunk
	PR Fortran/82841
	* gfortran.dg/transfer_simplify_11.f90: New test.


2018-01-10  Steven G. Kargl  <kargl@kgcc.gnu.org>

	Backport r254555 from trunk
	PR Fortran/82841
	* simplify.c(gfc_simplify_transfer): Do not dereference a NULL pointer.
	Unwrap a short line.

From-SVN: r256445
2018-01-10 18:47:44 +00:00
Steven G. Kargl 58929d71e1 re PR fortran/83679 (r256113 causes regression on pr77942.f90)
2018-01-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR Fortran/83679
	* simplify.c (gfc_simplify_cshift): Restore early return for zero-sized
	array.  Update Copyright year while here.

From-SVN: r256263
2018-01-04 20:16:23 +00:00
Thomas Koenig 52535f91db re PR fortran/83650 (Wrong simplification in cshift with negative shifts)
2018-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/83650
	* simplify.c (gfc_simplify_cshift): Correct contition for
	negative shifts.

2018-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/83650
	* gfortran.dg/simplify_cshift_1.f90: Correct condition.

From-SVN: r256085
2018-01-02 18:01:31 +00:00
Steven G. Kargl 8c5b3f8f74 re PR fortran/83548 (Compilation Error using logical function in parameter)
2017-12-28  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR Fortran/83548
	* match.c (gfc_match_type_spec): Check for LOGICAL conflict in
	type-spec versus LOGICAL intrinsic subprogram.

2017-12-28  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR Fortran/83548
	* gfortran.dg/array_constructor_type_22.f03: New test.

From-SVN: r256025
2017-12-28 20:43:38 +00:00
Jakub Jelinek 88b712c241 backport: re PR fortran/81304 (Bogus warning with -Wsurprising and -fopenmp: Type specified for intrinsic function 'min' / 'max')
Backported from mainline
	2017-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/81304
	* trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Set
	attr.implicit_type in intrinsic_sym to avoid undesirable warning.

	* testsuite/libgomp.fortran/pr81304.f90: New test.

From-SVN: r255716
2017-12-15 23:00:48 +01:00
Jakub Jelinek 29d1342c4b backport: re PR fortran/81841 (THREADPRIVATE (OpenMP) wrongly rejected in BLOCK DATA)
Backported from mainline
	2017-11-23  Dirk Broemmel  <d.broemmel@fz-juelich.de>
		    Jakub Jelinek  <jakub@redhat.com>

	PR fortran/81841
	* parse.c (parse_spec): Allow ST_OMP_THREADPRIVATE inside of
	BLOCK DATA.

	* libgomp.fortran/pr81841.f90: New test.

From-SVN: r255712
2017-12-15 22:55:47 +01:00
Paul Thomas a82d7ade2d re PR fortran/83021 (gfortran segfault in polymorphic assignment)
2017-11-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83021
	* resolve.c (resolve_component): Only escape for use assciated
	vtypes if the current namespace has no proc_name and is most
	particularly block data.

From-SVN: r255205
2017-11-28 15:38:55 +00:00
Paul Thomas a687bfa9f7 backport: re PR fortran/79072 (ICE with class(*) pointer function result and character value)
2017-11-23  Paul Thomas  <pault@gcc.gnu.org>


	Backported from trunk
	PR fortran/79072
	* trans-expr.c (trans_class_vptr_len_assignment): Set from_len
	if the temporary is unlimited polymorphic.
	* trans-stmt.c (trans_associate_var): Use the fake result decl
	to obtain the 'len' field from an explicit function result when
	in that function scope.

2017-11-23  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk
	PR fortran/79072
	* gfortran.dg/class_result_5.f90: New test.
	* gfortran.dg/class_result_6.f90: New test.

From-SVN: r255120
2017-11-23 21:02:48 +00:00
Paul Thomas ddf89dd532 backport: re PR fortran/82586 ([PDT] ICE: write_symbol(): bad module symbol)
2017-11-21  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk fix for PR82586
	PR fortran/78686
	* resolve.c (resolve_generic_f): Check usage of derived type by
	calling gfc_use_derived.

2017-11-21  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk fix for PR82586
	PR fortran/78686
	* gfortran.dg/pr78686.f90: New test.

From-SVN: r255029
2017-11-21 19:09:01 +00:00
Paul Thomas 71360fd464 backport: re PR fortran/82934 (Segfault on assumed character length in allocate)
2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/82934
	* trans-stmt.c (gfc_trans_allocate): Remove the gcc_assert on
	null string length for assumed length typespec and set
	expr3_esize to NULL_TREE;

2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/82934
	* gfortran.dg/allocate_assumed_charlen_1.f90: New test.

From-SVN: r254709
2017-11-13 20:46:08 +00:00
Paul Thomas 7951af5409 backport: re PR fortran/78619 (ICE in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:889)
2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/78619
	* check.c (same_type_check): Introduce a new argument 'assoc'
	with default value false. If this is true, use the symbol type
	spec of BT_PROCEDURE expressions.
	(gfc_check_associated): Set 'assoc' true in the call to
	'same_type_check'.

2017-11-13  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/78619
	* gfortran.dg/pr78619.f90: New test.

From-SVN: r254708
2017-11-13 20:43:26 +00:00
Janne Blomqvist 62adf57eea Introduce logical_type_node and use it
Backport from trunk.

Earlier GFortran used to redefine boolean_type_node, which in the rest
of the compiler means the C/C++ _Bool/bool type, to the Fortran
default logical type.  When this redefinition was removed, a few
issues surfaced. Namely,

1) PR 82869, where we created a boolean tmp variable, and passed it to
the runtime library as a Fortran logical variable of a different size.

2) Fortran specifies that logical operations should be done with the
default logical kind, not in any other kind.

3) Using 8-bit variables have some issues, such as
   - on x86, partial register stalls and length prefix changes.
      - s390 has a compare with immediate and jump instruction which
           works with 32-bit but not 8-bit quantities.

This patch addresses these issues by introducing a type
logical_type_node which is a Fortran LOGICAL variable of default
kind. It is then used in places were the Fortran standard mandates, as
well as for compiler generated temporary variables.

For x86-64, using the Polyhedron benchmark suite, no performance or
code size difference worth mentioning was observed.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2017-11-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR 82869
	* convert.c (truthvalue_conversion): Use logical_type_node.
	* trans-array.c (gfc_trans_allocate_array_storage): Likewise.
	(gfc_trans_create_temp_array): Likewise.
	(gfc_trans_array_ctor_element): Likewise.
	(gfc_trans_array_constructor_value): Likewise.
	(trans_array_constructor): Likewise.
	(trans_array_bound_check): Likewise.
	(gfc_conv_array_ref): Likewise.
	(gfc_trans_scalarized_loop_end): Likewise.
	(gfc_conv_array_extent_dim): Likewise.
	(gfc_array_init_size): Likewise.
	(gfc_array_allocate): Likewise.
	(gfc_trans_array_bounds): Likewise.
	(gfc_trans_dummy_array_bias): Likewise.
	(gfc_conv_array_parameter): Likewise.
	(duplicate_allocatable): Likewise.
	(duplicate_allocatable_coarray): Likewise.
	(structure_alloc_comps): Likewise
	(get_std_lbound): Likewise
	(gfc_alloc_allocatable_for_assignment): Likewise
	* trans-decl.c (add_argument_checking): Likewise
	(gfc_generate_function_code): Likewise
	* trans-expr.c (gfc_copy_class_to_class): Likewise
	(gfc_trans_class_array_init_assign): Likewise
	(gfc_trans_class_init_assign): Likewise
	(gfc_conv_expr_present): Likewise
	(gfc_conv_substring): Likewise
	(gfc_conv_cst_int_power): Likewise
	(gfc_conv_expr_op): Likewise
	(gfc_conv_procedure_call): Likewise
	(fill_with_spaces): Likewise
	(gfc_trans_string_copy): Likewise
	(gfc_trans_alloc_subarray_assign): Likewise
	(gfc_trans_pointer_assignment): Likewise
	(gfc_trans_scalar_assign): Likewise
	(fcncall_realloc_result): Likewise
	(alloc_scalar_allocatable_for_assignment): Likewise
	(trans_class_assignment): Likewise
	(gfc_trans_assignment_1): Likewise
	* trans-intrinsic.c (build_fixbound_expr): Likewise
	(gfc_conv_intrinsic_aint): Likewise
	(gfc_trans_same_strlen_check): Likewise
	(conv_caf_send): Likewise
	(trans_this_image): Likewise
	(conv_intrinsic_image_status): Likewise
	(trans_image_index): Likewise
	(gfc_conv_intrinsic_bound): Likewise
	(conv_intrinsic_cobound): Likewise
	(gfc_conv_intrinsic_mod): Likewise
	(gfc_conv_intrinsic_dshift): Likewise
	(gfc_conv_intrinsic_dim): Likewise
	(gfc_conv_intrinsic_sign): Likewise
	(gfc_conv_intrinsic_ctime): Likewise
	(gfc_conv_intrinsic_fdate): Likewise
	(gfc_conv_intrinsic_ttynam): Likewise
	(gfc_conv_intrinsic_minmax): Likewise
	(gfc_conv_intrinsic_minmax_char): Likewise
	(gfc_conv_intrinsic_anyall): Likewise
	(gfc_conv_intrinsic_arith): Likewise
	(gfc_conv_intrinsic_minmaxloc): Likewise
	(gfc_conv_intrinsic_minmaxval): Likewise
	(gfc_conv_intrinsic_btest): Likewise
	(gfc_conv_intrinsic_bitcomp): Likewise
	(gfc_conv_intrinsic_shift): Likewise
	(gfc_conv_intrinsic_ishft): Likewise
	(gfc_conv_intrinsic_ishftc): Likewise
	(gfc_conv_intrinsic_leadz): Likewise
	(gfc_conv_intrinsic_trailz): Likewise
	(gfc_conv_intrinsic_mask): Likewise
	(gfc_conv_intrinsic_spacing): Likewise
	(gfc_conv_intrinsic_rrspacing): Likewise
	(gfc_conv_intrinsic_size): Likewise
	(gfc_conv_intrinsic_sizeof): Likewise
	(gfc_conv_intrinsic_transfer): Likewise
	(gfc_conv_allocated): Likewise
	(gfc_conv_associated): Likewise
	(gfc_conv_same_type_as): Likewise
	(gfc_conv_intrinsic_trim): Likewise
	(gfc_conv_intrinsic_repeat): Likewise
	(conv_isocbinding_function): Likewise
	(conv_intrinsic_ieee_is_normal): Likewise
	(conv_intrinsic_ieee_is_negative): Likewise
	(conv_intrinsic_ieee_copy_sign): Likewise
	(conv_intrinsic_move_alloc): Likewise
	* trans-io.c (set_parameter_value_chk): Likewise
	(set_parameter_value_inquire): Likewise
	(set_string): Likewise
	* trans-openmp.c (gfc_walk_alloc_comps): Likewise
	(gfc_omp_clause_default_ctor): Likewise
	(gfc_omp_clause_copy_ctor): Likewise
	(gfc_omp_clause_assign_op): Likewise
	(gfc_omp_clause_dtor): Likewise
	(gfc_omp_finish_clause): Likewise
	(gfc_trans_omp_clauses): Likewise
	(gfc_trans_omp_do): Likewise
	* trans-stmt.c (gfc_trans_goto): Likewise
	(gfc_trans_sync): Likewise
	(gfc_trans_arithmetic_if): Likewise
	(gfc_trans_simple_do): Likewise
	(gfc_trans_do): Likewise
	(gfc_trans_forall_loop): Likewise
	(gfc_trans_where_2): Likewise
	(gfc_trans_allocate): Likewise
	(gfc_trans_deallocate): Likewise
	* trans-types.c (gfc_init_types): Initialize logical_type_node and
	their true/false trees.
	(gfc_get_array_descr_info): Use logical_type_node.
	* trans-types.h (logical_type_node): New tree.
	(logical_true_node): Likewise.
	(logical_false_node): Likewise.
	* trans.c (gfc_trans_runtime_check): Use logical_type_node.
	(gfc_call_malloc): Likewise
	(gfc_allocate_using_malloc): Likewise
	(gfc_allocate_allocatable): Likewise
	(gfc_add_comp_finalizer_call): Likewise
	(gfc_add_finalizer_call): Likewise
	(gfc_deallocate_with_status): Likewise
	(gfc_deallocate_scalar_with_status): Likewise
	(gfc_call_realloc): Likewise


gcc/testsuite/ChangeLog:

2017-11-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR 82869
	* gfortran.dg/logical_temp_io.f90: New test.
	* gfortran.dg/logical_temp_io_kind8.f90: New test.

From-SVN: r254706
2017-11-13 22:01:20 +02:00
Paul Thomas d006aa2b09 backport: re PR fortran/78641 ([OOP] ICE on polymorphic allocatable function in array constructor)
2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk
	PR fortran/78641
	* resolve.c (resolve_ordinary_assign): Do not add the _data
	component for class valued array constructors being assigned
	to derived type arrays.
	* trans-array.c (gfc_trans_array_ctor_element): Take the _data
	of class valued elements for assignment to derived type arrays.

2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	Backported from trunk
	PR fortran/78641
	* gfortran.dg/class_66.f90: New test.

From-SVN: r254444
2017-11-06 10:40:11 +00:00
Paul Thomas cc44302bc6 [multiple changes]
2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/69739
	* trans-expr.c (gfc_map_intrinsic_function): Return false for
	bounds without the DIM argument instead of ICEing.

2017-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/69739
	* gfortran.dg/pr69739.f90: New test.

From-SVN: r254442
2017-11-06 10:14:29 +00:00
Steven G. Kargl 6cdeebc0e6 re PR fortran/82796 (Private+equivalence in used module breaks compilation of pure function)
2017-11-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82796
	* resolve.c (resolve_equivalence): An entity in a common block within
 	a module cannot appear in an equivalence statement if the entity is
	with a pure procedure.

2017-11-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/82796
	* gfortran.dg/equiv_pure.f90: New test.

From-SVN: r254409
2017-11-04 16:41:09 +00:00
Andre Vehreschild 56d687fec3 trans-expr.c (gfc_trans_assignment_1): Character kind conversion may create a loop variant temporary, too.
gcc/fortran/ChangeLog:

2017-11-04  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-expr.c (gfc_trans_assignment_1): Character kind conversion may
	create a loop variant temporary, too.
	* trans-intrinsic.c (conv_caf_send): Treat char arrays as arrays and
	not as scalars.
	* trans.c (get_array_span): Take the character kind into account when
	doing pointer arithmetic.

gcc/testsuite/ChangeLog:

2017-11-04  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/coarray/send_char_array_1.f90: New test.

From-SVN: r254408
2017-11-04 15:37:03 +01:00
Paul Thomas 726e7a70b9 re PR fortran/81735 (double free or corruption (fasttop) error (SIGABRT) with character(:) and custom return type with allocatable)
2017-11-03  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81735
	* trans-decl.c (gfc_trans_deferred_vars): Correct case where
	'tmp' can be used unititialized.

2017-11-03  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81735
	* gfortran.dg/pr81735.f90: New test.

From-SVN: r254389
2017-11-03 19:01:29 +00:00
Paul Thomas 3ce323d917 re PR libfortran/80850 (Sourced allocate() fails to allocate a pointer)
2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* trans_expr.c (gfc_conv_procedure_call): When passing a class
	argument to an unlimited polymorphic dummy, it is wrong to cast
	the passed expression as unlimited, unless it is unlimited. The
	correct way is to assign to each of the fields and set the _len
	field to zero.

2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* gfortran.dg/class_64_f90 : New test.

From-SVN: r254299
2017-11-01 11:29:07 +00:00
Paul Thomas 1281989b2b re PR libfortran/80850 (Sourced allocate() fails to allocate a pointer)
2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* trans_expr.c (gfc_conv_procedure_call): When passing a class
	argument to an unlimited polymorphic dummy, it is wrong to cast
	the passed expression as unlimited, unless it is unlimited. The
	correct way is to assign to each of the fields and set the _len
	field to zero.

2017-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80850
	* gfortran.dg/class_64_f90 : New test.

From-SVN: r254293
2017-11-01 09:33:26 +00:00
Andre Vehreschild 202536931c check.c (gfc_check_co_reduce): Clarify error message.
gcc/fortran/ChangeLog:

2017-10-28  Andre Vehreschild  <vehre@gcc.gnu.org>

	* check.c (gfc_check_co_reduce): Clarify error message.

From-SVN: r254198
2017-10-28 16:56:06 +02:00
Paul Thomas d138f8ec62 re PR fortran/81758 ([OOP] Broken vtab)
2017-10-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81758
	* trans-expr.c (trans_class_vptr_len_assignment): 'vptr_expr'
	must only be set if the right hand side expression is of type
	class.

2017-10-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81758
	* gfortran.dg/class_63.f90: New test.

From-SVN: r254196
2017-10-28 08:53:19 +00:00
Paul Thomas 735b7d675a re PR fortran/82312 ([OOP] Pointer assignment to component of class variable results wrong vptr for the variable.)
2017-10-21  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/82312
	* resolve.c (gfc_resolve_code): Simplify condition for class
	pointer assignments becoming regular assignments by asserting
	that only class valued targets are permitted.
	* trans-expr.c (trans_class_pointer_fcn): New function using a
	block of code from gfc_trans_pointer_assignment.
	(gfc_trans_pointer_assignment): Call the new function. Tidy up
	a minor whitespace issue.

2017-10-21  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/82312
	* gfortran.dg/typebound_proc_36.f90 : New test.

From-SVN: r253976
2017-10-21 17:09:43 +00:00
Thomas Koenig 313b789516 backport: re PR fortran/79795 (Fortran ICE in resolve_symbol starting with r163221)
2017-10-20  Thomas Koenig  <tkoenig@gcc.gnu.org>

	Backport from trunk
	PR fortran/79795
	* resolve.c (resovle_symbol): Change gcc_assert to
	sensible error message.

2017-10-20  Thomas Koenig  <tkoenig@gcc.gnu.org>

	Backport from trunk
	PR fortran/79795
	* gfortran.dg/assumed_size_2.f90: New test.

From-SVN: r253951
2017-10-20 18:01:36 +00:00
Paul Thomas ce229d5066 re PR fortran/52832 ([F03] ASSOCIATE construct with proc-pointer selector is rejected)
2017-10-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/52832
	* match.c (gfc_match_associate): Before failing the association
	try again, allowing a proc pointer selector.

	PR fortran/80120
	PR fortran/81903
	PR fortran/82121
	* primary.c (gfc_match_varspec): Introduce 'tgt_expr', which
	points to the associate selector, if any. Go through selector
	references, after resolution for variables, to catch any full
	or section array references. If a class associate name does
	not have the same declared type as the selector, resolve the
	selector and copy the declared type to the associate name.
	Before throwing a no implicit type error, resolve all allowed
	selector expressions, and copy the resulting typespec.

	PR fortran/67543
	* resolve.c (resolve_assoc_var): Selector must cannot be the
	NULL expression and it must have a type.

	PR fortran/78152
	* resolve.c (resolve_symbol): Allow associate names to be
	coarrays.

2017-10-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78512
	* gfortran.dg/associate_9.f03 : Remove XFAIL.
	* gfortran.dg/associate_26.f90 : New test.

	PR fortran/80120
	* gfortran.dg/associate_27.f90 : New test.

	PR fortran/81903
	* gfortran.dg/associate_28.f90 : New test.

	PR fortran/82121
	* gfortran.dg/associate_29.f90 : New test.

	PR fortran/67543
	* gfortran.dg/associate_30.f90 : New test.

From-SVN: r253794
2017-10-16 19:44:04 +00:00
Paul Thomas ac7b259d92 re PR fortran/81048 (incorrect derived type initialization)
2017-10-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81048
	* resolve.c (resolve_symbol): Ensure that derived type array
	results get default initialization.

2017-10-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/81048
	* gfortran.dg/derived_init_4.f90 : New test.

From-SVN: r253793
2017-10-16 18:48:56 +00:00
Thomas Koenig 0efe5ea92c backport: re PR fortran/80118 (ICE with zero size parameter array)
2017-10-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from trunk
	PR fortran/80118
	* expr.c (gfc_get_full_arrayspec_from_expr): If there is
	no symtree, set array spec to NULL.

2017-10-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from trunk
	PR fortran/80118
	* gfortran.dg/zero_sized_7.f90: New test.



Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>

From-SVN: r253383
2017-10-03 15:50:45 +00:00
Janus Weil ef28b00460 backport: re PR fortran/81770 (Bogus warning: Pointer in pointer assignment might outlive the pointer target)
2017-09-02  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/81770
	* expr.c (gfc_check_pointer_assign): Improve the check whether pointer
	may outlive pointer target.


2017-09-02  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/81770
	* gfortran.dg/warn_target_lifetime_3.f90: Fix a typo.
	* gfortran.dg/warn_target_lifetime_4.f90: New testcase.

From-SVN: r251618
2017-09-02 21:04:08 +02:00
Jerry DeLisle d684a9bb4b backport: re PR fortran/81296 (derived type I/o problem)
2017-08-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk
	PR fortran/81296
	* trans-io.c (get_dtio_proc): Add check for format label and set
	formatted flag accordingly. Reorganize the code a little.

	* gfortran.dg/dtio_12.f90: Update test.

From-SVN: r251301
2017-08-23 00:41:10 +00:00
Jerry DeLisle 1ddec7a687 backport: re PR fortran/80164 (ICE in gfc_format_decoder at gcc/fortran/error.c:933)
2017-08-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk
	PR fortran/80164
	* trans-stmt.c (gfc_trans_call): If no code expr, use code->loc
	as warning/error locus.

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

From-SVN: r251189
2017-08-18 21:36:50 +00:00
Richard Biener 586a0829dc Update ChangeLog and version files for release
From-SVN: r251081
2017-08-14 07:59:11 +00:00
Janus Weil d4e39c8869 backport: re PR fortran/70601 ([OOP] ICE on procedure pointer component call)
2017-06-09  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/70601
	* trans-expr.c (gfc_conv_procedure_call): Fix detection of allocatable
	function results.


2017-06-09  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/70601
	* gfortran.dg/proc_ptr_comp_50.f90: New test.

From-SVN: r249066
2017-06-09 19:45:53 +02:00
Janus Weil 7c74f817f5 backport: re PR fortran/80766 ([OOP] ICE with type-bound procedure returning an array)
2017-06-05  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/80766
	* resolve.c (resolve_fl_derived): Make sure that vtype symbols are
	properly resolved.

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

	Backport from trunk
	PR fortran/80766
	* gfortran.dg/typebound_call_28.f90: New test.

From-SVN: r248873
2017-06-05 11:31:32 +02:00
Thomas Koenig bc21704623 re PR fortran/80904 (Matmul result allocated to wrong size)
2017-06-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/80904
	* frontend-passes.c (matmul_lhs_realloc):  Correct
	allocation size for case A1B2.

2017-06-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/80904
	* gfortran.dg/matmul_bounds_12.f90:  New test.

From-SVN: r248842
2017-06-02 17:44:19 +00:00
Jakub Jelinek f829242273 re PR fortran/80918 (Assumed size whole array rejected in depend clause)
PR fortran/80918
	* openmp.c (resolve_omp_clauses): Fix a typo.

	* gfortran.dg/gomp/pr80918.f90: New test.

From-SVN: r248813
2017-06-02 09:10:10 +02:00
Jerry DeLisle 90d2abbe74 backport: re PR fortran/80741 ([Regression 7/8] DTIO wrong code causes incorrect behaviour of namelist READ)
2017-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk
	PR libgfortran/80741
	* transfer.c (finalize_transfer): Reset last_char to 'empty'.
	* file_pos.c (formatted_backspace): Likewise.
	(st_endfile): Likewise.
	(st_rewind): Likewise.
	(st_flush): Likewise.

	* trans-io.c (transfer_namelist_element): Change check from
	NULL_TREE to null_pointer_node.

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

From-SVN: r248390
2017-05-23 22:05:56 +00:00
Jerry DeLisle 70e971cc61 backport: re PR fortran/80333 (Namelist dtio write of array of class does not traverse the array)
2017-05-23  Paul Thomas  <pault@gcc.gnu.org>

	Backport from trunk
	PR fortran/80333
	* trans-io.c (nml_get_addr_expr): If we are dealing with class
	type data set tmp tree to get that address.
	(transfer_namelist_element): Set the array spec to point to the
	the class data.

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

	* list_read.c (nml_read_obj): Compute pointer into class/type
	arrays from the nl->dim information. Update it for each iteration
	of the loop for the given object.

From-SVN: r248388
2017-05-23 21:39:41 +00:00
Jerry DeLisle d96f3d3658 backport: re PR fortran/78659 ([F03] Spurious "requires DTIO" reported against namelist statement)
2017-05-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk
	PR fortran/78659
	* io.c (dtio_procs_present): Add new function to check for DTIO
	procedures relative to I/O statement READ or WRITE.
	(gfc_resolve_dt): Add namelist checks using the new function.
	* resolve.c (dtio_procs_present): Remove function and related
	namelist checks. (resolve_fl_namelist): Add check specific to
	Fortran 95 restriction on namelist objects.

	* gfortran.dg/namelist_91.f90: New test.
	* gfortran.dg/namelist_92.f90: New test.
	* gfortran.dg/namelist_93.f90: New test.
	* gfortran.dg/namelist_94.f90: New test.

From-SVN: r248166
2017-05-17 18:09:48 +00:00
Steven G. Kargl 4fc88affeb re PR fortran/80752 (ICE with wrong type initialization)
2017-05-15  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/80752
	* expr.c (gfc_generate_initializer):  If type conversion fails,
	check for error and return NULL.

2017-05-15  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/80752
	gfortran.dg/pr80752.f90: New test.

From-SVN: r248076
2017-05-15 20:43:25 +00:00
Janus Weil 533a17774d backport: re PR fortran/80121 (Memory leak with derived-type intent(out) argument)
2017-05-05  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/80121
	* trans-expr.c (gfc_conv_procedure_call): Deallocate the components
	of allocatable intent(out) arguments.


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

	Backport from trunk
	PR fortran/80121
	* gfortran.dg/intent_out_9.f90: New test case.

From-SVN: r247662
2017-05-05 23:00:53 +02:00
Janus Weil 52637de8cc backport: re PR fortran/80392 ([OOP] ICE with allocatable polymorphic function result in a procedure pointer component)
2017-05-05  Janus Weil  <janus@gcc.gnu.org>

	Backport from trunk
	PR fortran/80392
	* trans-types.c (gfc_get_derived_type): Prevent an infinite loop when
	building a derived type that includes a procedure pointer component
	with a polymorphic result.

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

	Backport from trunk
	PR fortran/80392
	* gfortran.dg/proc_ptr_comp_49.f90: New test case.

From-SVN: r247655
2017-05-05 22:09:20 +02:00
Jerry DeLisle 9bf7f47385 backport: re PR fortran/80484 (Three syntax errors involving derived-type I/O)
2017-05-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk.
	PR fortran/80484
	* io.c (format_lex): Check for '/' and set token to FMT_SLASH.
	(check_format): Move FMT_DT checking code to data_desc section.
	* module.c (gfc_match_use): Include the case of INTERFACE_DTIO.
	Backport from mainline
	PR fortran/80484
	* gfortran.dg/dtio_29.f03: New test.

From-SVN: r247615
2017-05-04 18:45:50 +00:00
GCC Administrator 303f81ad7e Update ChangeLog and version files for release
From-SVN: r247493
2017-05-02 12:42:24 +00:00