public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/50012] [4.5/4.6/4.7 Regression] C++ front end misses -Wsign-compare warnings when extraneous parentheses are present
Date: Mon, 19 Dec 2011 15:00:00 -0000	[thread overview]
Message-ID: <bug-50012-4-Eb231NNsOL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50012-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-19 14:43:05 UTC ---
This has been introduced with
http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01402.html
which has been written as a better way of:
http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01393.html
Perhaps the older patch is a better way than this one, which, if I understand
it right, is that ignoring of the promotion at the -Wsign-compare handling
spot?
Setting TREE_NO_WARNING, at least until we have a way to say which warnings we
want to prohibit and which should be kept, is an ugly hack and shouldn't be
taken lightly.

While Ian's patch doesn't set TREE_NO_WARNING in this testcase, it just
disables the warning if any of the operands is TREE_NO_WARNING and uses this
bit for yet another purpose.  The TREE_NO_WARNING bit in this case is set by
finish_parenthesized_expr:
1504      if (EXPR_P (expr))
1505        /* This inhibits warnings in c_common_truthvalue_conversion.  */
1506        TREE_NO_WARNING (expr) = 1;

So, what was wrong with the first approach?
And, perhaps for 4.8 we want to turn TREE_NO_WARNING bit into a bit that just
tells us whether that tree in question is in some hash table (see e.g.
DECL_HAS_VALUE_EXPR_P etc.) and that hash table would contain details what
warnings are we supposed to ignore.  This isn't the only problematic spot.


  parent reply	other threads:[~2011-12-19 14:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-07 11:22 [Bug c++/50012] New: " mikpe at it dot uu.se
2011-08-07 19:52 ` [Bug c++/50012] " mikpe at it dot uu.se
2011-08-08 10:09 ` [Bug c++/50012] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-08-14 12:43 ` mikpe at it dot uu.se
2011-08-19  7:34 ` jakub at gcc dot gnu.org
2011-10-10 12:19 ` rguenth at gcc dot gnu.org
2011-12-19 15:00 ` jakub at gcc dot gnu.org [this message]
2012-01-05 17:43 ` jakub at gcc dot gnu.org
2012-01-07  1:32 ` ian at airs dot com
2012-01-14  0:26 ` ian at gcc dot gnu.org
2012-01-14  0:27 ` [Bug c++/50012] [4.5/4.6 " ian at airs dot com
2012-07-02 12:07 ` rguenth at gcc dot gnu.org
2012-11-13 11:24 ` [Bug c++/50012] [4.6 " paolo.carlini at oracle dot com

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-50012-4-Eb231NNsOL@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).