OSDN Git Service

fortran/
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 8 Feb 2014 20:51:01 +0000 (20:51 +0000)
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 8 Feb 2014 20:51:01 +0000 (20:51 +0000)
       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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@207635 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 98e1e7f..46bb56c 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-08  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/57033
+       * primary.c (gfc_convert_to_structure_constructor): Avoid null pointer
+       dereference.
+
 2014-02-08  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/59906
index d1d96ff..09ac513 100644 (file)
@@ -2525,7 +2525,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) == FAILURE)
index c9c7b8f..9700477 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-08  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/57033
+       * gfortran.dg/default_initialization_7.f90: New test.
+
 2014-02-08  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