https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113412
--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to kargls from comment #5)
> The pointers to expr->symtree is NULL. This new patch catches your example.
It does, but behaves weird for some other cases. Try:
program main
complex :: c = 1.
complex, parameter :: z = 1.
print *, atan(c,c)
print *, atan(z,z)
end
This gives now:
pr113412.f90:4:18:
4 | print *, atan(c,c)
| 1
Error: 'c' argument of 'atan' intrinsic at (1) must be the same type and kind
as 'c'
pr113412.f90:5:18:
5 | print *, atan(z,z)
| 1
Error: 'z' argument of 'atan' intrinsic at (1) must be the same type and kind
as 'z'
I wonder whether we can reuse existing checks for atan2 for the 2-argument
version of atan.
I tried the following:
diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc
index c35f2bdd183..261d4229139 100644
--- a/gcc/fortran/intrinsic.cc
+++ b/gcc/fortran/intrinsic.cc
@@ -4370,6 +4370,11 @@ sort_actual (const char *name, gfc_actual_arglist **ap,
if (a == NULL)
goto do_sort;
+ if ((gfc_option.allow_std & GFC_STD_F2008) != 0
+ && strcmp(name, "atan") == 0
+ && !gfc_check_atan_2 (actual->expr, actual->next->expr))
+ return false;
+
whoops:
gfc_error ("Too many arguments in call to %qs at %L", name, where);
return false;
This is indeed sort of hackish and produces for testcase:
program main
complex :: c = 1.
print *, atan (c,c)
print *, atan2(c,c)
end
pr113412.f90:3:17:
3 | print *, atan (c,c)
| 1
Error: 'x' argument of 'atan' intrinsic at (1) must be REAL
pr113412.f90:4:17:
4 | print *, atan2(c,c)
| 1
Error: 'y' argument of 'atan2' intrinsic at (1) must be REAL
Note that the name of the formal argument is now wrong, probably because
the association of actuals with formals is missing.