diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-09-24 22:57:42 +0200 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-09-24 22:57:42 +0200 |
commit | 291e20e86090e5940e2bd862ec83c7d5e0715dd5 (patch) | |
tree | 0b970817fd91a79f75b59b6befede665a69b910e /gcc/fortran/iresolve.cc | |
parent | fbeb1a965d85492e2f6f3adf913b90d005151b00 (diff) | |
download | gcc-291e20e86090e5940e2bd862ec83c7d5e0715dd5.zip gcc-291e20e86090e5940e2bd862ec83c7d5e0715dd5.tar.gz gcc-291e20e86090e5940e2bd862ec83c7d5e0715dd5.tar.bz2 |
Add random numbers and fix some bugs.
This patch adds random number support for UNSIGNED, plus fixes
two bugs, with array I/O where the type used to be set to BT_INTEGER,
and for division with the divisor being a constant.
gcc/fortran/ChangeLog:
* check.cc (gfc_check_random_number): Adjust for unsigned.
* iresolve.cc (gfc_resolve_random_number): Handle unsigned.
* trans-expr.cc (gfc_conv_expr_op): Handle BT_UNSIGNED for divide.
* trans-types.cc (gfc_get_dtype_rank_type): Handle BT_UNSIGNED.
* gfortran.texi: Add RANDOM_NUMBER for UNSIGNED.
libgfortran/ChangeLog:
* gfortran.map: Add _gfortran_random_m1, _gfortran_random_m2,
_gfortran_random_m4, _gfortran_random_m8 and _gfortran_random_m16.
* intrinsics/random.c (random_m1): New function.
(random_m2): New function.
(random_m4): New function.
(random_m8): New function.
(random_m16): New function.
(arandom_m1): New function.
(arandom_m2): New function.
(arandom_m4): New function.
(arandom_m8): New funciton.
(arandom_m16): New function.
gcc/testsuite/ChangeLog:
* gfortran.dg/unsigned_30.f90: New test.
Diffstat (limited to 'gcc/fortran/iresolve.cc')
-rw-r--r-- | gcc/fortran/iresolve.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fortran/iresolve.cc b/gcc/fortran/iresolve.cc index b281ab7..5a1e0a6 100644 --- a/gcc/fortran/iresolve.cc +++ b/gcc/fortran/iresolve.cc @@ -3452,12 +3452,14 @@ gfc_resolve_random_number (gfc_code *c) { const char *name; int kind; + char type; kind = gfc_type_abi_kind (&c->ext.actual->expr->ts); + type = gfc_type_letter (c->ext.actual->expr->ts.type); if (c->ext.actual->expr->rank == 0) - name = gfc_get_string (PREFIX ("random_r%d"), kind); + name = gfc_get_string (PREFIX ("random_%c%d"), type, kind); else - name = gfc_get_string (PREFIX ("arandom_r%d"), kind); + name = gfc_get_string (PREFIX ("arandom_%c%d"), type, kind); c->resolved_sym = gfc_get_intrinsic_sub_symbol (name); } |