diff options
author | Janus Weil <janus@gcc.gnu.org> | 2010-05-22 12:21:32 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2010-05-22 12:21:32 +0200 |
commit | 7c9b8fb912cdbac53aab302ab0e6b1b0831036df (patch) | |
tree | 16d810c6e5b483bfbb839527ee681b103d9622fc /gcc | |
parent | 277e2873445daf04f771eacf8636ba15671dfeda (diff) | |
download | gcc-7c9b8fb912cdbac53aab302ab0e6b1b0831036df.zip gcc-7c9b8fb912cdbac53aab302ab0e6b1b0831036df.tar.gz gcc-7c9b8fb912cdbac53aab302ab0e6b1b0831036df.tar.bz2 |
re PR fortran/44213 (ICE when extending abstract type)
2010-05-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/44213
* resolve.c (ensure_not_abstract): Allow abstract types with
non-abstract ancestors.
2010-05-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/44213
* gfortran.dg/abstract_type_7.f03: New.
From-SVN: r159695
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/abstract_type_7.f03 | 18 |
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fc99619..9e4702e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2010-05-22 Janus Weil <janus@gcc.gnu.org> + + PR fortran/44213 + * resolve.c (ensure_not_abstract): Allow abstract types with + non-abstract ancestors. + 2010-05-21 Steven Bosscher <steven@gcc.gnu.org> * trans-const.c: Include realmpfr.h. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e5a46fa..f08e198 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -10541,7 +10541,10 @@ ensure_not_abstract (gfc_symbol* sub, gfc_symbol* ancestor) This is not the most efficient way to do this, but it should be ok and is clearer than something sophisticated. */ - gcc_assert (ancestor && ancestor->attr.abstract && !sub->attr.abstract); + gcc_assert (ancestor && !sub->attr.abstract); + + if (!ancestor->attr.abstract) + return SUCCESS; /* Walk bindings of this ancestor. */ if (ancestor->f2k_derived) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 227a77c..faea1c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-05-22 Janus Weil <janus@gcc.gnu.org> + + PR fortran/44213 + * gfortran.dg/abstract_type_7.f03: New. + 2010-05-21 Jason Merrill <jason@redhat.com> * g++.dg/eh/spec11.C: Test cleanup optimization. diff --git a/gcc/testsuite/gfortran.dg/abstract_type_7.f03 b/gcc/testsuite/gfortran.dg/abstract_type_7.f03 new file mode 100644 index 0000000..3ea0fdc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/abstract_type_7.f03 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! PR 44213: ICE when extending abstract type +! +! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de> + +module ice_module + type :: a_type + end type a_type + + type,extends(a_type),abstract :: b_type + end type b_type + + type,extends(b_type) :: c_type + end type c_type +end module ice_module + +! { dg-final { cleanup-modules "ice_module" } } |