This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR35862 - add input I/O rounding support - by setting the CPU rounding mode
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Gerald Pfeifer <gerald at pfeifer dot com>, Eric Botcazou <ebotcazou at adacore dot com>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Sat, 20 Jul 2013 23:19:18 +0200
- Subject: Re: [Patch, Fortran] PR35862 - add input I/O rounding support - by setting the CPU rounding mode
- References: <51E65DA2 dot 9050101 at net-b dot de>
Le 17/07/2013 11:02, Tobias Burnus a écrit :
> As there is again a CPU dependence:
> - David, can you have a look at config/fpu-aix.h?
> - Eric and Gerald, can you have a look at config/fpu-sysv.h?
> - Uros, can you have a look at config/fpu-387.h?
>
> All: Does on any of the systems exists a rounding mode like nearest -
> but with rounding away from 0 for a tie? (= Fortran I/O rounding mode
> "compatible".) If not, I will simply continue to use nearest in that
> case - for output it is implemented - and more visible as one might
> output only few digits.
>
> The patch works by setting the CPU's rounding mode before calling
> "strtof" - which in turn has to handle the rounding mode. That works for
> GLIBC and for libquadmath - but probably not with all libc. Thus, I
> assume that one needs to add a bunch of triplets to "target { ! {... }
> }" to avoid test suite failures. Or, even better, if you have
> suggestions how to fix it for your platform, tell me about it.
> (Admittedly, contrary to output rounding, I think input rounding is not
> as important; the test case uses "0.1" which is the prime example.)
>
> As (intended) side effect, the patch also adds some functionality which
> can be used when gfortran finally implements Fortran 2003's IEEE modules.
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
The fortran bits look good.
Mikael