re PR fortran/29452 (Keyword check for specifiers in WRITE and READ)

fortran/
2006-10-30  Tobias Burnus  <burnus@net-b.de>

       	PR fortran/29452
       	* io.c (check_io_constraints): Fix keyword string comparison.

libgfortran/
2006-10-30  Tobias Burnus  <burnus@net-b.de>

       	PR fortran/29452
	* runtime/string.c (compare0): Check whether string lengths match.

testsuite/
2006-10-30  Tobias Burnus  <burnus@net-b.de>

	PR fortran/29452
	* gfortran.dg/write_check.f90: Check run-time keyword checking.
	* gfortran.dg/write_check2.f90: Check compile-time keyword checking

From-SVN: r118191
This commit is contained in:
Tobias Burnus 2006-10-30 19:22:47 +01:00 committed by Tobias Burnus
parent e1efef1ef1
commit 9aceacac92
7 changed files with 46 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2006-10-30 Tobias Burnus <burnus@net-b.de>
PR fortran/29452
* io.c (check_io_constraints): Fix keyword string comparison.
2006-10-30 Andrew Pinski <pinskia@gmail.com>
PR fortran/29410
@ -149,7 +154,7 @@
* io.c (gfc_match_close): Ensure that status is terminated by
a NULL element.
2006-10-16 Tobias Burnus <burnus@net-b.de>
2006-10-16 Tobias Burnus <burnus@net-b.de>
* trans-stmt.c: Fix a typo
* invoke.texi: Fix typos

View file

@ -2701,8 +2701,8 @@ if (condition) \
if (expr->expr_type == EXPR_CONSTANT && expr->ts.type == BT_CHARACTER)
{
const char * advance = expr->value.character.string;
not_no = strncasecmp (advance, "no", 2) != 0;
not_yes = strncasecmp (advance, "yes", 2) != 0;
not_no = strcasecmp (advance, "no") != 0;
not_yes = strcasecmp (advance, "yes") != 0;
}
else
{

View file

@ -1,3 +1,9 @@
2006-10-30 Tobias Burnus <burnus@net-b.de>
PR fortran/29452
* gfortran.dg/write_check.f90: Check run-time keyword checking.
* gfortran.dg/write_check2.f90: Check compile-time keyword checking.
2006-10-30 Andrew Pinski <pinskia@gmail.com>
PR Fortran/29410

View file

@ -0,0 +1,16 @@
! { dg-do run }
! { dg-shouldfail "Compile-time specifier checking" }
! Check keyword checking for specifiers
! PR fortran/29452
program test
implicit none
character(len=5) :: str
str = 'yes'
write(*,'(a)',advance=str) ''
str = 'no'
write(*,'(a)',advance=str) ''
str = 'NOT'
write(*,'(a)',advance=str) ''
end program test
! { dg-output "At line 13 of file.*" }
! { dg-output "Bad ADVANCE parameter in data transfer statement" }

View file

@ -0,0 +1,10 @@
! { dg-do compile }
! Check keyword checking for specifiers
! PR fortran/29452
character(len=20) :: str
write(13,'(a)',advance='yes') 'Hello:'
write(13,'(a)',advance='no') 'Hello:'
write(13,'(a)',advance='y') 'Hello:' ! { dg-error "ADVANCE=specifier at \\(1\\) must have value = YES or NO." }
write(13,'(a)',advance='yet') 'Hello:' ! { dg-error "ADVANCE=specifier at \\(1\\) must have value = YES or NO." }
write(13,'(a)',advance='yess') 'Hello:' ! { dg-error "ADVANCE=specifier at \\(1\\) must have value = YES or NO." }
end

View file

@ -1,3 +1,8 @@
2006-10-30 Tobias Burnus <burnus@net-b.de>
PR fortran/29452
* runtime/string.c (compare0): Check whether string lengths match.
2006-10-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* configure: Regenerate.

View file

@ -44,6 +44,7 @@ compare0 (const char *s1, int s1_len, const char *s2)
/* Strip trailing blanks from the Fortran string. */
len = fstrlen (s1, s1_len);
if(len != strlen(s2)) return 0; /* don't match */
return strncasecmp (s1, s2, len) == 0;
}