This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR47040 - Make error message for empty array constructor more helpful/correct
- From: Dominique d'HumiÃres <dominiq at lps dot ens dot fr>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: fortran at gcc dot gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 6 Apr 2016 17:44:55 +0200
- Subject: [PATCH] PR47040 - Make error message for empty array constructor more helpful/correct
- Authentication-results: sourceware.org; auth=none
Is the following patch OK (regtested on x86_64-apple-darwin15)? Should it be back ported to the gcc-5 branch?
TIA
Dominique
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (revision 234788)
+++ gcc/fortran/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2016-04-06 Tobias Burnus <burnus@net-b.de>
+ Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ PR fortran/47040
+ * array.c (gfc_match_array_constructor): add "without type-spec"
+ to the error message.
+
2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/67538
Index: gcc/fortran/array.c
===================================================================
--- gcc/fortran/array.c (revision 234788)
+++ gcc/fortran/array.c (working copy)
@@ -1136,7 +1136,8 @@
goto done;
else
{
- gfc_error ("Empty array constructor at %C is not allowed");
+ gfc_error ("Empty array constructor without type-spec at %C "
+ "is not allowed");
goto cleanup;
}
}
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 234788)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2016-04-06 Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ * gfortran.dg/empty_constructor.f90: New test.
+
2016-04-06 Eric Botcazou <ebotcazou@adacore.com>
* gcc.c-torture/execute/20101011-1.c (__VISIUM__): Set DO_TEST to 0.
Index: gcc/testsuite/gfortran.dg/empty_constructor.f90
===================================================================
--- gcc/testsuite/gfortran.dg/empty_constructor.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/empty_constructor.f90 (working copy)
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! PR 47040
+! Contributed by Tobias Burnus <burnus@net-b.de>
+!
+program test_print
+ implicit none
+ integer :: i
+ call print( [ ] ) ! { dg-error "Empty array constructor without type-spec" }
+ call print( [integer :: ] )
+ call print( pack( [ 1 ], [ 2 ] == 3 ) )
+ call print( [ ( i, i = 1, 0 ) ] )
+contains
+ subroutine print( array )
+ integer, dimension(:) :: array
+ write(*,*) size(array)
+ end subroutine print
+end program test_print