[patch, fortran] Add random numbers and fix some bugs.
Andre Vehreschild
vehre@gmx.de
Thu Sep 19 10:16:38 GMT 2024
Hi Thomas,
submitting your patch as part of the mail got it corrupted by some mailer
adding line breaks. It does not apply for me. Because I can't test it, I have
more questions, see below:
On Wed, 18 Sep 2024 22:22:15 +0200
Thomas Koenig <tkoenig@netcologne.de> wrote:
> 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.
>
> Again, depends on prevous submissions.
>
> OK for trunk?
>
> gcc/fortran/ChangeLog:
>
> * check.cc (gfc_check_random_number): Adjust for unsigned.
> * iresolve.cc (gfc_resolve_random_number): Handle unsinged.
Hihi, I do this typo, too, over and over again: s/unsinged/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.
>
<snip>
> diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
> index 533c9d7d343..1851cfb8d4a 100644
> --- a/gcc/fortran/check.cc
> +++ b/gcc/fortran/check.cc
> @@ -7007,8 +7007,14 @@ gfc_check_random_init (gfc_expr *repeatable,
> gfc_expr *image_distinct)
> bool
> gfc_check_random_number (gfc_expr *harvest)
> {
> - if (!type_check (harvest, 0, BT_REAL))
> - return false;
> + if (flag_unsigned)
> + {
> + if (!type_check2 (harvest, 0, BT_REAL, BT_UNSIGNED))
> + return false;
When the second argument is a BT_INTEGER, does this fail here?
> + }
> + else
> + if (!type_check (harvest, 0, BT_REAL))
> + return false;
>
> if (!variable_check (harvest, 0, false))
> return false;
<snip>
Regards,
Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de
More information about the Fortran
mailing list