public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5958] fortran: Silence conversion warnings for MIN1 and MAX1
@ 2021-12-14 15:31 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-12-14 15:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f1215db08126fbd2d69d971d65611508cf83b4ae

commit r12-5958-gf1215db08126fbd2d69d971d65611508cf83b4ae
Author: Manfred Schwarb <manfred99@gmx.ch>
Date:   Tue Dec 14 16:28:58 2021 +0100

    fortran: Silence conversion warnings for MIN1 and MAX1
    
    gcc/fortran/ChangeLog:
    
            PR fortran/91497
            * simplify.c (simplify_min_max): Disable conversion warnings for
            MIN1 and MAX1.

Diff:
---
 gcc/fortran/simplify.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index fb7b7814603..90067b6bbe6 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -5096,6 +5096,7 @@ min_max_choose (gfc_expr *arg, gfc_expr *extremum, int sign, bool back_val)
 static gfc_expr *
 simplify_min_max (gfc_expr *expr, int sign)
 {
+  int tmp1, tmp2;
   gfc_actual_arglist *arg, *last, *extremum;
   gfc_expr *tmp, *ret;
   const char *fname;
@@ -5140,7 +5141,16 @@ simplify_min_max (gfc_expr *expr, int sign)
   if ((tmp->ts.type != BT_INTEGER || tmp->ts.kind != gfc_integer_4_kind)
       && (strcmp (fname, "min1") == 0 || strcmp (fname, "max1") == 0))
     {
+      /* Explicit conversion, turn off -Wconversion and -Wconversion-extra
+	 warnings.  */
+      tmp1 = warn_conversion;
+      tmp2 = warn_conversion_extra;
+      warn_conversion = warn_conversion_extra = 0;
+
       ret = gfc_convert_constant (tmp, BT_INTEGER, gfc_integer_4_kind);
+
+      warn_conversion = tmp1;
+      warn_conversion_extra = tmp2;
     }
   else if ((tmp->ts.type != BT_REAL || tmp->ts.kind != gfc_real_4_kind)
 	   && (strcmp (fname, "amin0") == 0 || strcmp (fname, "amax0") == 0))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-14 15:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 15:31 [gcc r12-5958] fortran: Silence conversion warnings for MIN1 and MAX1 Martin Liska

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).