https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871

--- Comment #24 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #23)
> Created attachment 47913 [details]
> Diff that replaces handling of degree trig functions.

Fritz,

I have attached a patch that completely replaces how you handled
the various degree trig functions.  This patch brings these
functions into alignment with how all other functions are handled.
The patch fixes a number of ICE issues with simplification.
Ironically, I did not include Thomas's patch that started me down
this path, so you'll want to revisit his patch.  A simplify ChangeLog
follows.

        * gfortran.h (GFC_ISYM_ACOSD,GFC_ISYM_ASIND, GFC_ISYM_ATAN2D,
        GFC_ISYM_ATAND, GFC_ISYM_COSD, GFC_ISYM_COTAND, GFC_ISYM_SIND,
        GFC_ISYM_TAND): New enum values.

        * intrinsic.c (add_functions): Associate acosd, asind, atand, atan2d,
        cosd, cotand, sind, and tand with its enum value, and give each
        routine a simplification routine.

        * intrinsic.c (add_functions): Connect cotan to gfc_simplify_cotan
        (do_simplify): Remove special casing of DEC math functions.

        * intrinsic.h: New prototypes for gfc_simplify_acosd, 
        gfc_simplify_asind, gfc_simplify_atand, gfc_simplify_cosd,
        gfc_simplify_cotand, gfc_simplify_sind, gfc_simplify_tand.
        Remove prototypes for deleted functions gfc_simplify_atrigd,
        gfc_simplify_trigd, gfc_resolve_cotan, gfc_resolve_trigd
        gfc_resolve_atrigd

        * iresolve.c (is_trig_resolved, copy_replace_function_shallow,
        gfc_resolve_cotan, get_radians, get_degrees, resolve_trig_call,
        gfc_resolve_trigd, gfc_resolve_atrigd, gfc_resolve_atan2d): Deleted
        functions.

        * simplify.c (gfc_simplify_acosd, gfc_simplify_asind,
        gfc_simplify_atand, gfc_simplify_atan2d, gfc_simplify_cosd,
        gfc_simplify_sind, gfc_simplify_tand, gfc_simplify_cotand): New
        function for, well, simplification.

        * simplify.c (gfc_simplify_asinh): Fix error message.

        * simplify.c (simplify_trig_call, radians_f, gfc_simplify_atrigd):
        Delete function.

        * trans-intrinsic.c (rad2deg, deg2rad, gfc_conv_intrinsic_atrigd,
        gfc_conv_intrinsic_trigd, gfc_conv_intrinsic_cotan,
        gfc_conv_intrinsic_atan2d): New function.
        (gfc_conv_intrinsic_function): Use new enum values to select a new
        function.

Reply via email to