OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a5558ca
)
2005-07-07 Thomas Koenig <Thomas.Koenig@online.de>
author
tkoenig
<tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Jul 2005 22:01:41 +0000
(22:01 +0000)
committer
tkoenig
<tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Jul 2005 22:01:41 +0000
(22:01 +0000)
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101738
138bc75d
-0d04-0410-961f-
82ee72b054a4
gcc/testsuite/ChangeLog
patch
|
blob
|
history
gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90
patch
|
blob
|
history
libgfortran/ChangeLog
patch
|
blob
|
history
libgfortran/generated/eoshift1_4.c
patch
|
blob
|
history
libgfortran/generated/eoshift1_8.c
patch
|
blob
|
history
libgfortran/generated/eoshift3_4.c
patch
|
blob
|
history
libgfortran/generated/eoshift3_8.c
patch
|
blob
|
history
libgfortran/intrinsics/eoshift0.c
patch
|
blob
|
history
libgfortran/intrinsics/eoshift2.c
patch
|
blob
|
history
libgfortran/m4/eoshift1.m4
patch
|
blob
|
history
libgfortran/m4/eoshift3.m4
patch
|
blob
|
history
diff --git
a/gcc/testsuite/ChangeLog
b/gcc/testsuite/ChangeLog
index
29ed4af
..
1804874
100644
(file)
--- a/
gcc/testsuite/ChangeLog
+++ b/
gcc/testsuite/ChangeLog
@@
-1,3
+1,10
@@
+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.
+
2005-07-07 Ziemowit Laski <zlaski@apple.com>
* obj-c++.dg/gnu-runtime-2.mm: Compile, do not run.
2005-07-07 Ziemowit Laski <zlaski@apple.com>
* obj-c++.dg/gnu-runtime-2.mm: Compile, do not run.
diff --git
a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90
b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90
index
872422d
..
c4bbcdd
100644
(file)
--- a/
gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90
+++ b/
gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90
@@
-11,10
+11,18
@@
program intrinsic_eoshift
call abort
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
call abort
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
+ a = eoshift (a, 9999, 99, 1)
+ if (any (a .ne. 99)) call abort
+
+ a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
a = eoshift (a, -2, dim = 2)
if (any (a .ne. reshape ((/0, 0, 0, 0, 0, 0, 1, 2, 3/), (/3, 3/)))) &
call abort
a = eoshift (a, -2, dim = 2)
if (any (a .ne. reshape ((/0, 0, 0, 0, 0, 0, 1, 2, 3/), (/3, 3/)))) &
call abort
+ a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
+ a = eoshift (a, -9999, 99, 1)
+ if (any (a .ne. 99)) call abort
+
! Array shift and scalar bound.
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
a = eoshift (a, (/1, 0, -1/), 99, 1)
! Array shift and scalar bound.
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
a = eoshift (a, (/1, 0, -1/), 99, 1)
@@
-22,6
+30,11
@@
program intrinsic_eoshift
call abort
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
call abort
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
+ a = eoshift (a, (/9999, 0, -9999/), 99, 1)
+ if (any (a .ne. reshape ((/99, 99, 99, 4, 5, 6, 99, 99, 99/), (/3, 3/)))) &
+ call abort
+
+ a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
a = eoshift (a, (/2, -2, 0/), dim = 2)
if (any (a .ne. reshape ((/7, 0, 3, 0, 0, 6, 0, 2, 9/), (/3, 3/)))) &
call abort
a = eoshift (a, (/2, -2, 0/), dim = 2)
if (any (a .ne. reshape ((/7, 0, 3, 0, 0, 6, 0, 2, 9/), (/3, 3/)))) &
call abort
@@
-33,6
+46,16
@@
program intrinsic_eoshift
call abort
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
call abort
a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
+ a = eoshift (a, 9999, (/99, -1, 42/), 1)
+ if (any (a .ne. reshape ((/99, 99, 99, -1, -1, -1, 42, 42, 42/), &
+ (/3, 3/)))) call abort
+
+ a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
+ a = eoshift (a, -9999, (/99, -1, 42/), 1)
+ if (any (a .ne. reshape ((/99, 99, 99, -1, -1, -1, 42, 42, 42/), &
+ (/3, 3/)))) call abort
+
+ a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
a = eoshift (a, -2, (/99, -1, 42/), 2)
if (any (a .ne. reshape ((/99, -1, 42, 99, -1, 42, 1, 2, 3/), (/3, 3/)))) &
call abort
a = eoshift (a, -2, (/99, -1, 42/), 2)
if (any (a .ne. reshape ((/99, -1, 42, 99, -1, 42, 1, 2, 3/), (/3, 3/)))) &
call abort
@@
-61,6
+84,11
@@
program intrinsic_eoshift
if (any (a .ne. reshape ((/ -999, -999, -999, -99, 4, 5, -9, -9, -9 /), &
shape(a)))) call abort
if (any (a .ne. reshape ((/ -999, -999, -999, -99, 4, 5, -9, -9, -9 /), &
shape(a)))) call abort
+ a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
+ a = eoshift (a, (/9999, -9999, 0/), (/99, -1, 42/), 2)
+ if (any (a .ne. reshape ((/99, -1, 3, 99, -1, 6, 99, -1, 9/), (/3, 3/)))) &
+ call abort
+
! Test arrays > rank 2
b(:, :, 1) = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
b(:, :, 2) = 10 + reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
! Test arrays > rank 2
b(:, :, 1) = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
b(:, :, 2) = 10 + reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
diff --git
a/libgfortran/ChangeLog
b/libgfortran/ChangeLog
index
242bd3c
..
b125679
100644
(file)
--- a/
libgfortran/ChangeLog
+++ b/
libgfortran/ChangeLog
@@
-1,3
+1,16
@@
+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 Feng Wang <fengwang@nudt.edu.cn>
PR fortran/16531
2005-07-07 Feng Wang <fengwang@nudt.edu.cn>
PR fortran/16531
diff --git
a/libgfortran/generated/eoshift1_4.c
b/libgfortran/generated/eoshift1_4.c
index
cb4dfb5
..
6012c3f
100644
(file)
--- a/
libgfortran/generated/eoshift1_4.c
+++ b/
libgfortran/generated/eoshift1_4.c
@@
-158,7
+158,14
@@
eoshift1_4 (gfc_array_char *ret,
{
/* Do the shift for this dimension. */
sh = *hptr;
{
/* 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];
if (sh > 0)
{
src = &sptr[delta * soffset];
diff --git
a/libgfortran/generated/eoshift1_8.c
b/libgfortran/generated/eoshift1_8.c
index
379cb4a
..
3caf66a
100644
(file)
--- a/
libgfortran/generated/eoshift1_8.c
+++ b/
libgfortran/generated/eoshift1_8.c
@@
-158,7
+158,14
@@
eoshift1_8 (gfc_array_char *ret,
{
/* Do the shift for this dimension. */
sh = *hptr;
{
/* 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];
if (sh > 0)
{
src = &sptr[delta * soffset];
diff --git
a/libgfortran/generated/eoshift3_4.c
b/libgfortran/generated/eoshift3_4.c
index
4ce66a3
..
1fe4e76
100644
(file)
--- a/
libgfortran/generated/eoshift3_4.c
+++ b/
libgfortran/generated/eoshift3_4.c
@@
-167,7
+167,14
@@
eoshift3_4 (gfc_array_char *ret, gfc_array_char *array,
{
/* Do the shift for this dimension. */
sh = *hptr;
{
/* 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];
if (sh > 0)
{
src = &sptr[delta * soffset];
diff --git
a/libgfortran/generated/eoshift3_8.c
b/libgfortran/generated/eoshift3_8.c
index
7e9b911
..
69ead62
100644
(file)
--- a/
libgfortran/generated/eoshift3_8.c
+++ b/
libgfortran/generated/eoshift3_8.c
@@
-167,7
+167,14
@@
eoshift3_8 (gfc_array_char *ret, gfc_array_char *array,
{
/* Do the shift for this dimension. */
sh = *hptr;
{
/* 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];
if (sh > 0)
{
src = &sptr[delta * soffset];
diff --git
a/libgfortran/intrinsics/eoshift0.c
b/libgfortran/intrinsics/eoshift0.c
index
b1fbd1a
..
6152e9f
100644
(file)
--- a/
libgfortran/intrinsics/eoshift0.c
+++ b/
libgfortran/intrinsics/eoshift0.c
@@
-131,10
+131,19
@@
eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
sstride0 = sstride[0];
rptr = ret->data;
sptr = array->data;
sstride0 = sstride[0];
rptr = ret->data;
sptr = array->data;
- if (shift > 0)
- len = len - shift;
+
+ if ((shift >= 0 ? shift : -shift) > len)
+ {
+ shift = len;
+ len = 0;
+ }
else
else
- len = len + shift;
+ {
+ if (shift > 0)
+ len = len - shift;
+ else
+ len = len + shift;
+ }
while (rptr)
{
while (rptr)
{
diff --git
a/libgfortran/intrinsics/eoshift2.c
b/libgfortran/intrinsics/eoshift2.c
index
70baf3c
..
4e2b41b
100644
(file)
--- a/
libgfortran/intrinsics/eoshift2.c
+++ b/
libgfortran/intrinsics/eoshift2.c
@@
-139,16
+139,25
@@
eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
bstride0 = bstride[0];
rptr = ret->data;
sptr = array->data;
bstride0 = bstride[0];
rptr = ret->data;
sptr = array->data;
+
+ if ((shift >= 0 ? shift : -shift ) > len)
+ {
+ shift = len;
+ len = 0;
+ }
+ else
+ {
+ if (shift > 0)
+ len = len - shift;
+ else
+ len = len + shift;
+ }
+
if (bound)
bptr = bound->data;
else
bptr = zeros;
if (bound)
bptr = bound->data;
else
bptr = zeros;
- if (shift > 0)
- len = len - shift;
- else
- len = len + shift;
-
while (rptr)
{
/* Do the shift for this dimension. */
while (rptr)
{
/* Do the shift for this dimension. */
diff --git
a/libgfortran/m4/eoshift1.m4
b/libgfortran/m4/eoshift1.m4
index
906687a
..
a650f95
100644
(file)
--- a/
libgfortran/m4/eoshift1.m4
+++ b/
libgfortran/m4/eoshift1.m4
@@
-159,7
+159,14
@@
eoshift1_`'atype_kind (gfc_array_char *ret,
{
` /* Do the shift for this dimension. */'
sh = *hptr;
{
` /* 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];
if (sh > 0)
{
src = &sptr[delta * soffset];
diff --git
a/libgfortran/m4/eoshift3.m4
b/libgfortran/m4/eoshift3.m4
index
24b21cd
..
1e04113
100644
(file)
--- 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;
{
` /* 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];
if (sh > 0)
{
src = &sptr[delta * soffset];