Re: [PATCH] PR fortran/68055 -- Check for valid kind in old-style declaration

2015-10-24 Thread Paul Richard Thomas
Dear Steve,

This is also OK to commit.

Thanks

Paul

On 24 October 2015 at 01:52, Steve Kargl
 wrote:
> The attached patch has been built and tested on x86_64-*-freebsd.
> It implements a check for validate kinds in type declarations
> of the form REAL*42.
>
> OK to commit?
>
> 2015-10-23  Steven G. Kargl  
>
> PR fortran/68055
> * decl.c (gfc_match_decl_type_spec): Check for valid kind in old-style
> declarations.
>
> 2015-10-23  Steven G. Kargl  
>
> PR fortran/68055
> * gfortran.dg/pr68055.f90: New case.
> --
> Steve



-- 
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx


[PATCH] PR fortran/68055 -- Check for valid kind in old-style declaration

2015-10-23 Thread Steve Kargl
The attached patch has been built and tested on x86_64-*-freebsd.
It implements a check for validate kinds in type declarations
of the form REAL*42.

OK to commit?

2015-10-23  Steven G. Kargl  

PR fortran/68055
* decl.c (gfc_match_decl_type_spec): Check for valid kind in old-style
declarations.

2015-10-23  Steven G. Kargl  

PR fortran/68055
* gfortran.dg/pr68055.f90: New case.
-- 
Steve
Index: gcc/fortran/decl.c
===
--- gcc/fortran/decl.c	(revision 229265)
+++ gcc/fortran/decl.c	(working copy) 
@@ -2998,7 +3021,11 @@ get_kind:
 
   m = gfc_match_kind_spec (ts, false);
   if (m == MATCH_NO && ts->type != BT_CHARACTER)
-m = gfc_match_old_kind_spec (ts);
+{
+  m = gfc_match_old_kind_spec (ts);
+  if (gfc_validate_kind (ts->type, ts->kind, true) == -1)
+ return MATCH_ERROR;
+}
 
   if (matched_type && gfc_match_char (')') != MATCH_YES)
 return MATCH_ERROR;
Index: gcc/testsuite/gfortran.dg/pr68055.f90
===
--- gcc/testsuite/gfortran.dg/pr68055.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr68055.f90	(working copy)
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! PR fortran/68055
+! Original code contributed by Gerhard Steinmetz
+! gerhard dot steinmetz dot fortran at t-online dot de
+! 
+   integer*3 c! { dg-error "not supported at" }
+   real*9 x   ! { dg-error "not supported at" }
+   logical*11 a   ! { dg-error "not supported at" }
+   complex*42 z   ! { dg-error "not supported at" }
+   c = 1
+   x = 1
+   call foo(a)
+end