[Patch, Fortran] PR34901 - Make mismatched-types error message less odd
Tobias Burnus
burnus@net-b.de
Tue Jan 22 01:59:00 GMT 2008
Tobias Schlüter wrote:
>> Error: Type mismatch in argument 'a' at (1); passed REAL(kind=4) to
>> REAL(kind=8)
> Please use gfc_typename() for this purpose.
Thanks! I felt it had to be somewhere, but I could not find it last time.
Tobias
Committed revision 131700:
Index: interface.c
===================================================================
--- interface.c (revision 131699)
+++ interface.c (working copy)
@@ -1470,18 +1470,10 @@
if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN)
&& !gfc_compare_types (&formal->ts, &actual->ts))
{
- if (where && actual->ts.type == BT_DERIVED
- && formal->ts.type == BT_DERIVED)
- gfc_error ("Type mismatch in argument '%s' at %L; passed type(%s) to "
- "type(%s)", formal->name, &actual->where,
- actual->ts.derived->name, formal->ts.derived->name);
- else if (where)
+ if (where)
gfc_error ("Type mismatch in argument '%s' at %L; passed %s to %s",
- formal->name, &actual->where,
- actual->ts.type == BT_DERIVED ? "derived type"
- : gfc_basic_typename (actual->ts.type),
- formal->ts.type == BT_DERIVED ? "derived type"
- : gfc_basic_typename (formal->ts.type));
+ formal->name, &actual->where, gfc_typename (&actual->ts),
+ gfc_typename (&formal->ts));
return 0;
}
Index: ChangeLog
===================================================================
--- ChangeLog (revision 131699)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2007-01-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34901
+ * interface.c (compare_parameter): Improved error message
+ for arguments of same type and mismatched kinds.
+
2008-01-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34861
More information about the Fortran
mailing list