Without an explicit program statement : $ cat z1.f90 !program p real*9 :: c write (c, '(i3)') 1 end $ gfortran -g -O0 -Wall -fcheck=all z1.f90 f951: internal compiler error: gfc_validate_kind(): Got bad kind --- Detected with program statement : $ cat z2.f90 program p real*9 :: c write (c, '(i3)') 1 end $ gfortran -g -O0 -Wall -fcheck=all z2.f90 z2.f90:2:9: real*9 :: c 1 Error: Old-style type declaration REAL*9 not supported at (1) z2.f90:3:10: write (c, '(i3)') 1 1 Error: UNIT specification at (1) must be an INTEGER expression or a CHARACTER variable
Simplified. Still different behaviour : $ cat z3.f90 !program p integer*3 c print *, c end $ gfortran -g -O0 -Wall -fcheck=all z3.f90 z3.f90:2:0: integer*3 c 1 internal compiler error: Segmentation fault
I could not generate an ICE with z1.f90. Instead, I the following error: % gfc6 -c g1.f90 g1.f90:3:7: c = 1 1 Error: Can't convert INTEGER(4) to INTEGER(3) at (1) with gcc 4.9.x, 5.2.x, and 6. gfortran should reject the *3. I have a patch that does now does % gfc6 -c g1.f90 g1.f90:2:12: integer*3 c 1 Error: Old-style type declaration INTEGER*3 not supported at (1)
Patch posted at https://gcc.gnu.org/ml/fortran/2015-10/msg00112.html As I don't see an ICE, Gerhard can you test this?
Author: kargl Date: Sat Oct 24 17:09:35 2015 New Revision: 229288 URL: https://gcc.gnu.org/viewcvs?rev=229288&root=gcc&view=rev Log: 2015-10-24 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/68055 * decl.c (gfc_match_decl_type_spec): Check for valid kind in old-style declarations. 2015-10-24 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/68055 * gfortran.dg/pr68055.f90: New case. Added: trunk/gcc/testsuite/gfortran.dg/pr68055.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/testsuite/ChangeLog
Sorry for answering late, but most of the time I am "offline" from several streams. Up to now I'm using mostly precompiled/configured packages from SUSE, currently gcc version 5.2.1 (+r228597). For several reasons, I'm avoiding self-compiled versions, including gcc/gfortran. Hence my efforts are limited to black box tests and validations. But of course I will test more on this issue with newly available packages from software.opensuse.org as soon as possible. Thank you very much for the continuing development and great support.
Author: kargl Date: Thu Oct 29 20:44:09 2015 New Revision: 229560 URL: https://gcc.gnu.org/viewcvs?rev=229560&root=gcc&view=rev Log: 2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/68055 * decl.c (gfc_match_decl_type_spec): Check for valid kind in old-style declarations. 2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/68055 * gfortran.dg/pr68055.f90: New case. Added: branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr68055.f90 Modified: branches/gcc-5-branch/gcc/fortran/ChangeLog branches/gcc-5-branch/gcc/fortran/decl.c branches/gcc-5-branch/gcc/testsuite/ChangeLog
Fixed on trunk and 5-branch. Thanks for the bug report.