From 4b1566319b3955251557f90d37ead3332f516b75 Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Sat, 12 Jul 2008 13:26:50 +0200 Subject: [PATCH] [multiple changes] 2008-07-12 Daniel Kraft * resolve.c (resolve_fl_derived): Allow pointer components to empty derived types fixing a missing part of PR fortran/33221. 2008-06-22 Daniel Kraft * gfortran.dg/used_types_21.f90: New test. From-SVN: r137737 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/resolve.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/used_types_21.f90 | 11 +++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/used_types_21.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d8c31145d98..d79a72e73ec 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-07-12 Daniel Kraft + + * resolve.c (resolve_fl_derived): Allow pointer components to empty + derived types fixing a missing part of PR fortran/33221. + 2008-07-10 Daniel Kraft * gfc-internals.texi (section gfc_expr): Created documentation about diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index c0ec7847747..273f2ae746b 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7657,7 +7657,8 @@ resolve_fl_derived (gfc_symbol *sym) } if (c->ts.type == BT_DERIVED && c->pointer - && c->ts.derived->components == NULL) + && c->ts.derived->components == NULL + && !c->ts.derived->attr.zero_comp) { gfc_error ("The pointer component '%s' of '%s' at %L is a type " "that has not been declared", c->name, sym->name, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c246c5f6aec..0b1bc977718 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-06-22 Daniel Kraft + + * gfortran.dg/used_types_21.f90: New test. + 2008-07-11 Ian Lance Taylor * gcc.dg/Wcxx-compat-2.c: New test. diff --git a/gcc/testsuite/gfortran.dg/used_types_21.f90 b/gcc/testsuite/gfortran.dg/used_types_21.f90 new file mode 100644 index 00000000000..04b109f139a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/used_types_21.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Check that pointer components are allowed to empty types. + +TYPE :: empty_t +END TYPE empty_t + +TYPE :: comp_t + TYPE(empty_t), POINTER :: ptr +END TYPE comp_t + +END -- 2.30.2