string_intrinsics.c (string_verify): Fix off by one error.
* intrinsics/string_intrinsics.c (string_verify): Fix off by one error. testsuite/ * gfortran.dg/intrinsic_verify_1.f90: New test. From-SVN: r88704
This commit is contained in:
parent
94b9aa66d8
commit
82e7998648
@ -1,3 +1,7 @@
|
|||||||
|
2004-10-07 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
|
* gfortran.dg/intrinsic_verify_1.f90: New test.
|
||||||
|
|
||||||
2004-10-07 Paul Brook <paul@codesourcery.com>
|
2004-10-07 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
* gfortran.dg/empty_format_1.f90: Remove stray commas.
|
* gfortran.dg/empty_format_1.f90: Remove stray commas.
|
||||||
|
12
gcc/testsuite/gfortran.dg/intrinsic_verify_1.f90
Normal file
12
gcc/testsuite/gfortran.dg/intrinsic_verify_1.f90
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
! { dg-do run }
|
||||||
|
! Test the verify intrinsic. We were ignoring the last character.
|
||||||
|
program prog
|
||||||
|
character(len=1) :: c1
|
||||||
|
character(len=4) :: c4
|
||||||
|
c1 = "E"
|
||||||
|
if (verify(c1, "1") .ne. 1) call abort
|
||||||
|
c4 = "ABBA"
|
||||||
|
if (verify(c4, "A") .ne. 2) call abort
|
||||||
|
if (verify(c4, "A", back = .true.) .ne. 3) call abort
|
||||||
|
if (verify(c4, "AB") .ne. 0) call abort
|
||||||
|
end program
|
@ -1,3 +1,8 @@
|
|||||||
|
2004-10-07 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
|
* intrinsics/string_intrinsics.c (string_verify): Fix off by one
|
||||||
|
error.
|
||||||
|
|
||||||
2004-10-06 Paul Brook <paul@codesourcery.com>
|
2004-10-06 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
PR libfortran/17709
|
PR libfortran/17709
|
||||||
|
@ -346,17 +346,16 @@ string_verify (GFC_INTEGER_4 slen, const char * str, GFC_INTEGER_4 setlen,
|
|||||||
|
|
||||||
if (back)
|
if (back)
|
||||||
{
|
{
|
||||||
last = 0;
|
last = -1;
|
||||||
start = slen - 1;
|
start = slen - 1;
|
||||||
delta = -1;
|
delta = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
last = slen - 1;
|
last = slen;
|
||||||
start = 0;
|
start = 0;
|
||||||
delta = 1;
|
delta = 1;
|
||||||
}
|
}
|
||||||
i = 0;
|
|
||||||
for (; start != last; start += delta)
|
for (; start != last; start += delta)
|
||||||
{
|
{
|
||||||
for (i = 0; i < setlen; i++)
|
for (i = 0; i < setlen; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user