* [patch, fortran] Fix PR 85896, type confusion with min and max
@ 2018-10-30 19:07 Thomas Koenig
2018-10-30 20:07 ` Janne Blomqvist
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2018-10-30 19:07 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 598 bytes --]
Hello world,
the attached patchlet fixes a rejects-valid bug by simply ignoring the
type for max and min during simplification. This is correct
because setting the type of a generic intrinsic function has
no effect.
It is a rare pleasure to fix a bug by removing code only :-)
Regression-tested. OK for trunk?
Regards
Thomas
2018-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85896
* simplify.c (simplify_min_max): Do not convert the type of the
return expression.
2018-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85896
* gfortran.dg/min_max_type.f90: New test.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 981 bytes --]
Index: simplify.c
===================================================================
--- simplify.c (Revision 265502)
+++ simplify.c (Arbeitskopie)
@@ -4961,11 +4961,9 @@ static gfc_expr *
simplify_min_max (gfc_expr *expr, int sign)
{
gfc_actual_arglist *arg, *last, *extremum;
- gfc_intrinsic_sym * specific;
last = NULL;
extremum = NULL;
- specific = expr->value.function.isym;
arg = expr->value.function.actual;
@@ -4995,15 +4993,6 @@ simplify_min_max (gfc_expr *expr, int sign)
if (expr->value.function.actual->next != NULL)
return NULL;
- /* Convert to the correct type and kind. */
- if (expr->ts.type != BT_UNKNOWN)
- return gfc_convert_constant (expr->value.function.actual->expr,
- expr->ts.type, expr->ts.kind);
-
- if (specific->ts.type != BT_UNKNOWN)
- return gfc_convert_constant (expr->value.function.actual->expr,
- specific->ts.type, specific->ts.kind);
-
return gfc_copy_expr (expr->value.function.actual->expr);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] Fix PR 85896, type confusion with min and max
2018-10-30 19:07 [patch, fortran] Fix PR 85896, type confusion with min and max Thomas Koenig
@ 2018-10-30 20:07 ` Janne Blomqvist
0 siblings, 0 replies; 2+ messages in thread
From: Janne Blomqvist @ 2018-10-30 20:07 UTC (permalink / raw)
To: Thomas Koenig; +Cc: Fortran List, GCC Patches
On Tue, Oct 30, 2018 at 8:57 PM Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hello world,
>
> the attached patchlet fixes a rejects-valid bug by simply ignoring the
> type for max and min during simplification. This is correct
> because setting the type of a generic intrinsic function has
> no effect.
>
> It is a rare pleasure to fix a bug by removing code only :-)
>
> Regression-tested. OK for trunk?
>
Ok, thanks.
--
Janne Blomqvist
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-30 19:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 19:07 [patch, fortran] Fix PR 85896, type confusion with min and max Thomas Koenig
2018-10-30 20:07 ` Janne Blomqvist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).