This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 28 Dec 2012 21:53:38 +0000
- Subject: [Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors
- Auto-submitted: auto-generated
- References: <bug-55825-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55825
--- Comment #5 from janus at gcc dot gnu.org 2012-12-28 21:53:38 UTC ---
There are problems with handling CLASS components in
gfc_trans_subcomponent_assign:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 194743)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -5934,11 +5934,14 @@ gfc_trans_subcomponent_assign (tree dest, gfc_comp
gfc_start_block (&block);
- if (cm->attr.pointer || cm->attr.proc_pointer)
+ if (cm->attr.pointer || cm->attr.proc_pointer
+ || (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.pointer))
{
gfc_init_se (&se, NULL);
/* Pointer component. */
- if (cm->attr.dimension && !cm->attr.proc_pointer)
+ if ((cm->attr.dimension
+ || (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.dimension))
+ && !cm->attr.proc_pointer)
{
/* Array pointer. */
if (expr->expr_type == EXPR_NULL)
However, this is not enough. The test case still gives an ICE.