This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, fortran] PR25730 - ICE in gfc_conv_component_ref, triggered by character component references.
- From: "THOMAS Paul Richard 169137" <paul dot richard dot thomas at cea dot fr>
- To: <gcc-patches at gcc dot gnu dot org>, <fortran at gcc dot gnu dot org>
- Cc: <andrea dot bedini at gmail dot com>, <salvatore dot filippone at uniroma2 dot it>
- Date: Tue, 10 Jan 2006 15:23:52 +0100
- Subject: [Patch, fortran] PR25730 - ICE in gfc_conv_component_ref, triggered by character component references.
:ADDPATCH fortran:
This regression is due to my having forgotten to copy character length backend declarations, whilst copying derived type backend declarations in trans-type(copy_dt_decls_ifequal). The result is that some character components do not have a backend declaration and the ICE is triggered. The enclosed patch fixes the problem.
I intend to commit to trunk and 4.1 tomorrow morning, invoking the obvious rule, unless anybody objects. The reason is that this is an obvious omission on my part and it does not change the principle of the original patch.
Bootstrapped and regtested on Cygwin_NT/PIV. OK?
Paul
Please excuse any white space problems that there might be - they will be removed from the committed version.
2005-01-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25730
* trans-types.c (copy_dt_decls_ifequal): Copy backend decl for
character lengths.
2006-01-10 Andrea Bedini <andrea.bedini@gmail.com>
PR fortran/25730
* gfortran.dg/used_types_1.f90: New test.
Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c (révision 109498)
+++ gcc/fortran/trans-types.c (copie de travail)
@@ -1418,14 +1418,17 @@
a derived type, we need a copy of its component declarations.
This is done by recursing into gfc_get_derived_type and
ensures that the component's component declarations have
- been built. */
+ been built. If it is a character, we need the character
+ length, as well. */
for (; to_cm; to_cm = to_cm->next, from_cm = from_cm->next)
{
to_cm->backend_decl = from_cm->backend_decl;
if (from_cm->ts.type == BT_DERIVED)
- gfc_get_derived_type (to_cm->ts.derived);
+ gfc_get_derived_type (to_cm->ts.derived);
+
+ else if (from_cm->ts.type == BT_CHARACTER)
+ to_cm->ts.cl->backend_decl = from_cm->ts.cl->backend_decl;
}
-
return 1;
}
!==================used_types_1.f90=========================
! { dg-do compile }
! This checks that the fix for PR25730, which was a regression
! caused by the fix for PR19362.
!
! Contributed by Andrea Bedini <andrea.bedini@gmail.com>
!==============
MODULE testcase
TYPE orbit_elem
CHARACTER(4) :: coo
END TYPE orbit_elem
END MODULE
MODULE tp_trace
USE testcase
TYPE(orbit_elem) :: tp_store
CONTAINS
SUBROUTINE str_clan()
USE testcase
TYPE(orbit_elem) :: mtpcar
mtpcar%coo='a' !ICE was here
END SUBROUTINE str_clan
END MODULE