public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53524] [4.7/4.8 Regression] Bogus and unsuppressible enum comparison warning
Date: Wed, 30 May 2012 10:35:00 -0000	[thread overview]
Message-ID: <bug-53524-4-OU7PTNxFvF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53524-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-30 10:22:33 UTC ---
The warnings are an unintended effect of my fix for PR16603.

We warn at the end of the below lines of call.c. At the moment isn't clear to
me *when* it would actually make sense to warn. Hints?

///////////////////////////////////

  /* [expr.cond]

     After those conversions, one of the following shall hold:

     --The second and third operands have the same type; the result  is  of
       that type.  */
  if (same_type_p (arg2_type, arg3_type))
    result_type = arg2_type;
  /* [expr.cond]

     --The second and third operands have arithmetic or enumeration
       type; the usual arithmetic conversions are performed to bring
       them to a common type, and the result is of that type.  */
  else if ((ARITHMETIC_TYPE_P (arg2_type)
        || UNSCOPED_ENUM_P (arg2_type))
       && (ARITHMETIC_TYPE_P (arg3_type)
           || UNSCOPED_ENUM_P (arg3_type)))
    {
      /* In this case, there is always a common type.  */
      result_type = type_after_usual_arithmetic_conversions (arg2_type,
                                 arg3_type);
      do_warn_double_promotion (result_type, arg2_type, arg3_type,
                "implicit conversion from %qT to %qT to "
                "match other result of conditional",
                input_location);

      if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
      && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
        {
          if (complain & tf_warning)
            warning (0, 
                     "enumeral mismatch in conditional expression: %qT vs %qT",
                     arg2_type, arg3_type);
        }


  parent reply	other threads:[~2012-05-30 10:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  1:53 [Bug c++/53524] New: [4.7/4.8 Regression] Bogus and unsupressable " ppluzhnikov at google dot com
2012-05-30  2:25 ` [Bug c++/53524] " pinskia at gcc dot gnu.org
2012-05-30  2:59 ` jyasskin at gcc dot gnu.org
2012-05-30  4:45 ` crowl at google dot com
2012-05-30  8:17 ` manu at gcc dot gnu.org
2012-05-30  8:54 ` [Bug c++/53524] [4.7/4.8 Regression] Bogus and unsuppressible " paolo.carlini at oracle dot com
2012-05-30  9:54 ` rguenth at gcc dot gnu.org
2012-05-30 10:35 ` paolo.carlini at oracle dot com [this message]
2012-05-30 11:14 ` paolo.carlini at oracle dot com
2012-05-30 16:45 ` manu at gcc dot gnu.org
2012-05-30 17:37 ` paolo.carlini at oracle dot com
2012-05-30 17:42 ` crowl at google dot com
2012-05-30 17:43 ` crowl at google dot com
2012-05-30 17:55 ` manu at gcc dot gnu.org
2012-05-30 18:43 ` paolo.carlini at oracle dot com
2012-05-31  3:01 ` paolo.carlini at oracle dot com
2012-05-31 17:33 ` crowl at google dot com
2012-05-31 18:05 ` paolo.carlini at oracle dot com
2012-05-31 21:14 ` crowl at google dot com
2012-05-31 21:24 ` paolo.carlini at oracle dot com
2012-05-31 21:42 ` ppluzhnikov at google dot com
2012-06-04 19:28 ` paolo at gcc dot gnu.org
2012-06-04 20:31 ` paolo at gcc dot gnu.org
2012-06-13 13:50 ` rguenth at gcc dot gnu.org
2012-06-13 14:01 ` paolo.carlini at oracle dot com
2012-06-14  8:11 ` rguenth at gcc dot gnu.org
2012-06-19 21:57 ` ppluzhnikov at google dot com
2012-06-25 15:51 ` [Bug c++/53524] [4.7/4.8 Regression] Bogus " jason at gcc dot gnu.org
2012-07-02 19:15 ` jason at gcc dot gnu.org
2012-07-02 19:24 ` jason 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-53524-4-OU7PTNxFvF@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).