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]

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


On Sun, Jun 12, 2005 at 09:25:45AM -0700, Steve Kargl wrote:
> On Sun, Jun 12, 2005 at 08:51:09AM -0700, Jerry DeLisle wrote:
> > Steve Kargl wrote:
> > >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?
> > >
> > Yes, I am following besj0.  I was exploring checking for range limits 
> > with atanh when I stumbled on the odd behavior.  I used asin as an 
> > example for the list because the other is still cooking.
> > 
> 
> AFAICT, the simplification functions are working as designed.
> It appears the error message is not properly propagated back
> through the call chain.
> 
> Okay, I know wants going on (sort of).
> 
> Consider the three programs
> 
> program asin_specific
>    real(4) x
>    x = asin(1.1)
> end program asin_specific
> 
> program dasin_specific
>    real(8) x
>    x = dasin(1.1_8)
> end program dasin_specific
> 
> program asin_generic
>    real(8) x
>    x = asin(1.1_8)
> end program asin_generic
> 
> The first 2 program yield errors from the simplification 
> because this portion
> 
> 
>   if (expr->value.function.isym != NULL)
>     return (do_simplify (expr->value.function.isym, expr) == FAILURE)
>       ? MATCH_ERROR : MATCH_YES;
> 
> of gfc_intrinsic_func_interface() in intrinsic.c is executed.
> 
> For the case of a generic function, expr->value.function.isym == NULL
> and by pass this chunk.  I need to check the rest of 
> gfc_intrinsic_func_interface() to see how failures with generics are
> handled.
> 

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.

-- 
Steve

Attachment: intrinsic.c.diff
Description: Text document


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