aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/m4/eoshift3.m4
diff options
context:
space:
mode:
authorThomas Koenig <Thomas.Koenig@online.de>2005-07-07 22:01:41 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2005-07-07 22:01:41 +0000
commit47b3a403a5b5424d15829d47abd4cb1a8a87e93e (patch)
tree6e619479081b13e187d8cae04afbb290a97762a8 /libgfortran/m4/eoshift3.m4
parent5a29b385acaae4c85403081e38ce0876ae423524 (diff)
downloadgcc-47b3a403a5b5424d15829d47abd4cb1a8a87e93e.zip
gcc-47b3a403a5b5424d15829d47abd4cb1a8a87e93e.tar.gz
gcc-47b3a403a5b5424d15829d47abd4cb1a8a87e93e.tar.bz2
re PR fortran/21594 ([4.0 only] FAIL: gfortran.dg/eoshift.f90 -O0 execution test)
2005-07-07 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/21594 * intrinsics/eoshift0.c: If abs(shift) > len, fill the the whole array with the boundary value, but don't overrun it. * intrinsics/eoshift2.c: Likewise. * m4/eoshift1.m4: Likewise. * m4/eoshift3.m4: Likewise. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2005-07-07 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/21594 * gfortran.fortran-torture/execute/intrinsic_eoshift.f90: Add test cases where the shift length is greater than the array length. From-SVN: r101738
Diffstat (limited to 'libgfortran/m4/eoshift3.m4')
-rw-r--r--libgfortran/m4/eoshift3.m49
1 files changed, 8 insertions, 1 deletions
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index 24b21cd..1e04113 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -168,7 +168,14 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array,
{
` /* Do the shift for this dimension. */'
sh = *hptr;
- delta = (sh >= 0) ? sh: -sh;
+ if (( sh >= 0 ? sh : -sh ) > len)
+ {
+ delta = len;
+ sh = len;
+ }
+ else
+ delta = (sh >= 0) ? sh: -sh;
+
if (sh > 0)
{
src = &sptr[delta * soffset];