]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/57033 (ICE on extended derived type and default initialization)
authorMikael Morin <mikael@gcc.gnu.org>
Sun, 2 Feb 2014 11:50:28 +0000 (11:50 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Sun, 2 Feb 2014 11:50:28 +0000 (11:50 +0000)
fortran/
        PR fortran/57033
        * primary.c (gfc_convert_to_structure_constructor): Avoid null pointer
        dereference.

testsuite/
        PR fortran/57033
        * gfortran.dg/default_initialization_7.f90: New test.

From-SVN: r207396

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/default_initialization_7.f90 [new file with mode: 0644]

index 5e3a48a65d79f2784474716b9b87b72b1e5daa01..102d5f2f6cd4ca6cefed7e080fd365b67ffb5bff 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-02  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/57033
+       * primary.c (gfc_convert_to_structure_constructor): Avoid null pointer
+       dereference.
+
 2014-02-01  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/59906
index c77b4ecf7dd7f9522e0ad1b133bede8d968f4391..7d7fbadf2f06ab79febe64a5770370843835e0f6 100644 (file)
@@ -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))
index 8af85b50c0e3e77c9f048ca9bbb2a8957e31a5dd..b64dfac10452118721b5e3b3ec8a7bff9172486f 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-26  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/57033
+       * gfortran.dg/default_initialization_7.f90: New test.
+
 2014-02-01  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/59906
diff --git a/gcc/testsuite/gfortran.dg/default_initialization_7.f90 b/gcc/testsuite/gfortran.dg/default_initialization_7.f90
new file mode 100644 (file)
index 0000000..fc8be98
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+!
+! PR fortran/57033
+! ICE on a structure constructor of an extended derived type whose parent
+! type last component has a default initializer
+!
+! Contributed by Tilo Schwarz <tilo@tilo-schwarz.de>
+
+program ice
+
+type m
+    integer i
+    logical :: f = .false.
+end type m
+
+type, extends(m) :: me
+end type me
+
+type(me) meo
+
+meo = me(1)              ! ICE
+end program ice