Commit Graph

10 Commits

Author SHA1 Message Date
Jakub Jelinek
8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Tobias Burnus
46927ade0f PR fortran/92470 Fixes for CFI_address
libgfortran/
        PR fortran/92470
        * runtime/ISO_Fortran_binding.c (CFI_establish): Set lower_bound to 0
        also for CFI_attribute_other.

        gcc/testsuite/
        PR fortran/92470
        * gfortran.dg/ISO_Fortran_binding_1.c (establish_c): Add assert for
        lower_bound == 0.

From-SVN: r278128
2019-11-13 12:13:57 +01:00
Tobias Burnus
fde7112d79 PR fortran/92470 Fixes for CFI_address
libgfortran/
        PR fortran/92470
        * runtime/ISO_Fortran_binding.c (CFI_address): Handle non-zero
        lower_bound; update error message.
        (CFI_allocate): Fix comment typo.
        (CFI_establish): Fix identation, fix typos, don't check values of 'dv'
        argument.

        gcc/testsuite/
        PR fortran/92470
        * gfortran.dg/ISO_Fortran_binding_17.c: New.
        * gfortran.dg/ISO_Fortran_binding_17.f90: New.
        * gfortran.dg/ISO_Fortran_binding_1.c (elemental_mult_c, allocate_c,
        section_c, select_part_c): Update for CFI_{address} changes;
        add asserts.

From-SVN: r278101
2019-11-12 20:33:10 +01:00
José Rui Faustino de Sousa
3f246567a4 PR fortran/92142 - CFI_setpointer corrupts descriptor
2019-11-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

        libgfortran/
        PR fortran/92142
        * runtime/ISO_Fortran_binding.c (CFI_setpointer): Don't
        override descriptor attribute; with -fcheck, check that
        it is a pointer.

        gcc/testsuite/
        PR fortran/92142
        * gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c: New.
        * gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.f90: New.
        * gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c: Correct
        upper bounds for case 0.

From-SVN: r278048
2019-11-11 11:18:14 +01:00
Tobias Burnus
fc5a970817 Fortran] PR92284 – gfc_desc_to_cfi_desc fixes
gcc/fortran/
        PR fortran/92284.
        * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Free CFI descriptor
        at the end; partial revised revert of Rev. 277502.

        libgfortran/
        PR fortran/92284.
        * runtime/ISO_Fortran_binding.c (gfc_desc_to_cfi_desc):

        gcc/testsuite/
        PR fortran/92284.
        * gfortran.dg/bind-c-intent-out.f90: Update expected dump;
        extend comment.
        * gfortran.dg/bind_c_array_params_3.f90: New.
        * gfortran.dg/bind_c_array_params_3_aux.c: New.

From-SVN: r277663
2019-10-31 11:12:55 +01:00
Paul Thomas
b3fbf95ec1 re PR fortran/91926 (assumed rank optional)
2019-10-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/91926
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Revert
	the change made on 2019-10-05.

From-SVN: r277204
2019-10-19 16:44:06 +00:00
Paul Thomas
980f185ce3 re PR fortran/91926 (assumed rank optional)
2019-10-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/91926
	* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Correct the
	assignment of the attribute field to account correctly for an
	assumed shape dummy. Assign separately to the gfc and cfi
	descriptors since the atribute can be different. Add btanch to
	correctly handle missing optional dummies.

2019-10-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/91926
	* gfortran.dg/ISO_Fortran_binding_13.f90 : New test.
	* gfortran.dg/ISO_Fortran_binding_13.c : Additional source.
	* gfortran.dg/ISO_Fortran_binding_14.f90 : New test.

2019-10-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/91926
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Do not
	modify the bounds and offset for CFI_other.

From-SVN: r276624
2019-10-05 08:17:55 +00:00
Paul Thomas
0d78e4aa06 re PR fortran/89843 (CFI_section delivers incorrect result descriptor)
2019-04-14  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/89843
	* trans-decl.c (gfc_get_symbol_decl): Assumed shape and assumed
	rank dummies of bind C procs require deferred initialization.
	(convert_CFI_desc): New procedure to convert incoming CFI
	descriptors to gfc types and back again.
	(gfc_trans_deferred_vars): Call it.
	* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Null the CFI
	descriptor pointer. Free the descriptor in all cases.

	PR fortran/89846
	* expr.c (is_CFI_desc): New function.
	(is_subref_array): Tidy up by referencing the symbol directly.
	* gfortran.h : Prototype for is_CFI_desc.
	* trans_array.c (get_CFI_desc): New function.
	(gfc_get_array_span, gfc_conv_scalarized_array_ref,
	gfc_conv_array_ref): Use it.
	* trans.c (get_array_span): Extract the span from descriptors
	that are indirect references.

	PR fortran/90022
	* trans-decl.c (gfc_get_symbol_decl): Make sure that the se
	expression is a pointer type before converting it to the symbol
	backend_decl type.
	* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Eliminate
	temporary creation for intent(in).

2019-04-14  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/89843
	* gfortran.dg/ISO_Fortran_binding_4.f90: Modify the value of x
	in ctg. Test the conversion of the descriptor types in the main
	program.
	* gfortran.dg/ISO_Fortran_binding_10.f90: New test.
	* gfortran.dg/ISO_Fortran_binding_10.c: Called by it.

	PR fortran/89846
	* gfortran.dg/ISO_Fortran_binding_11.f90: New test.
	* gfortran.dg/ISO_Fortran_binding_11.c: Called by it.

	PR fortran/90022
	* gfortran.dg/ISO_Fortran_binding_1.c: Correct the indexing for
	the computation of 'ans'. Also, change the expected results for
	CFI_is_contiguous to comply with standard.
	* gfortran.dg/ISO_Fortran_binding_1.f90: Correct the expected
	results for CFI_is_contiguous to comply with standard.
	* gfortran.dg/ISO_Fortran_binding_9.f90: New test.
	* gfortran.dg/ISO_Fortran_binding_9.c: Called by it.

2019-04-14  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/89843
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Only
	return immediately if the source pointer is null. Bring
	forward the extraction of the gfc type. Extract the kind so
	that the element size can be correctly computed for sections
	and components of derived type arrays. Remove the free of the
	CFI descriptor since this is now done in trans-expr.c.
	(gfc_desc_to_cfi_desc): Only allocate the CFI descriptor if it
	is not null.
	(CFI_section): Normalise the difference between the upper and
	lower bounds by the stride to correctly calculate the extents
	of the section.

	PR fortran/89846
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Use
	the stride measure for the gfc span if it is not a multiple
	of the element length. Otherwise use the element length.

	PR fortran/90022
	* runtime/ISO_Fortran_binding.c (CFI_is_contiguous) : Return
	1 for true and 0 otherwise to comply with the standard. Correct
	the contiguity check for rank 3 and greater by using the stride
	measure of the lower dimension rather than the element length.

From-SVN: r270353
2019-04-14 18:14:58 +00:00
Paul Thomas
c280838969 re PR fortran/89385 (Incorrect members of C descriptor for an allocatable object)
2019-02-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/89385
	PR fortran/89366
	* decl.c (gfc_verify_c_interop_param): Restriction on string
	length being one is lifted for F2018.
	* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): For scalar
	characters with intent in, make a temporary and copy the result
	of the expression evaluation into it.
	(gfc_conv_procedure_call): Set a flag for character formal args
	having a character length that is not unity. If the procedure
	is bind C, call gfc_conv_gfc_desc_to_cfi_desc in this case.
	Also, extend bind C calls to unconditionally convert both
	pointers and allocatable expressions.

2019-02-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/89385
	* gfortran.dg/ISO_Fortran_binding_1.f90 : Correct test for
	previously incorrect lbound for allocatable expressions. Also
	correct stop values to avoid repetition.
	* gfortran.dg/ISO_Fortran_binding_5.f90 : New test
	* gfortran.dg/ISO_Fortran_binding_5.c : Support previous test.

	PR fortran/89366
	* gfortran.dg/ISO_Fortran_binding_6.f90 : New test
	* gfortran.dg/ISO_Fortran_binding_6.c : Support previous test.
	* gfortran.dg/pr32599.f03 : Set standard to F2008.

2019-02-23  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/89385
	PR fortran/89366
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc) : In the
	interchange between character and derived, the character type
	was being set incorrectly.
	(gfc_desc_to_cfi_desc) : Eliminate the interchange of types in
	this function. Do not add the kind and length information to
	the type field of structures. Lbounds were incorrectly being
	set to zero for allocatable and pointer descriptors. Should
	have been non-pointer, non-allocatables that received this
	treatment.

From-SVN: r269156
2019-02-23 12:18:44 +00:00
Paul Thomas
bbf18dc5d2 gfortran.texi: Add description in sections on TS 29113 and further interoperability with C.
2019-01-12  Paul Thomas  <pault@gcc.gnu.org>

	* gfortran.texi : Add description in sections on TS 29113 and
	further interoperability with C.
	* trans-array.c (gfc_conv_descriptor_attribute): New function.
	(gfc_get_dataptr_offset): Remove static function attribute.
	* trans-array.h : Add prototypes for above functions.
	* trans-decl.c : Add declarations for the library functions
	cfi_desc_to_gfc_desc and gfc_desc_to_cfi_desc.
	* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): New function.
	(gfc_conv_procedure_call): Call it for scalar and array actual
	arguments, when the formal arguments are bind_c with assumed
	shape or assumed rank.
	* trans.h : External declarations for gfor_fndecl_cfi_to_gfc
	and gfor_fndecl_gfc_to_cfi.

2019-01-12  Paul Thomas  <pault@gcc.gnu.org>

	* gfortran.dg/ISO_Fortran_binding_1.f90 : New test.
	* gfortran.dg/ISO_Fortran_binding_1.c : Auxilliary file for test.
	* gfortran.dg/ISO_Fortran_binding_2.f90 : New test.
	* gfortran.dg/ISO_Fortran_binding_2.c : Auxilliary file for test.
	* gfortran.dg/bind_c_array_params_2.f90 : Change search string
	for dump tree scan.

2019-01-12  Paul Thomas  <pault@gcc.gnu.org>

	* ISO_Fortran_binding.h : New file.
	* Makefile.am : Include ISO_Fortran_binding.c in the list of
	files to compile.
	* Makefile.in : Regenerated.
	* gfortran.map : Add _gfortran_cfi_desc_to_gfc_desc,
	_gfortran_gfc_desc_to_cfi_desc and the CFI API functions.
	* runtime/ISO_Fortran_binding.c : New file containing the new
	functions added to the map.

From-SVN: r267881
2019-01-12 15:25:52 +00:00