https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113412
--- Comment #5 from kargls at comcast dot net ---
(In reply to anlauf from comment #4)
> (In reply to kargls from comment #3)
> > Created attachment 57109 [details]
> > patch
> >
> > The attached patch has been regtested. There were no regression.
>
> Steve,
>
> I just tried your patch. While it fixes comment#0, it misses:
>
> print *, atan(1.d0,1.0)
> end
>
Ugh. I forgot literal constants don't have symtrees or names. :(
gfc_error ("%qs argument of %qs intrinsic at %L must be the same type "
"and kind as %qs", (*ap)->next->expr->symtree->name, name,
&(*ap)->next->expr->where, (*ap)->expr->symtree->name);
The pointers to expr->symtree is NULL. This new patch catches your example.
diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc
index c35f2bdd183..a8a92874583 100644
--- a/gcc/fortran/intrinsic.cc
+++ b/gcc/fortran/intrinsic.cc
@@ -4371,7 +4371,19 @@ 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 ((gfc_option.allow_std & GFC_STD_F2008) != 0
+ && strcmp(name, "atan") == 0)
+ {
+ if ((*ap)->expr->symtree == NULL || (*ap)->next->expr->symtree == NULL)
+ gfc_error ("Arguments of %qs intrinsic at %L must have the same "
+ "type and kind", name, &(*ap)->expr->where);
+ else
+ gfc_error ("%qs argument of %qs intrinsic at %L must be the same "
+ "type and kind as %qs", (*ap)->next->expr->symtree->name,
+ name, &(*ap)->next->expr->where,
(*ap)->expr->symtree->name);
+ }
+ else
+ gfc_error ("Too many arguments in call to %qs at %L", name, where);
return false;
keywords: