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

--- Comment #2 from kargl at gcc dot gnu.org ---
With the patch at the end of this message and this source code,


program foo
   integer(8) x
   real(8) y, z
   x = 1
   y = x
   z = atan(y,x)
   print *, z
end

I get 

% gfcx -c a.f90
a.f90:6:14:

    6 |    z = atan(y,x)
      |              1
Error: 'x' argument of 'atan' intrinsic at (1) must be the same type and kind
as 'x'

which is almost correct (one of 'x' should be 'y').

diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc
index c35f2bdd183..c30165dacef 100644
--- a/gcc/fortran/intrinsic.cc
+++ b/gcc/fortran/intrinsic.cc
@@ -4371,7 +4371,10 @@ sort_actual (const char *name, gfc_actual_arglist **ap,
     goto do_sort;

 whoops:
-  gfc_error ("Too many arguments in call to %qs at %L", name, where);
+  if (strncmp(name, "atan", 4) == 0)
+    gfc_check_atan_2 ((*ap)->expr, (*ap)->next->expr);
+  else
+    gfc_error ("Too many arguments in call to %qs at %L", name, where);
   return false;

 keywords:

Reply via email to