[simplify.c] bug?

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Jun 12 15:40:00 GMT 2005


On Sun, Jun 12, 2005 at 07:39:07AM -0700, Steve Kargl wrote:
> On Sat, Jun 11, 2005 at 10:09:52PM -0700, Jerry DeLisle wrote:
> > While playing with implementing simplify for atanh function I noticed 
> 
> If you implement atanh in a similar fashion as besj0 or erfc,
> there is no simplification routine.  Simplification does more
> than just constant folding.  Are you implementing atanh to take
> an array argument and return an array of results?
> 
> > 
> > Should 1.1_8 give the same result as 1.1_4 at compile time?
> > 
> 
> Could be a bug?  I'll look at this later today.
> 

I instrumented gfc_simplify_asin() with

int i,j;

  mpfr_out_str (stderr, 10, 0, x->value.real, GFC_RND_MODE);
  i = mpfr_cmp_si (x->value.real, 1);
  j = mpfr_cmp_si (x->value.real, -1);
  printf("\ni = %d,  j = %d\n", i, j);

  if (i > 0 || j < 0)
    {
      printf("here\n");
      gfc_error ("Argument of ASIN at %L must be between -1 and 1", &x->where);
      printf("there\n");
      return &gfc_bad_expr;
      printf("where\n");
    }

which gives

kargl[214] gfc41 -static -o z asin.f90
1.10000000000000
i = 1,  j = 1
here
there
kargl[217] ./z
                     NaN

So &gfc_bad_expr appears to be set to something that permits
compilation to continue without an error.

-- 
Steve



More information about the Fortran mailing list