This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45586] [4.6/4.7 Regression] ICE non-trivial conversion at assignment
- 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: Tue, 26 Jul 2011 14:28:03 +0000
- Subject: [Bug fortran/45586] [4.6/4.7 Regression] ICE non-trivial conversion at assignment
- Auto-submitted: auto-generated
- References: <bug-45586-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45586
--- Comment #59 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-26 14:27:43 UTC ---
(In reply to comment #53)
> reduced testcase for 4.7
> y=>rs_gauge(i)%rs(j)%rs_grid%r
Here, "%r->data" is marked as restricted as "r" is allocatable. However, all
other references are a pointer.
The derived type is obtained via a nested calls to gfc_get_derived_type. For
"r" one calls gfc_get_array_type_bounds - seemingly with "restricted = 1".
If one now declares "rs_gauge", one calls gfc_nonrestricted_type which removes
the "restrict" qualifier from the type (i.e. "rs_gauge") and from the
"rs_gauge->rs" but does not go higher up the chain.
Thus, one somehow needs to walk the components and remove the "restrict" there
...
With the following patch, one does not get any ICE anymore, but I am neither
sure whether it is sufficient, nor whether it removes restrict qualifiers where
it shouldn't, nor whether it is correct at all.
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2421,6 +2421,9 @@ gfc_get_derived_type (gfc_symbol * derived)
&& !c->attr.proc_pointer)
field_type = build_pointer_type (field_type);
+ if (c->attr.pointer)
+ field_type = gfc_nonrestricted_type (field_type);
+
/* vtype fields can point to different types to the base type. */
if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.vtype)
field_type = build_pointer_type_for_mode (TREE_TYPE (field_type),