summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-24 21:28:20 +0000
committerdfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-24 21:28:20 +0000
commit2b119350d78db29e82a4778dcffcf84f5f83602e (patch)
tree91dc2fff88d64eaf4657f688aaf3b0508c559322
parent98bdcbcf6d7802db17dc8919112b21e2d323b418 (diff)
downloadgcc-2b119350d78db29e82a4778dcffcf84f5f83602e.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131810 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/data.c2
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gfortran.dg/empty_type.f9019
4 files changed, 33 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2998e73f894..c9cdfde362e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
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.
(contributors): Added major contributors of 2008 that were
not listed yet.
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 59ac5e9d8e6..41dc85f8fa0 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 70f1e0d5c1d..8af0ba245b4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..cea25660dce
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/empty_type.f90
@@ -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
+