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/57033] [4.7/4.8/4.9 Regression] ICE on extended derived type and default initialization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57033

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
Simple fix:

--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2544,7 +2544,8 @@ gfc_convert_to_structure_constructor (gfc_expr *e,
gfc_symbol *sym, gfc_expr **c
       if (parent && !comp)
     break;

-      actual = actual->next;
+      if (actual)
+        actual = actual->next;
     }

   if (!build_actual_constructor (&comp_head, &ctor_head, sym))


I was about to commit it, then I thought there was something wrong;
Is the following code valid?  It is currently rejected with:

comment_0_modif.f90:14.6:

meo = me(1, 2)              ! ICE
      1
Error: No initializer for component 'j' given in the structure constructor at
(1)!



!!!!!!!!!!!!!!!!
program ice

type m
    integer i
    logical :: f = .false.
end type m

type, extends(m) :: me
    integer :: j
end type me

type(me) meo

meo = me(1, 2)              ! ICE
end program ice
!!!!!!!!!!!!!!!!


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