https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60357

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The patch in comment 2 needs to be update to

--- ../_clean/gcc/fortran/primary.c    2014-12-16 22:27:14.000000000 +0100
+++ gcc/fortran/primary.c    2014-12-21 14:50:53.000000000 +0100
@@ -2367,6 +2367,13 @@ build_actual_constructor (gfc_structure_
         return false;
           value = gfc_copy_expr (comp->initializer);
         }
+      else if (comp->attr.allocatable)
+        {
+          if (!gfc_notify_std (GFC_STD_F2008, "No initializer for "
+          "allocatable component '%s' given in the structure "
+          "constructor at %C", comp->name))
+        return false;
+        }
       else if (!comp->attr.deferred_parameter)
         {
           gfc_error ("No initializer for component %qs given in the"

Note that while

    program testerprog
    use testmod
    Type(A) :: Me
    allocate(Me%y)
    Me = A(X=1, y=2)
    print *, Me%y

    end program

gives

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

    program testerprog
    use testmod
    Type(A) :: Me
    Me = A(X=1, y=2)
    print *, Me%x, Me%y

    end program

gives

           1           2

i.e., 'allocate(Me%y)' conflicts with Me = A(X=1, y=2). May be this expected.

Reply via email to