From 36fec693ee87653b512e1a9c044ab928a1c264b1 Mon Sep 17 00:00:00 2001 From: jb Date: Wed, 22 Nov 2017 20:42:39 +0000 Subject: [PATCH] Make shift argument to eoshift0 and eoshift2 be of type index_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test case that requires 4 GB RAM that exercises eoshift0: program main implicit none integer(1) :: line(2_8**31+10) line = 42 line = eoshift(line, 2_8**31+7) print *, line(1:4) print *, line((ubound(line, 1, kind=8)-4):ubound(line, 1, kind=8)) end program main Before patch: ❯ ./a.out 0 0 0 0 42 42 42 42 42 With patch: ❯ ./a.out 42 42 42 0 0 0 0 0 0 Regtested on x86_64-pc-linux-gnu. libgfortran/ChangeLog: 2017-11-22 Janne Blomqvist * intrinsics/eoshift0.c (eoshift0): Make shift an index_type. * intrinsics/eoshift2.c (eoshift2): Make shift an index_type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255077 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 5 +++++ libgfortran/intrinsics/eoshift0.c | 4 +--- libgfortran/intrinsics/eoshift2.c | 4 +--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 6df2843b9fb..7715cb3e8f2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,5 +1,10 @@ 2017-11-22 Janne Blomqvist + * intrinsics/eoshift0.c (eoshift0): Make shift an index_type. + * intrinsics/eoshift2.c (eoshift2): Make shift an index_type. + +2017-11-22 Janne Blomqvist + PR libfortran/83097 * io/inquire.c (inquire_via_unit): Use __BYTE_ORDER__ predefined macro. diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c index 3dae88c3757..dd8c81d6a05 100644 --- a/libgfortran/intrinsics/eoshift0.c +++ b/libgfortran/intrinsics/eoshift0.c @@ -26,12 +26,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include -/* TODO: make this work for large shifts when - sizeof(int) < sizeof (index_type). */ static void eoshift0 (gfc_array_char * ret, const gfc_array_char * array, - int shift, const char * pbound, int which, index_type size, + index_type shift, const char * pbound, int which, index_type size, const char *filler, index_type filler_len) { /* r.* indicates the return array. */ diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c index 5d949dda8bb..ab760f768a5 100644 --- a/libgfortran/intrinsics/eoshift2.c +++ b/libgfortran/intrinsics/eoshift2.c @@ -26,12 +26,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include -/* TODO: make this work for large shifts when - sizeof(int) < sizeof (index_type). */ static void eoshift2 (gfc_array_char *ret, const gfc_array_char *array, - int shift, const gfc_array_char *bound, int which, + index_type shift, const gfc_array_char *bound, int which, const char *filler, index_type filler_len) { /* r.* indicates the return array. */ -- 2.11.4.GIT