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

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> Yep, I agree that this should simply be rejected.  I looked at your other
> patch for min/max, and think it can be committed.  If you want to update
> that patch to include the fix for this PR consider it pre-approved (provided
> regression testing passes).

The addition:

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 74e5e448760..65b46cd3f85 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -3693,6 +3693,11 @@ check_rest (bt type, int kind, gfc_actual_arglist
*arglist)
        {
          if (x->ts.type == type)
            {
+             if (x->ts.type == BT_CHARACTER)
+               {
+                 gfc_error ("Different character kinds at %L", &x->where);
+                 return false;
+               }
              if (!gfc_notify_std (GFC_STD_GNU, "Different type "
                                   "kinds at %L", &x->where))
                return false;

does the job and regtests fine.

Will commit together with the other PR, and with a new testcase for this one.

Reply via email to