public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/101030] [9/10/11/12 Regression] ICE with -Wconversion and a?:b extension in template argument
Date: Thu, 12 Aug 2021 23:33:42 +0000	[thread overview]
Message-ID: <bug-101030-4-1cq623IV9o@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101030-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression] gcc |[9/10/11/12 Regression] ICE
                   |internal error with         |with -Wconversion and a?:b
                   |Wconversion                 |extension in template
                   |                            |argument

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simple fix but I doubt it is the correct fix:
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index 84ad6633c96..ddaf0036abc 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -1296,8 +1296,10 @@ conversion_warning (location_t loc, tree type, tree
expr, tree result)
     case COND_EXPR:
       {
        /* In case of COND_EXPR, we do not care about the type of
-          COND_EXPR, only about the conversion of each operand.  */
-       tree op1 = TREE_OPERAND (expr, 1);
+          COND_EXPR, only about the conversion of each operand
+          except if we had a?:b then we care about the original
+          expression.  */
+       tree op1 = TREE_OPERAND (expr, 1) ? TREE_OPERAND (expr, 1) :
TREE_OPERAND (expr, 0);
        tree op2 = TREE_OPERAND (expr, 2);

        return (conversion_warning (loc, type, op1, result)

  parent reply	other threads:[~2021-08-12 23:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 12:24 [Bug c++/101030] New: gcc internal error with Wconversion chrishair85 at gmail dot com
2021-08-12 23:19 ` [Bug c++/101030] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2021-08-12 23:33 ` pinskia at gcc dot gnu.org [this message]
2022-01-17 14:36 ` [Bug c++/101030] [9/10/11/12 Regression] ICE with -Wconversion and a?:b extension in template argument rguenth at gcc dot gnu.org
2022-03-29 14:51 ` mpolacek at gcc dot gnu.org
2022-03-30 14:23 ` cvs-commit at gcc dot gnu.org
2022-03-30 14:24 ` [Bug c++/101030] [9/10/11 " mpolacek at gcc dot gnu.org
2022-03-30 14:27 ` cvs-commit at gcc dot gnu.org
2022-03-30 14:28 ` [Bug c++/101030] [9/10 " mpolacek at gcc dot gnu.org

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=bug-101030-4-1cq623IV9o@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).