]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2013-06-07 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Jun 2013 15:05:47 +0000 (15:05 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Jun 2013 15:05:47 +0000 (15:05 +0000)
        PR fortran/57549
        * array.c (gfc_match_array_constructor): Call
        gfc_match_type_spec instead of gfc_match_decl_type_spec.
        * match.c (gfc_match_type_spec): Renamed from match_type_spec.
        (gfc_match_type_is, gfc_match_allocate): Update call.
        * match.h (gfc_match_type_spec): Add prototype.

2013-06-07  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57549
        * gfortran.dg/array_constructor_48.f90: New.
        * gfortran.dg/array_constructor_type_14.f03: Correct test case.
        * gfortran.dg/array_constructor_type_15.f03: Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199820 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/array.c
gcc/fortran/match.c
gcc/fortran/match.h
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/array_constructor_48.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/array_constructor_type_14.f03
gcc/testsuite/gfortran.dg/array_constructor_type_15.f03

index 6b9093bce19bf1f25a0877f05775b1fb036faaac..9e577d8163ebc116b3341d26fb6b2b46fb115279 100644 (file)
@@ -1,3 +1,12 @@
+2013-06-07  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/57549
+       * array.c (gfc_match_array_constructor): Call
+       gfc_match_type_spec instead of gfc_match_decl_type_spec.
+       * match.c (gfc_match_type_spec): Renamed from match_type_spec.
+       (gfc_match_type_is, gfc_match_allocate): Update call.
+       * match.h (gfc_match_type_spec): Add prototype.
+
 2013-06-07  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/57556
index c2ac1ece1e652010ff9675242784f5d07e898537..c6b8eb9f96a7b6a9693a155e97a11b3966bd3075 100644 (file)
@@ -1073,7 +1073,7 @@ gfc_match_array_constructor (gfc_expr **result)
   /* Try to match an optional "type-spec ::"  */
   gfc_clear_ts (&ts);
   gfc_new_undo_checkpoint (changed_syms);
-  if (gfc_match_decl_type_spec (&ts, 0) == MATCH_YES)
+  if (gfc_match_type_spec (&ts) == MATCH_YES)
     {
       seen_ts = (gfc_match (" ::") == MATCH_YES);
 
index b44d8157717a8fa9fda961888a6e613d47024c31..2533584246b6a599186da4dc74d27df404a92014 100644 (file)
@@ -1937,8 +1937,8 @@ match_derived_type_spec (gfc_typespec *ts)
    the implicit_flag is not needed, so it was removed. Derived types are
    identified by their name alone.  */
 
-static match
-match_type_spec (gfc_typespec *ts)
+match
+gfc_match_type_spec (gfc_typespec *ts)
 {
   match m;
   locus old_locus;
@@ -3426,7 +3426,7 @@ gfc_match_allocate (void)
 
   /* Match an optional type-spec.  */
   old_locus = gfc_current_locus;
-  m = match_type_spec (&ts);
+  m = gfc_match_type_spec (&ts);
   if (m == MATCH_ERROR)
     goto cleanup;
   else if (m == MATCH_NO)
@@ -5502,7 +5502,7 @@ gfc_match_type_is (void)
   c = gfc_get_case ();
   c->where = gfc_current_locus;
 
-  if (match_type_spec (&c->ts) == MATCH_ERROR)
+  if (gfc_match_type_spec (&c->ts) == MATCH_ERROR)
     goto cleanup;
 
   if (gfc_match_char (')') != MATCH_YES)
index ac8b9f84696078a0cdb8c0f30a001ad3d0f0638c..1a701f04f39ead3f39678d6ca40a58682f2df6d2 100644 (file)
@@ -59,6 +59,8 @@ match gfc_match_char (char);
 match gfc_match (const char *, ...);
 match gfc_match_iterator (gfc_iterator *, int);
 match gfc_match_parens (void);
+match gfc_match_type_spec (gfc_typespec *);
+
 
 /* Statement matchers.  */
 match gfc_match_program (void);
index 9c2ff38c11158e06b0342d2234f7c9c86d6f161b..5838061f20e3a49f60a38d1cd0f8e50cef58f94a 100644 (file)
@@ -1,3 +1,10 @@
+2013-06-07  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/57549
+       * gfortran.dg/array_constructor_48.f90: New.
+       * gfortran.dg/array_constructor_type_14.f03: Correct test case.
+       * gfortran.dg/array_constructor_type_15.f03: Ditto.
+
 2013-06-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/56315
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_48.f90 b/gcc/testsuite/gfortran.dg/array_constructor_48.f90
new file mode 100644 (file)
index 0000000..5916edd
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR fortran/57549
+!
+! Contributed by Vladimir Fuka
+!
+ type t
+ end type
+ type(t),allocatable :: a(:)
+ a = [t::t()]
+ print *, [ integer :: ]
+end
+
+subroutine invalid()
+    print *, [ type(integer) :: ] ! { dg-error "Syntax error in array constructor" }
+    print *, [ type(tt) :: ]      ! { dg-error "Syntax error in array constructor" }
+end subroutine invalid
index 04ac728010a203cfd2b4fd72a0ec611b50ec445c..0e24334dcfc8640eb752b5bb67ca02109fdc6be3 100644 (file)
@@ -16,7 +16,7 @@ PROGRAM test
 
   TYPE(foo), DIMENSION(2) :: arr
 
-  arr = (/ TYPE(foo) :: x, foo(0, 1.) /)
+  arr = (/ foo :: x, foo(0, 1.) /)
   IF (arr(1)%i /= 42 .OR. arr(1)%x /= 42. .OR. &
       arr(2)%i /= 0 .OR. arr(2)%x /= 1.) THEN
     CALL abort()
index 20736988b5aee4d905608887d7a030aabbc8282b..a94655562e95cdcf730fa6557fd5bc050446952b 100644 (file)
@@ -18,5 +18,5 @@ PROGRAM test
 
   TYPE(foo), PARAMETER :: x = foo(42, 42.)
 
-  WRITE (*,*) (/ TYPE(foo) :: x, foo(0, 1.), bar(.TRUE.) /) ! { dg-error "convert TYPE" }
+  WRITE (*,*) (/ foo :: x, foo(0, 1.), bar(.TRUE.) /) ! { dg-error "convert TYPE" }
 END PROGRAM test