This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49562] [4.6/4.7 Regression] [OOP] ICE at invalid code: assigning value to function of polymorphic object
- 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: Tue, 28 Jun 2011 11:05:27 +0000
- Subject: [Bug fortran/49562] [4.6/4.7 Regression] [OOP] ICE at invalid code: assigning value to function of polymorphic object
- Auto-submitted: auto-generated
- References: <bug-49562-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49562
--- Comment #2 from janus at gcc dot gnu.org 2011-06-28 11:05:08 UTC ---
The fix is pretty trivial:
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 175562)
+++ gcc/fortran/expr.c (working copy)
@@ -4395,7 +4395,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointe
}
if (!pointer && e->expr_type == EXPR_FUNCTION
- && sym->result->attr.pointer)
+ && sym->result && sym->result->attr.pointer)
{
if (!(gfc_option.allow_std & GFC_STD_F2008))
{
With this one gets:
a%ice_func()=1 ! This is the invalid line
1
Error: Non-variable expression in variable definition context (assignment) at
(1)