https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99061
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
Last reconfirmed| |2021-02-10
Priority|P3 |P4
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from kargl at gcc dot gnu.org ---
Patch tested with
program p
real(4) :: z4, a4 = 1.0_4
real(8) :: z8, a8 = 1.0_8
real(10) :: z0, a0 = 1.0_10
real(16) :: z6, a6 = 1.0_16
z4 = atan2d(a4, a4)
z8 = atan2d(a8, a8)
z0 = atan2d(a0, a0)
z6 = atan2d(a6, a6)
print *, z4
print *, z8
print *, z0
print *, z6
end
Patch has not been regression tested.
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 5c9258c65c3..0cf0aa56811 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -4717,6 +4717,7 @@ gfc_conv_intrinsic_cotand (gfc_se *se, gfc_expr *expr)
static void
gfc_conv_intrinsic_atan2d (gfc_se *se, gfc_expr *expr)
{
+ gfc_intrinsic_map_t *m;
tree args[2];
tree atan2d;
tree type;
@@ -4724,7 +4725,13 @@ gfc_conv_intrinsic_atan2d (gfc_se *se, gfc_expr *expr)
gfc_conv_intrinsic_function_args (se, expr, args, 2);
type = TREE_TYPE (args[0]);
- atan2d = gfc_builtin_decl_for_float_kind (BUILT_IN_ATAN2, expr->ts.kind);
+ /* Find tan builtin function. */
+ m = gfc_intrinsic_map;
+ for (; m->id != GFC_ISYM_NONE || m->double_built_in != END_BUILTINS; m++)
+ if (GFC_ISYM_ATAN2 == m->id)
+ break;
+
+ atan2d = gfc_get_intrinsic_lib_fndecl (m, expr);
atan2d = build_call_expr_loc (input_location, atan2d, 2, args[0], args[1]);
se->expr = fold_build2_loc (input_location, MULT_EXPR, type, atan2d,