http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51995
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |burnus at gcc dot gnu.org
|gnu.org |
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-25
13:29:48 UTC ---
(In reply to comment #4)
> I tested the program on i686 GNU/Linux running on Ubuntu-Maverick using gcc
> version 4.7.0 20120118 (experimental) (GCC).
>
> So it is definitely a bug in gfortran. Do you have any work-around?
Unfortunately, I am not aware of a workaround. I have to admit that I have not
fully understood why fclass->f2k_derived gets often but not always set.
However, the following patch works. Thus, you could either apply it and build
your own GCC, or you wait a day after the committal and get a nightly build at
http://gcc.gnu.org/wiki/GFortranBinaries - or you convince Matthias to do a new
Ubuntu build.
(In reply to comment #7)
> There, the problem is that one has:
> sym = sym->ts.u.derived;
> if (sym->f2k_derived)
Actually, f2k_derived should also get set for the class container.
Better patch (read: actually working) patch:
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -421,6 +421,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute
*attr,
c->attr.access = ACCESS_PRIVATE;
c->attr.pointer = 1;
}
+ else if (!fclass->f2k_derived)
+ fclass->f2k_derived = fclass->components->ts.u.derived->f2k_derived;
/* Since the extension field is 8 bit wide, we can only have
up to 255 extension levels. */