Regression tested on x86_64-*-freebsd.  OK to commit?

2016-09-08  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/77506
        * array.c (gfc_match_array_constructor): CHARACTER(len=*) cannot
        appear in an array constructor.

2016-09-08  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/77506
        * gfortran.dg/pr77506.f90: New test.

Index: gcc/fortran/array.c
===================================================================
--- gcc/fortran/array.c (revision 240039)
+++ gcc/fortran/array.c (working copy)
@@ -1142,6 +1142,15 @@ gfc_match_array_constructor (gfc_expr **
              gfc_restore_last_undo_checkpoint ();
              goto cleanup;
            }
+
+         if (ts.type == BT_CHARACTER
+             && ts.u.cl && !ts.u.cl->length && !ts.u.cl->length_from_typespec)
+           {
+             gfc_error ("Type-spec at %L cannot contain an asterisk for a "
+                        "type parameter", &where);
+             gfc_restore_last_undo_checkpoint ();
+             goto cleanup;
+           }
        }
     }
   else if (m == MATCH_ERROR)
Index: gcc/testsuite/gfortran.dg/pr77506.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77506.f90       (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77506.f90       (working copy)
@@ -0,0 +1,4 @@
+! { dg-do compile }
+program foo
+   print *, [character(len=*)::'ab','cd'] ! { dg-error "contain an asterisk" }
+end program foo

-- 
Steve

Reply via email to