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: [PATCH] Fix PR35202, errno and (float)mathfn((double)x) folding


On Sun, Jan 25, 2009 at 8:37 PM, Richard Guenther <rguenther@suse.de> wrote:
>
> This fixes said PR.  I went over the C99 spec and recent glibc
> manpages for non-C99 functions.  I explicitly excluded the
> possibility of extra domain errors from domains that are bounded
> by values that are exactly representable.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, ok?

Joseph, ping?

Thanks,
Richard.

> Thanks,
> Richard.
>
> 2009-01-25  Richard Guenther  <rguenther@suse.de>
>
>        PR middle-end/35202
>        * convert.c (convert_to_real): Disable (float)fn((double)x)
>        to fnf(x) conversion if errno differences may occur and
>        -fmath-errno is set.
>
> Index: gcc/convert.c
> ===================================================================
> --- gcc/convert.c       (revision 143661)
> +++ gcc/convert.c       (working copy)
> @@ -139,40 +139,45 @@ convert_to_real (tree type, tree expr)
>       switch (fcode)
>         {
>  #define CASE_MATHFN(FN) case BUILT_IN_##FN: case BUILT_IN_##FN##L:
> -         CASE_MATHFN (ACOS)
> -         CASE_MATHFN (ACOSH)
> -         CASE_MATHFN (ASIN)
> -         CASE_MATHFN (ASINH)
> -         CASE_MATHFN (ATAN)
> -         CASE_MATHFN (ATANH)
> -         CASE_MATHFN (CBRT)
> -         CASE_MATHFN (COS)
>          CASE_MATHFN (COSH)
> -         CASE_MATHFN (ERF)
> -         CASE_MATHFN (ERFC)
>          CASE_MATHFN (EXP)
>          CASE_MATHFN (EXP10)
>          CASE_MATHFN (EXP2)
> -         CASE_MATHFN (EXPM1)
> -         CASE_MATHFN (FABS)
>          CASE_MATHFN (GAMMA)
>          CASE_MATHFN (J0)
>          CASE_MATHFN (J1)
>          CASE_MATHFN (LGAMMA)
> -         CASE_MATHFN (LOG)
> -         CASE_MATHFN (LOG10)
> -         CASE_MATHFN (LOG1P)
> -         CASE_MATHFN (LOG2)
> -         CASE_MATHFN (LOGB)
>          CASE_MATHFN (POW10)
> -         CASE_MATHFN (SIN)
>          CASE_MATHFN (SINH)
> -         CASE_MATHFN (SQRT)
> -         CASE_MATHFN (TAN)
> -         CASE_MATHFN (TANH)
>          CASE_MATHFN (TGAMMA)
>          CASE_MATHFN (Y0)
>          CASE_MATHFN (Y1)
> +           /* The above functions may set errno differently with float
> +              input or output so this transformation is not safe with
> +              -fmath-errno.  */
> +           if (flag_errno_math)
> +             break;
> +         CASE_MATHFN (ACOS)
> +         CASE_MATHFN (ACOSH)
> +         CASE_MATHFN (ASIN)
> +         CASE_MATHFN (ASINH)
> +         CASE_MATHFN (ATAN)
> +         CASE_MATHFN (ATANH)
> +         CASE_MATHFN (CBRT)
> +         CASE_MATHFN (COS)
> +         CASE_MATHFN (ERF)
> +         CASE_MATHFN (ERFC)
> +         CASE_MATHFN (EXPM1)
> +         CASE_MATHFN (FABS)
> +         CASE_MATHFN (LOG)
> +         CASE_MATHFN (LOG10)
> +         CASE_MATHFN (LOG2)
> +         CASE_MATHFN (LOG1P)
> +         CASE_MATHFN (LOGB)
> +         CASE_MATHFN (SIN)
> +         CASE_MATHFN (SQRT)
> +         CASE_MATHFN (TAN)
> +         CASE_MATHFN (TANH)
>  #undef CASE_MATHFN
>            {
>              tree arg0 = strip_float_extensions (CALL_EXPR_ARG (expr, 0));
>


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