This is the mail archive of the
`gcc-patches@gcc.gnu.org`
mailing list for the GCC project.

# Re: [Fortran] Patch ping

*From*: Janne Blomqvist <blomqvist dot janne at gmail dot com>
*To*: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>
*Cc*: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
*Date*: Wed, 18 Apr 2012 12:06:27 +0300
*Subject*: Re: [Fortran] Patch ping
*References*: <20120416080355.GA14053@physik.fu-berlin.de>

On Mon, Apr 16, 2012 at 11:03, Tobias Burnus
<tobias.burnus@physik.fu-berlin.de> wrote:
> Other patches with pending review:
> - [Patch, libfortran] Combine get_mem and internal_malloc_size
> Âhttp://gcc.gnu.org/ml/fortran/2012-03/msg00127.html
As I said in the original submission, "While the patch is large, it's
also mechanical, hence committed as obvious."
> Approved but not yet committed:
> Janne:
> - [Patch, fortran] PR 49010/24518 MOD/MODULO fixes
> Âhttp://gcc.gnu.org/ml/fortran/2012-04/msg00012.html
> ÂOkayed but haven't found best wording.
I have an IMHO better wording, namely for MOD(A,P) "the returned value
has the same sign as A and a magnitude less than the magnitude of P."
and for MODULO(A,P) "the returned value has the same sign as P and a
magnitude less than the magnitude of P.". This wording implies what
the sign of the result must be when A is (+-) 0.0 like it does for any
other finite A, which I think is nice.
However, in order to implement this wording, MODULO needs to be
implemented a bit differently than now, namely now we have
res = fmod(a, p);
if (res && ((a < 0) != (p < 0))
res += p;
but in order to ensure the behavior above for signed zero we need to do
res = fmod(a, p);
if (res)
{
if ((a < 0) != (p < 0))
res += p;
}
else
res = copysign (0.0, p);
I have implemented the compile-time part of this, but I haven't yet
had the time to do the runtime code generation (which should be
conditional on -fsigned-zeros). I'll resubmit when done.
--
Janne Blomqvist