IMPLICIT CHARACTER*# causing 35 regressions in NIST testsuite
Paul Brook
paul@codesourcery.com
Sat Jul 3 23:25:00 GMT 2004
On Saturday 03 July 2004 20:56, Steve Kargl wrote:
> Gang,
>
> I don't think we can get away with the following Error.
>
> gfortran -c FM517.f
> In file FM517.f:28
>
> IMPLICIT CHARACTER*27 (C)
> 1
> Error: Old-style kind 27 not supported for type CHARACTER at (1)
> *** Error code 1 (continuing)
Indeed not, it's legal (but deprecated) code.
The attached patch fixes it by matching character selectors at the same time
as numeric kind selectors.
It also fixes a bug when the kind selector looked like a name range. We were
still setting implicit type of the discarded range.
Tested in i686-linux, Applied to mainline.
I've also added a testcase with these and a few other examples I found along
the way.
Paul
2004-07-03 Paul Brook <paul@codesourcery.com>
* decl.c (gfc_match_implicit_range): Don't use typespec.
(gfc_match_implicit): Handle character selectors.
* gfortran.h (gfc_set_implicit): Remove prototype.
(gfc_add_new_implicit_range, gfc_merge_new_implicit): Update.
* parse.c (accept_statement): Don't call gfc_set_implicit.
* symbol.c (new_ts): Remove.
(gfc_set_implicit_none): Use same loop bounds as other functions.
(gfc_set_implicit): Remove.
(gfc_clear_new_implicit, gfc_add_new_implicit_range): Only set flags.
(gfc_merge_new_implicit): Combine with gfc_set_implicit.
testsuite/
* gfortran.fortran-torture/compile/implicit_1.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.implicit
Type: text/x-diff
Size: 8464 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040703/97d4ba3c/attachment.bin>
-------------- next part --------------
! Test implicit character declarations.
! This requires some coordination between the typespec and variable name range
! matchers to get it right.
module implicit_1
integer, parameter :: x = 10
integer, parameter :: y = 6
integer, parameter :: z = selected_int_kind(4)
end module
subroutine foo(n)
use implicit_1
! Test various combinations with and without character length
! and type kind specifiers
implicit character(len=5) (a)
implicit character(n) (b)
implicit character*6 (c-d)
implicit character (e)
implicit character(x-y) (f)
implicit integer(z) (g)
implicit character (z)
a1 = 'Hello'
b1 = 'world'
c1 = 'wibble'
d1 = 'hmmm'
e1 = 'n'
f1 = 'test'
g1 = 1
x1 = 1.0
y1 = 2.0
z1 = 'A'
end
More information about the Fortran
mailing list