public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "trt at acm dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/16302] gcc fails to warn about some common logic errors
Date: Fri, 29 Apr 2005 20:20:00 -0000	[thread overview]
Message-ID: <20050429202013.22942.qmail@sourceware.org> (raw)
In-Reply-To: <20040630193304.16302.trt@acm.org>


------- Additional Comments From trt at acm dot org  2005-04-29 20:20 -------
The patch given in comment #4 no successfully applies because the warning()
function has new initial parameter.  Also the fold_buildN() cleanup invalidated
(and fixed) the "REAL_CST" part of the patch.
Some "speculative folding" is now causing false positives, for which there is a
simple fix: suppress warnings when doing such folds. For example

*** tree-ssa-loop-niter.c.orig  Wed Apr 27 13:48:21 2005
--- tree-ssa-loop-niter.c       Wed Apr 27 14:28:59 2005
***************
*** 778,780 ****
--- 778,782 ----
    notcond = invert_truthvalue (cond);
+   inhibit_warnings++;
    e = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, notcond, te);
+   inhibit_warnings--;
    if (nonzero_p (e))

People who think warnings belong only in the front-end might balk.  I could
submit an alternate indirect check for this situation in parser_build_binary_op.
 It would be tidy, but would no longer warn about non-C glitches such as:

libjava/gnu/java/security/x509/X500DistinguishedName.java:447:        if (sep !=
'+' || sep != ',')
libjava/java/net/HttpURLConnection.java:555:    if (((code / 100) != 4) ||
((code / 100) != 5))
libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java:401:    if
((underlinedChar >= 0) || (underlinedChar <= 0xffff))
libjava/javax/security/auth/x500/X500Principal.java:380:        if (sep != '+'
|| sep != ',')

Please let me know if there is any interest in a C-only patch.  (Or any interest
in pursuing this PR.)

-- 


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


      parent reply	other threads:[~2005-04-29 20:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-30 19:38 [Bug c/16302] New: " trt at acm dot org
2004-07-01  1:23 ` [Bug c/16302] " pinskia at gcc dot gnu dot org
2004-07-01 15:28 ` trt at acm dot org
2004-07-01 15:53 ` bangerth at dealii dot org
2004-07-01 17:45 ` jsm at polyomino dot org dot uk
2004-07-07 15:36 ` trt at acm dot org
2004-08-03  7:32 ` [Bug middle-end/16302] " pinskia at gcc dot gnu dot org
2004-09-02 18:20 ` trt at acm dot org
2005-04-29 20:20 ` trt at acm dot org [this message]

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=20050429202013.22942.qmail@sourceware.org \
    --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).