This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, libgfortran] PR48767 Rounding Up followup patch
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Jerry DeLisle <jvdelisle at frontier dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 30 Apr 2011 10:56:55 +0300
- Subject: Re: [patch, libgfortran] PR48767 Rounding Up followup patch
- References: <4DBB6707.1050703@frontier.com>
On Sat, Apr 30, 2011 at 04:33, Jerry DeLisle <jvdelisle@frontier.com> wrote:
> Hi,
>
> The attached patch does some cleanup and a check for trailing zeros to
> decide whether or not to round.
>
> I have added the additional test cases posted on the bugzilla to the
> existing test case round_3.f08.
>
> Regression tested on x86-64.
>
> OK for trunk and then I will back port the whole enchilada to 4.6.1 in a few
> weeks. ÂPlease consider the starting point of the zero scan carefully. ÂI
> have not convinced myself that the d * p covers all cases, but it works for
> all cases I have tried.
I'm a bit suspicious about that as well:
+ /* Scan for trailing zeros to see if we really need to round it. */
+ for(i = 1 + d * p ; i < ndigits; i++)
+ {
+ if (digits[i] != '0')
+ goto do_rnd;
+ }
+ goto skip;
legal values for p are (-d, d+2) for E format. Won't this easily
overflow if p>1? E.g. 3PE50.36? Then 1 + 36*3 = 109 and ndigits is
specified by
ndigits = MIN_FIELD_WIDTH - 4 - edigits;
If real(16) is available, ndigits= 49-4-4=41.
Or am I missing something obvious?
--
Janne Blomqvist