diff options
author | Harald Anlauf <anlauf@gmx.de> | 2020-09-03 20:33:14 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2020-09-03 20:33:14 +0200 |
commit | 8eeeecbcc17041fdfd3ccc928161ae86e7f9b456 (patch) | |
tree | 03d0de302626130b582dc2597059889d8b87d245 /libgfortran | |
parent | 753b4679bc46f6806cf45d9afc3783c6d3b63589 (diff) | |
download | gcc-8eeeecbcc17041fdfd3ccc928161ae86e7f9b456.tar.gz |
PR fortran/96890 - Wrong answer with intrinsic IALL
The IALL intrinsic would always return 0 when the DIM and MASK arguments
were present since the initial value of repeated BIT-AND operations was
set to 0 instead of -1.
libgfortran/ChangeLog:
* m4/iall.m4: Initial value for result should be -1.
* generated/iall_i1.c (miall_i1): Generated.
* generated/iall_i16.c (miall_i16): Likewise.
* generated/iall_i2.c (miall_i2): Likewise.
* generated/iall_i4.c (miall_i4): Likewise.
* generated/iall_i8.c (miall_i8): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/iall_masked.f90: New test.
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/generated/iall_i1.c | 2 | ||||
-rw-r--r-- | libgfortran/generated/iall_i16.c | 2 | ||||
-rw-r--r-- | libgfortran/generated/iall_i2.c | 2 | ||||
-rw-r--r-- | libgfortran/generated/iall_i4.c | 2 | ||||
-rw-r--r-- | libgfortran/generated/iall_i8.c | 2 | ||||
-rw-r--r-- | libgfortran/m4/iall.m4 | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/libgfortran/generated/iall_i1.c b/libgfortran/generated/iall_i1.c index 3fe0a1698ad..086a5464aad 100644 --- a/libgfortran/generated/iall_i1.c +++ b/libgfortran/generated/iall_i1.c @@ -345,7 +345,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray, msrc = mbase; { - result = 0; + result = (GFC_INTEGER_1) -1; for (n = 0; n < len; n++, src += delta, msrc += mdelta) { diff --git a/libgfortran/generated/iall_i16.c b/libgfortran/generated/iall_i16.c index 35d9872c0e9..c491414ca7c 100644 --- a/libgfortran/generated/iall_i16.c +++ b/libgfortran/generated/iall_i16.c @@ -345,7 +345,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray, msrc = mbase; { - result = 0; + result = (GFC_INTEGER_16) -1; for (n = 0; n < len; n++, src += delta, msrc += mdelta) { diff --git a/libgfortran/generated/iall_i2.c b/libgfortran/generated/iall_i2.c index ef90119341f..d43e5df1809 100644 --- a/libgfortran/generated/iall_i2.c +++ b/libgfortran/generated/iall_i2.c @@ -345,7 +345,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray, msrc = mbase; { - result = 0; + result = (GFC_INTEGER_2) -1; for (n = 0; n < len; n++, src += delta, msrc += mdelta) { diff --git a/libgfortran/generated/iall_i4.c b/libgfortran/generated/iall_i4.c index 27140abeaa8..039e7963798 100644 --- a/libgfortran/generated/iall_i4.c +++ b/libgfortran/generated/iall_i4.c @@ -345,7 +345,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray, msrc = mbase; { - result = 0; + result = (GFC_INTEGER_4) -1; for (n = 0; n < len; n++, src += delta, msrc += mdelta) { diff --git a/libgfortran/generated/iall_i8.c b/libgfortran/generated/iall_i8.c index 6047169c62e..d01f7aecaf8 100644 --- a/libgfortran/generated/iall_i8.c +++ b/libgfortran/generated/iall_i8.c @@ -345,7 +345,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray, msrc = mbase; { - result = 0; + result = (GFC_INTEGER_8) -1; for (n = 0; n < len; n++, src += delta, msrc += mdelta) { diff --git a/libgfortran/m4/iall.m4 b/libgfortran/m4/iall.m4 index df57367c100..8f3b7741486 100644 --- a/libgfortran/m4/iall.m4 +++ b/libgfortran/m4/iall.m4 @@ -35,7 +35,7 @@ ARRAY_FUNCTION(0, ` result &= *src;') MASKED_ARRAY_FUNCTION(0, -` result = 0;', +` result = ('rtype_name`) -1;', ` if (*msrc) result &= *src;') |