aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2024-09-28 22:28:59 +0200
committerThomas Koenig <tkoenig@gcc.gnu.org>2024-09-28 22:28:59 +0200
commit1c928004cf0bc2131b6199905d11133d23a7cef2 (patch)
treeb1b3d4a93b2fbeba34923bc7625f7ae587957510 /gcc/fortran
parent2531f014fb2364777fb1ce09641db85bda5883b7 (diff)
downloadgcc-1c928004cf0bc2131b6199905d11133d23a7cef2.zip
gcc-1c928004cf0bc2131b6199905d11133d23a7cef2.tar.gz
gcc-1c928004cf0bc2131b6199905d11133d23a7cef2.tar.bz2
Implement CSHIFT and EOSHIFT for unsigned.
gcc/fortran/ChangeLog: * check.cc (gfc_check_eoshift): Handle BT_UNSIGNED. * simplify.cc (gfc_simplify_eoshift): Likewise. * gfortran.texi: Document CSHIFT and EOSHIFT for UNSIGNED. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_31.f90: New test. * gfortran.dg/unsigned_32.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/check.cc6
-rw-r--r--gcc/fortran/gfortran.texi3
-rw-r--r--gcc/fortran/simplify.cc4
3 files changed, 12 insertions, 1 deletions
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 1851cfb..1da269f 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -3073,6 +3073,12 @@ gfc_check_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary,
case BT_CHARACTER:
break;
+ case BT_UNSIGNED:
+ if (flag_unsigned)
+ break;
+
+ gcc_fallthrough();
+
default:
gfc_error ("Missing %qs argument to %qs intrinsic at %L for %qs "
"of type %qs", gfc_current_intrinsic_arg[2]->name,
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index a5ebadff..b42d009 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -2790,7 +2790,8 @@ As of now, the following intrinsics take unsigned arguments:
@item @code{TRANSFER}
@item @code{SUM}, @code{PRODUCT}, @code{MATMUL} and @code{DOT_PRODUCT}
@item @code{IANY}, @code{IALL} and @code{IPARITY}
-@item @code{RANDOM_NUMBER}.
+@item @code{RANDOM_NUMBER}
+@item @code{CSHIFT} and @code{EOSHIFT}.
@end itemize
This list will grow in the near future.
@c ---------------------------------------------------------------------
diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index bd2f648..2f6c3c3 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -2630,6 +2630,10 @@ gfc_simplify_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary,
bnd = gfc_get_int_expr (array->ts.kind, NULL, 0);
break;
+ case BT_UNSIGNED:
+ bnd = gfc_get_unsigned_expr (array->ts.kind, NULL, 0);
+ break;
+
case BT_LOGICAL:
bnd = gfc_get_logical_expr (array->ts.kind, NULL, 0);
break;