2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69398
* decl.c (attr_decl): Check for duplicate DIMENSION attribute for a
CLASS entity.
2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69398
* gfortran.dg/pr69398.f90: New test.
From-SVN: r272481
+2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/69398
+ * decl.c (attr_decl): Check for duplicate DIMENSION attribute for a
+ CLASS entity.
+
2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/87907
to the first component, or '_data' field. */
if (sym->ts.type == BT_CLASS && sym->ts.u.derived->attr.is_class)
{
+ /* gfc_set_array_spec sets sym->attr not CLASS_DATA(sym)->attr. Check
+ for duplicate attribute here. */
+ if (CLASS_DATA(sym)->attr.dimension == 1 && as)
+ {
+ gfc_error ("Duplicate DIMENSION attribute at %C");
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
+
if (!gfc_copy_attr (&CLASS_DATA(sym)->attr, ¤t_attr, &var_locus))
{
m = MATCH_ERROR;
+2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/69398
+ * gfortran.dg/pr69398.f90: New test.
+
2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/87907
--- /dev/null
+! { dg-do compile }
+! PR fortran/69398
+! Contributed by Gerhard Steinmetz
+program p
+ type t
+ end type
+ class(t), allocatable :: z(:)
+ target :: z(:) ! { dg-error "Duplicate DIMENSION attribute" }
+ allocate (z(2))
+end
+