This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41600] [OOP] SELECT TYPE with associate-name => exp: Arrays not supported
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Jan 2012 10:29:22 +0000
- Subject: [Bug fortran/41600] [OOP] SELECT TYPE with associate-name => exp: Arrays not supported
- Auto-submitted: auto-generated
- References: <bug-41600-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41600
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-25 10:29:22 UTC ---
The patch (cf. comment 3) for the issue in comment 1 has been submitted at:
http://gcc.gnu.org/ml/fortran/2012-01/msg00197.html
* * *
Patchlet for an unrelated issue - found for resolve.c, but I think the patch to
trans-decl.c should be correct as well (but I might be wrong).
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -7933,3 +7933,4 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target)
if (tsym->ts.type == BT_CLASS)
- sym->attr.target = tsym->attr.target || CLASS_DATA
(tsym)->attr.pointer;
+ sym->attr.target = tsym->attr.target
+ || CLASS_DATA (tsym)->attr.class_pointer;
else
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3689,3 +3689,3 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym,
gfc_wrapped_block * block)
&& (sym->ts.type == BT_CLASS
- && CLASS_DATA (sym)->attr.pointer))
+ && CLASS_DATA (sym)->attr.class_pointer))
continue;
* * *
Regarding comment 0 (with empty select type): The following hack works. The
problem is that one has
m%foo alias m%foo(<REF_AR_FULL>)
which is internally:
m->[ref]foo_class_container->[ref]<REF_AR_FULL>
which does not work as the class container is a scalar. The proper fix is
probably:
m->[ref]foo_class_container->[ref]_data->[ref]<REF_AR_FULL>
^^^^^^^
The patch below handles it in a round-about fashion: It ignores the array ref
by asking for the descriptor only and then adds the missing "_data".
The issue with a nonempty select type (unmodified comment 0) might be similar.
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1173,11 +1173,13 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block
*block)
else if (class_target && sym->attr.dimension)
{
gfc_se se;
gfc_init_se (&se, NULL);
+ se.descriptor_only = 1;
gfc_conv_expr (&se, e);
+ se.expr = gfc_class_data_get (se.expr);
gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se.expr)));
gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (sym->backend_decl)));
gfc_add_modify (&se.pre, sym->backend_decl, se.expr);