]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/34202 (ICE (segfault) for invalid code in formalize_init_expr (data...
authorDaniel Franke <dfranke@gcc.gnu.org>
Thu, 24 Jan 2008 21:28:20 +0000 (16:28 -0500)
committerDaniel Franke <dfranke@gcc.gnu.org>
Thu, 24 Jan 2008 21:28:20 +0000 (16:28 -0500)
gcc/fortran:
2008-01-24  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/34202
* data.c (formalize_structure_cons): Skip formalization on
empty structures.

gcc/testsuite:
2008-01-24  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/34202
        * gfortran.dg/empty_type.f90: New test.

From-SVN: r131810

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

index 2998e73f8947d5b3c5d97b81ea241af8376c1f90..c9cdfde362e313d7cf33ca8f7782a6634a7aab79 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-24  Daniel Franke  <franke.daniel@gmail.com>
+
+       PR fortran/34202
+       * data.c (formalize_structure_cons): Skip formalization on
+       empty structures.
+
 2008-01-24  Daniel Franke  <franke.daniel@gmail.com>
 
        * gfortran.texi (OpenMP): Extended existing documentation.
index 59ac5e9d8e6fa8cfcf3fa2b8650e4f05fabc0713..41dc85f8fa06d9d25424a26e39a6246a0252f12b 100644 (file)
@@ -688,7 +688,7 @@ formalize_structure_cons (gfc_expr *expr)
   c = expr->value.constructor;
 
   /* Constructor is already formalized.  */
-  if (c->n.component == NULL)
+  if (!c || c->n.component == NULL)
     return;
 
   head = tail = NULL;
index 70f1e0d5c1d9b88ebb5eaa78646f46158fb9fa10..8af0ba245b44feb921305aa6528d9338cf5e1eff 100644 (file)
@@ -1,7 +1,12 @@
+2008-01-24  Daniel Franke  <franke.daniel@gmail.com>
+
+       PR fortran/34202
+       * gfortran.dg/empty_type.f90: New test.
+
 2008-01-24  Paolo Carlini  <pcarlini@suse.de>
 
-        PR c++/34603
-        * g++.dg/template/crash77.C: New.
+       PR c++/34603
+       * g++.dg/template/crash77.C: New.
 
 2008-01-24  Uros Bizjak  <ubizjak@gmail.com>
 
diff --git a/gcc/testsuite/gfortran.dg/empty_type.f90 b/gcc/testsuite/gfortran.dg/empty_type.f90
new file mode 100644 (file)
index 0000000..cea2566
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! PR fortran/34202
+! ICE on contruction of empty types
+! Testcase contributed by Tobias Burnus
+
+program bug4a
+  implicit none
+  type bug4
+    ! Intentionally left empty
+  end type bug4
+
+  type compound
+    type(bug4) b
+  end type compound
+
+  type(bug4), parameter :: f = bug4()
+  type(compound), parameter :: g = compound(bug4())
+end program bug4a
+