* [PATCH] Make shift argument to eoshift0 be of type index_type
@ 2017-11-22 11:34 Janne Blomqvist
2017-11-22 18:03 ` Thomas Koenig
0 siblings, 1 reply; 6+ messages in thread
From: Janne Blomqvist @ 2017-11-22 11:34 UTC (permalink / raw)
To: fortran, gcc-patches; +Cc: Janne Blomqvist
Regtested on x86_64-pc-linux-gnu, Ok for trunk?
libgfortran/ChangeLog:
2017-11-22 Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/eoshift0.c (eoshift0): Make shift an index_type.
---
libgfortran/intrinsics/eoshift0.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index 3dae88c..dd8c81d 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 <string.h>
-/* 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. */
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Make shift argument to eoshift0 be of type index_type
2017-11-22 11:34 [PATCH] Make shift argument to eoshift0 be of type index_type Janne Blomqvist
@ 2017-11-22 18:03 ` Thomas Koenig
2017-11-22 20:03 ` [PATCH] Make shift argument to eoshift0 and eoshift2 " Janne Blomqvist
2017-11-22 20:06 ` [PATCH] Make shift argument to eoshift0 " Janne Blomqvist
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Koenig @ 2017-11-22 18:03 UTC (permalink / raw)
To: Janne Blomqvist, fortran, gcc-patches
Hi Janne,
> Regtested on x86_64-pc-linux-gnu, Ok for trunk?
>
> libgfortran/ChangeLog:
>
> 2017-11-22 Janne Blomqvist<jb@gcc.gnu.org>
>
> * intrinsics/eoshift0.c (eoshift0): Make shift an index_type.
Looks good in principle. Is it possible to come up with a test case?
This might not be executable on all systems, but it is still worth
trying to run at least once.
Regards
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Make shift argument to eoshift0 and eoshift2 be of type index_type
2017-11-22 18:03 ` Thomas Koenig
@ 2017-11-22 20:03 ` Janne Blomqvist
2017-11-22 20:06 ` [PATCH] Make shift argument to eoshift0 " Janne Blomqvist
1 sibling, 0 replies; 6+ messages in thread
From: Janne Blomqvist @ 2017-11-22 20:03 UTC (permalink / raw)
To: fortran, gcc-patches; +Cc: Janne Blomqvist
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 <jb@gcc.gnu.org>
* intrinsics/eoshift0.c (eoshift0): Make shift an index_type.
* intrinsics/eoshift2.c (eoshift2): Make shift an index_type.
---
libgfortran/intrinsics/eoshift0.c | 4 +---
libgfortran/intrinsics/eoshift2.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index 3dae88c..dd8c81d 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 <string.h>
-/* 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 5d949dd..ab760f7 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 <string.h>
-/* 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.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Make shift argument to eoshift0 be of type index_type
2017-11-22 18:03 ` Thomas Koenig
2017-11-22 20:03 ` [PATCH] Make shift argument to eoshift0 and eoshift2 " Janne Blomqvist
@ 2017-11-22 20:06 ` Janne Blomqvist
2017-11-22 20:25 ` Thomas Koenig
1 sibling, 1 reply; 6+ messages in thread
From: Janne Blomqvist @ 2017-11-22 20:06 UTC (permalink / raw)
To: Thomas Koenig; +Cc: Fortran List, GCC Patches
On Wed, Nov 22, 2017 at 8:03 PM, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hi Janne,
>
>> Regtested on x86_64-pc-linux-gnu, Ok for trunk?
>>
>> libgfortran/ChangeLog:
>>
>> 2017-11-22 Janne Blomqvist<jb@gcc.gnu.org>
>>
>> * intrinsics/eoshift0.c (eoshift0): Make shift an index_type.
>
>
> Looks good in principle. Is it possible to come up with a test case?
> This might not be executable on all systems, but it is still worth
> trying to run at least once.
I just mailed out an updated patch with a testcase in the commit msg.
I also noticed that eoshift2 suffers from the same issue, so I added a
fix for that to the patch as well (though the testcase only exercises
eoshift0).
Is that better? Ok for trunk?
--
Janne Blomqvist
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Make shift argument to eoshift0 be of type index_type
2017-11-22 20:06 ` [PATCH] Make shift argument to eoshift0 " Janne Blomqvist
@ 2017-11-22 20:25 ` Thomas Koenig
2017-11-22 20:43 ` Janne Blomqvist
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Koenig @ 2017-11-22 20:25 UTC (permalink / raw)
To: Janne Blomqvist; +Cc: Fortran List, GCC Patches
Am 22.11.2017 um 21:06 schrieb Janne Blomqvist:
> Is that better? Ok for trunk?
Yes, OK.
Thanks a lot for the patch!
Regards
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Make shift argument to eoshift0 be of type index_type
2017-11-22 20:25 ` Thomas Koenig
@ 2017-11-22 20:43 ` Janne Blomqvist
0 siblings, 0 replies; 6+ messages in thread
From: Janne Blomqvist @ 2017-11-22 20:43 UTC (permalink / raw)
To: Thomas Koenig; +Cc: Fortran List, GCC Patches
On Wed, Nov 22, 2017 at 10:25 PM, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Am 22.11.2017 um 21:06 schrieb Janne Blomqvist:
>>
>> Is that better? Ok for trunk?
>
>
> Yes, OK.
>
> Thanks a lot for the patch!
Thanks, committed as r255077!
--
Janne Blomqvist
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-22 20:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 11:34 [PATCH] Make shift argument to eoshift0 be of type index_type Janne Blomqvist
2017-11-22 18:03 ` Thomas Koenig
2017-11-22 20:03 ` [PATCH] Make shift argument to eoshift0 and eoshift2 " Janne Blomqvist
2017-11-22 20:06 ` [PATCH] Make shift argument to eoshift0 " Janne Blomqvist
2017-11-22 20:25 ` Thomas Koenig
2017-11-22 20:43 ` Janne Blomqvist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).