public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
@ 2011-10-05 19:48 burnus at gcc dot gnu.org
2011-10-05 19:49 ` [Bug fortran/50625] " burnus at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-05 19:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
Bug #: 50625
Summary: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost
for module CLASS variables
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org
The following program compiles with GCC 4.5 and ifort, but fails with GCC 4.6
and GCC 4.7 with:
if(allocated(x)) stop
1
Error: 'array' argument of 'allocated' intrinsic at (1) must be ALLOCATABLE
module m
type t
end type t
class(t), allocatable :: x
end module m
use m
implicit none
if(allocated(x)) stop
end
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
@ 2011-10-05 19:49 ` burnus at gcc dot gnu.org
2011-10-05 20:19 ` janus at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-05 19:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.6.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
2011-10-05 19:49 ` [Bug fortran/50625] " burnus at gcc dot gnu.org
@ 2011-10-05 20:19 ` janus at gcc dot gnu.org
2011-10-05 21:42 ` janus at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-05 20:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-10-05
Ever Confirmed|0 |1
--- Comment #1 from janus at gcc dot gnu.org 2011-10-05 20:18:58 UTC ---
I think the problem is that the 'class_ok' attribute is not set when loading
the symbol from the module.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
2011-10-05 19:49 ` [Bug fortran/50625] " burnus at gcc dot gnu.org
2011-10-05 20:19 ` janus at gcc dot gnu.org
@ 2011-10-05 21:42 ` janus at gcc dot gnu.org
2011-10-06 21:28 ` janus at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-05 21:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
--- Comment #2 from janus at gcc dot gnu.org 2011-10-05 21:42:33 UTC ---
Here's an attempt to fix it:
Index: module.c
===================================================================
--- module.c (revision 179566)
+++ module.c (working copy)
@@ -3608,6 +3608,8 @@ mio_symbol (gfc_symbol *sym)
mio_symbol_attribute (&sym->attr);
mio_typespec (&sym->ts);
+ if (sym->ts.type == BT_CLASS)
+ sym->attr.class_ok = 1;
if (iomode == IO_OUTPUT)
mio_namespace_ref (&sym->formal_ns);
A similar thing is already being done for components (cf. 'mio_component').
However, with this patch, the test case gives me a different error:
internal compiler error: in gfc_conv_component_ref, at fortran/trans-expr.c:529
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2011-10-05 21:42 ` janus at gcc dot gnu.org
@ 2011-10-06 21:28 ` janus at gcc dot gnu.org
2011-10-06 22:20 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-06 21:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
--- Comment #3 from janus at gcc dot gnu.org 2011-10-06 21:27:50 UTC ---
(In reply to comment #2)
> However, with this patch, the test case gives me a different error:
>
> internal compiler error: in gfc_conv_component_ref, at fortran/trans-expr.c:529
... which is:
gcc_assert (c->backend_decl);
I have no idea why the backend_decl is missing, though.
Otherwise the patch regtests cleanly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2011-10-06 21:28 ` janus at gcc dot gnu.org
@ 2011-10-06 22:20 ` janus at gcc dot gnu.org
2011-10-07 14:41 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-06 22:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
--- Comment #4 from janus at gcc dot gnu.org 2011-10-06 22:19:43 UTC ---
(In reply to comment #2)
> However, with this patch, the test case gives me a different error:
>
> internal compiler error: in gfc_conv_component_ref, at fortran/trans-expr.c:529
This can be fixed with an additional patchlet:
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 179592)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -1179,7 +1179,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
{
gfc_component *c = CLASS_DATA (sym);
if (!c->ts.u.derived->backend_decl)
- gfc_find_derived_vtab (c->ts.u.derived);
+ {
+ gfc_find_derived_vtab (c->ts.u.derived);
+ gfc_get_derived_type (sym->ts.u.derived);
+ }
}
/* All deferred character length procedures need to retain the backend
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2011-10-06 22:20 ` janus at gcc dot gnu.org
@ 2011-10-07 14:41 ` janus at gcc dot gnu.org
2011-10-07 14:43 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-07 14:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
--- Comment #5 from janus at gcc dot gnu.org 2011-10-07 14:40:21 UTC ---
Author: janus
Date: Fri Oct 7 14:40:14 2011
New Revision: 179660
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179660
Log:
2011-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/50625
* class.c (gfc_build_class_symbol): Fix whitespace.
* module.c (mio_symbol): Set 'class_ok' attribute.
* trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has
been built for class symbols.
2011-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/50625
* gfortran.dg/class_46.f03: New.
Added:
trunk/gcc/testsuite/gfortran.dg/class_46.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/class.c
trunk/gcc/fortran/module.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2011-10-07 14:41 ` janus at gcc dot gnu.org
@ 2011-10-07 14:43 ` janus at gcc dot gnu.org
2011-10-07 21:02 ` janus at gcc dot gnu.org
2011-10-07 21:08 ` janus at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-07 14:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
--- Comment #6 from janus at gcc dot gnu.org 2011-10-07 14:42:15 UTC ---
Fixed on trunk with r179660.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2011-10-07 14:43 ` janus at gcc dot gnu.org
@ 2011-10-07 21:02 ` janus at gcc dot gnu.org
2011-10-07 21:08 ` janus at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-07 21:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
--- Comment #7 from janus at gcc dot gnu.org 2011-10-07 21:01:06 UTC ---
Author: janus
Date: Fri Oct 7 21:01:02 2011
New Revision: 179696
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179696
Log:
2011-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/50585
* interface.c (get_expr_storage_size): Check if 'length' component is
associated.
PR fortran/50625
* class.c (gfc_build_class_symbol): Fix whitespace.
* module.c (mio_symbol): Set 'class_ok' attribute.
* trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has
been built for class symbols.
2011-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/50585
* gfortran.dg/assumed_charlen_arg_2.f90: New.
PR fortran/50625
* gfortran.dg/class_46.f03: New.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/assumed_charlen_arg_2.f90
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/class_46.f03
Modified:
branches/gcc-4_6-branch/gcc/fortran/ChangeLog
branches/gcc-4_6-branch/gcc/fortran/class.c
branches/gcc-4_6-branch/gcc/fortran/interface.c
branches/gcc-4_6-branch/gcc/fortran/module.c
branches/gcc-4_6-branch/gcc/fortran/trans-decl.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/50625] [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
` (7 preceding siblings ...)
2011-10-07 21:02 ` janus at gcc dot gnu.org
@ 2011-10-07 21:08 ` janus at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-07 21:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50625
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from janus at gcc dot gnu.org 2011-10-07 21:07:33 UTC ---
Fixed on trunk and 4.6. Closing.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-10-07 21:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-05 19:48 [Bug fortran/50625] New: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables burnus at gcc dot gnu.org
2011-10-05 19:49 ` [Bug fortran/50625] " burnus at gcc dot gnu.org
2011-10-05 20:19 ` janus at gcc dot gnu.org
2011-10-05 21:42 ` janus at gcc dot gnu.org
2011-10-06 21:28 ` janus at gcc dot gnu.org
2011-10-06 22:20 ` janus at gcc dot gnu.org
2011-10-07 14:41 ` janus at gcc dot gnu.org
2011-10-07 14:43 ` janus at gcc dot gnu.org
2011-10-07 21:02 ` janus at gcc dot gnu.org
2011-10-07 21:08 ` janus at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).