aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2019-02-23 12:18:44 +0000
committerPaul Thomas <pault@gcc.gnu.org>2019-02-23 12:18:44 +0000
commitc280838969d504e909e1f1f4e19642e91fab982f (patch)
tree0d97a4275e8f81a6df83f1a711e9d0f11a88d493 /libgfortran
parentace857f95d819377507f81ff4fc88ebf8b913eef (diff)
downloadgcc-c280838969d504e909e1f1f4e19642e91fab982f.zip
gcc-c280838969d504e909e1f1f4e19642e91fab982f.tar.gz
gcc-c280838969d504e909e1f1f4e19642e91fab982f.tar.bz2
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
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog16
-rw-r--r--libgfortran/runtime/ISO_Fortran_binding.c11
2 files changed, 21 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 9c72dfe..d0a3962 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,17 @@
+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.
+
2019-01-30 Uroš Bizjak <ubizjak@gmail.com>
PR libfortran/88678
@@ -47,7 +61,7 @@
PR libfortran/88776
* io/open.c (newunit): Free format buffer if the unit specified is for
- stdin, stdout, or stderr.
+ stdin, stdout, or stderr.
2019-01-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/libgfortran/runtime/ISO_Fortran_binding.c b/libgfortran/runtime/ISO_Fortran_binding.c
index 4161a74..6b7b10f 100644
--- a/libgfortran/runtime/ISO_Fortran_binding.c
+++ b/libgfortran/runtime/ISO_Fortran_binding.c
@@ -59,7 +59,7 @@ cfi_desc_to_gfc_desc (gfc_array_void *d, CFI_cdesc_t **s_ptr)
if (GFC_DESCRIPTOR_TYPE (d) == BT_CHARACTER)
GFC_DESCRIPTOR_TYPE (d) = BT_DERIVED;
else if (GFC_DESCRIPTOR_TYPE (d) == BT_DERIVED)
- GFC_DESCRIPTOR_TYPE (d) = BT_DERIVED;
+ GFC_DESCRIPTOR_TYPE (d) = BT_CHARACTER;
d->dtype.attribute = (signed short)s->attribute;
@@ -105,19 +105,20 @@ gfc_desc_to_cfi_desc (CFI_cdesc_t **d_ptr, const gfc_array_void *s)
d->attribute = (CFI_attribute_t)s->dtype.attribute;
if (GFC_DESCRIPTOR_TYPE (s) == BT_CHARACTER)
- d->type = CFI_type_struct;
- else if (GFC_DESCRIPTOR_TYPE (s) == BT_DERIVED)
d->type = CFI_type_Character;
+ else if (GFC_DESCRIPTOR_TYPE (s) == BT_DERIVED)
+ d->type = CFI_type_struct;
else
d->type = (CFI_type_t)GFC_DESCRIPTOR_TYPE (s);
- d->type = (CFI_type_t)(d->type
+ if (GFC_DESCRIPTOR_TYPE (s) != BT_DERIVED)
+ d->type = (CFI_type_t)(d->type
+ ((CFI_type_t)d->elem_len << CFI_type_kind_shift));
/* Full pointer or allocatable arrays have zero lower_bound. */
for (n = 0; n < GFC_DESCRIPTOR_RANK (s); n++)
{
- if (d->attribute == CFI_attribute_other)
+ if (d->attribute != CFI_attribute_other)
d->dim[n].lower_bound = (CFI_index_t)GFC_DESCRIPTOR_LBOUND(s, n);
else
d->dim[n].lower_bound = 0;