public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5958] fortran: Silence conversion warnings for MIN1 and MAX1 Date: Tue, 14 Dec 2021 15:31:49 +0000 (GMT) [thread overview] Message-ID: <20211214153149.04C3B3858D28@sourceware.org> (raw) 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))
reply other threads:[~2021-12-14 15:31 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211214153149.04C3B3858D28@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).