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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PING Re: gfortran PATCH was Re: [simplify.c] bug?


On Saturday 18 June 2005 06:35, Steve Kargl wrote:
> PING.
>
> On Sun, Jun 12, 2005 at 10:28:20AM -0700, Steve Kargl wrote:
> > The attached patch enables the reporting of errors for
> > generic functions whose simplification routine returns
> > FAILURE.  That is, the above asin_generic program will
> > cause gfortran to issue
> >
> > kargl[251] gfc41 -static -o z asin.f90
> >  In file asin.f90:3
> >
> >    y = asin(1.1_8)
> >            1
> > Error: Argument of ASIN at (1) must be between -1 and 1
> >
> > 2005-06-12  Steven G. Kargl  <kargls@comcast.net>
> >
> > 	* intrinsic.c (gfc_intrinsic_func_interface): Enable errors for generic
> > 	functions whose simplification routine return FAILURE.
> >
> > Index: intrinsic.c
> > ===================================================================
> > RCS file: /cvs/gcc/gcc/gcc/fortran/intrinsic.c,v
> > retrieving revision 1.47
> > diff -c -p -r1.47 intrinsic.c
> > *** intrinsic.c	1 Jun 2005 19:17:32 -0000	1.47
> > --- intrinsic.c	12 Jun 2005 17:20:32 -0000
> > *************** got_specific:
> > *** 3007,3017 ****
> >     expr->value.function.isym = specific;
> >     gfc_intrinsic_symbol (expr->symtree->n.sym);
> >
> >     if (do_simplify (specific, expr) == FAILURE)
> > !     {
> > !       gfc_suppress_error = 0;
> > !       return MATCH_ERROR;
> > !     }
> >
> >     /* TODO: We should probably only allow elemental functions here.  */
> >     flag |= (expr->ts.type != BT_INTEGER && expr->ts.type != BT_CHARACTER);
> >     --- 3007,3015 ---- 
> >     expr->value.function.isym = specific;
> >     gfc_intrinsic_symbol (expr->symtree->n.sym);
> >
> > +   gfc_suppress_error = 0;
> >     if (do_simplify (specific, expr) == FAILURE)
> > !     return MATCH_ERROR;
> >
> >     /* TODO: We should probably only allow elemental functions here.  */
> >     flag |= (expr->ts.type != BT_INTEGER && expr->ts.type != BT_CHARACTER);

A bigger chunk of the code you are patching:

got_specific:
  expr->value.function.isym = specific;
  gfc_intrinsic_symbol (expr->symtree->n.sym);

  if (do_simplify (specific, expr) == FAILURE)
    {
      gfc_suppress_error = 0;
      return MATCH_ERROR;
    }

  /* TODO: We should probably only allow elemental functions here.  */
  flag |= (expr->ts.type != BT_INTEGER && expr->ts.type != BT_CHARACTER);

  gfc_suppress_error = 0;
  if (pedantic && gfc_init_expr


After your patch it looks like this:

got_specific:
  expr->value.function.isym = specific;
  gfc_intrinsic_symbol (expr->symtree->n.sym);

  gfc_suppress_error = 0;
  if (do_simplify (specific, expr) == FAILURE)
    return MATCH_ERROR;

  /* TODO: We should probably only allow elemental functions here.  */
  flag |= (expr->ts.type != BT_INTEGER && expr->ts.type != BT_CHARACTER);

  gfc_suppress_error = 0;
  if (pedantic && gfc_init_expr


I would hope do_simplify cannot change gfc_suppress_error, the second
"gfc_suppress_error = 0;" should now be redundant.  Can you check that
please?

The patch looks OK to me otherwise.

Gr.
Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]