This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/49562] [4.6/4.7 Regression] [OOP] ICE at invalid code: assigning value to function of polymorphic object


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]