summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-12 21:34:11 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-12 21:34:11 +0000
commit29dae2bfa6f8c42ad60fee1d23d6dc3659d53d00 (patch)
tree1f3c46a16af849afee31b6d349f3b132ad36634f
parenta4a58ea82107ef65ed6a8660e7af0448d282289c (diff)
downloadgcc-29dae2bfa6f8c42ad60fee1d23d6dc3659d53d00.tar.gz
2011-02-12 Janus Weil <janus@gcc.gnu.org>
* class.c (gfc_build_class_symbol): Reject polymorphic arrays. * decl.c (build_sym,build_struct,attr_decl1): Use return value of 'gfc_build_class_symbol'. 2011-02-12 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/allocate_derived_1.f90: Modified as polymorphic arrays are temporarily disabled. * gfortran.dg/class_7.f03: Ditto. * gfortran.dg/coarray_14.f90: Ditto. * gfortran.dg/typebound_proc_13.f03: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170092 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/class.c6
-rw-r--r--gcc/fortran/decl.c13
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_derived_1.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/class_7.f033
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_14.f902
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_13.f039
8 files changed, 50 insertions, 24 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7749cade37a..e3b545f904d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-12 Janus Weil <janus@gcc.gnu.org>
+
+ * class.c (gfc_build_class_symbol): Reject polymorphic arrays.
+ * decl.c (build_sym,build_struct,attr_decl1): Use return value of
+ 'gfc_build_class_symbol'.
+
2011-02-12 Michael Matz <matz@suse.de>
Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 2227f9e72f3..7c8babef7e3 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -184,6 +184,12 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
gfc_symbol *vtab;
gfc_component *c;
+ if (*as)
+ {
+ gfc_error ("Polymorphic array at %C not yet supported");
+ return FAILURE;
+ }
+
/* Determine the name of the encapsulating type. */
get_unique_hashed_string (tname, ts->u.derived);
if ((*as) && (*as)->rank && attr->allocatable)
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 638a7386d15..9712ea2aa09 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1180,7 +1180,7 @@ build_sym (const char *name, gfc_charlen *cl, bool cl_deferred,
if (sym->ts.type == BT_CLASS
&& (sym->attr.class_ok = sym->attr.dummy || sym->attr.pointer
|| sym->attr.allocatable))
- gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false);
+ return gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false);
return SUCCESS;
}
@@ -1639,10 +1639,9 @@ scalar:
bool delayed = (gfc_state_stack->sym == c->ts.u.derived)
|| (!c->ts.u.derived->components
&& !c->ts.u.derived->attr.zero_comp);
- gfc_build_class_symbol (&c->ts, &c->attr, &c->as, delayed);
+ return gfc_build_class_symbol (&c->ts, &c->attr, &c->as, delayed);
}
-
return t;
}
@@ -6048,8 +6047,12 @@ attr_decl1 (void)
if (sym->ts.type == BT_CLASS && !sym->attr.class_ok
&& (sym->attr.class_ok = sym->attr.class_ok || current_attr.allocatable
- || current_attr.pointer))
- gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false);
+ || current_attr.pointer)
+ && gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false) == FAILURE)
+ {
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
if (gfc_set_array_spec (sym, as, &var_locus) == FAILURE)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d6bd220d103..db4c7acf564 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2011-02-12 Janus Weil <janus@gcc.gnu.org>
+
+ * gfortran.dg/allocate_derived_1.f90: Modified as polymorphic arrays
+ are temporarily disabled.
+ * gfortran.dg/class_7.f03: Ditto.
+ * gfortran.dg/coarray_14.f90: Ditto.
+ * gfortran.dg/typebound_proc_13.f03: Ditto.
+
2011-02-12 Mikael Morin <mikael.morin@sfr.fr>
PR fortran/45586
diff --git a/gcc/testsuite/gfortran.dg/allocate_derived_1.f90 b/gcc/testsuite/gfortran.dg/allocate_derived_1.f90
index d2c65ffa38b..648012431ac 100644
--- a/gcc/testsuite/gfortran.dg/allocate_derived_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_derived_1.f90
@@ -24,27 +24,28 @@
real :: r
end type
- class(t1),dimension(:),allocatable :: x
+! FIXME: uncomment and dejagnuify the lines below once class arrays are enabled
+! class(t1),dimension(:),allocatable :: x
type(t2),dimension(:),allocatable :: y
- class(t3),dimension(:),allocatable :: z
+! class(t3),dimension(:),allocatable :: z
- allocate( x(1))
- allocate(t1 :: x(2))
- allocate(t2 :: x(3))
- allocate(t3 :: x(4))
- allocate(tx :: x(5)) ! { dg-error "Error in type-spec at" }
- allocate(u0 :: x(6)) ! { dg-error "may not be ABSTRACT" }
- allocate(v1 :: x(7)) ! { dg-error "is type incompatible with typespec" }
+! allocate( x(1))
+! allocate(t1 :: x(2))
+! allocate(t2 :: x(3))
+! allocate(t3 :: x(4))
+! allocate(tx :: x(5)) ! { "Error in type-spec at" }
+! allocate(u0 :: x(6)) ! { "may not be ABSTRACT" }
+! allocate(v1 :: x(7)) ! { "is type incompatible with typespec" }
allocate( y(1))
allocate(t1 :: y(2)) ! { dg-error "is type incompatible with typespec" }
allocate(t2 :: y(3))
allocate(t3 :: y(3)) ! { dg-error "is type incompatible with typespec" }
- allocate( z(1))
- allocate(t1 :: z(2)) ! { dg-error "is type incompatible with typespec" }
- allocate(t2 :: z(3)) ! { dg-error "is type incompatible with typespec" }
- allocate(t3 :: z(4))
+! allocate( z(1))
+! allocate(t1 :: z(2)) ! { "is type incompatible with typespec" }
+! allocate(t2 :: z(3)) ! { "is type incompatible with typespec" }
+! allocate(t3 :: z(4))
end
diff --git a/gcc/testsuite/gfortran.dg/class_7.f03 b/gcc/testsuite/gfortran.dg/class_7.f03
index 99fbf6fc69b..d7f1c835ef4 100644
--- a/gcc/testsuite/gfortran.dg/class_7.f03
+++ b/gcc/testsuite/gfortran.dg/class_7.f03
@@ -9,7 +9,8 @@
end type t0
type t
integer :: i
- class(t0), allocatable :: foo(3) ! { dg-error "deferred shape" }
+! FIXME: uncomment and dejagnuify once class arrays are enabled
+! class(t0), allocatable :: foo(3) ! { "deferred shape" }
end type t
! PR41608: Would ICE on missing type decl
diff --git a/gcc/testsuite/gfortran.dg/coarray_14.f90 b/gcc/testsuite/gfortran.dg/coarray_14.f90
index 9230ad4f32b..3e3f0462b30 100644
--- a/gcc/testsuite/gfortran.dg/coarray_14.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_14.f90
@@ -47,7 +47,7 @@ end subroutine test
program myTest
type t
end type t
-class(t), allocatable :: a[:]
+type(t), allocatable :: a[:]
allocate (t :: a) ! { dg-error "Coarray specification required in ALLOCATE statement" }
allocate (t :: a[*]) ! { dg-error "allocatable scalar coarrays are not yet supported" }
end program myTest
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_13.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_13.f03
index 3f978f28b45..62054b6fa3f 100644
--- a/gcc/testsuite/gfortran.dg/typebound_proc_13.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_13.f03
@@ -16,7 +16,8 @@ MODULE m
TYPE t2
CONTAINS
- PROCEDURE, PASS :: nonscalar ! { dg-error "must be scalar" }
+! FIXME: uncomment and dejagnuify once class arrays are enabled
+! PROCEDURE, PASS :: nonscalar ! { "must be scalar" }
PROCEDURE, PASS :: is_pointer ! { dg-error "must not be POINTER" }
PROCEDURE, PASS :: is_allocatable ! { dg-error "must not be ALLOCATABLE" }
END TYPE t2
@@ -26,9 +27,9 @@ CONTAINS
SUBROUTINE myproc ()
END SUBROUTINE myproc
- SUBROUTINE nonscalar (me)
- CLASS(t2), INTENT(IN) :: me(:)
- END SUBROUTINE nonscalar
+! SUBROUTINE nonscalar (me)
+! CLASS(t2), INTENT(IN) :: me(:)
+! END SUBROUTINE nonscalar
SUBROUTINE is_pointer (me)
CLASS(t2), POINTER, INTENT(IN) :: me