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 c/16632] New: A couple fold-const.c optimizations are non-functional Date: Mon, 19 Jul 2004 18:05:00 -0000 [thread overview] Message-ID: <20040719180516.16632.trt@acm.org> (raw) In fold-const.c there are a couple of bitmask/comparision optimizations: /* If we have (A & C) == D where D & ~C != 0, convert this into 0. and /* If we have (A | C) == D where C & ~D != 0, convert this into 0. Sample C code: void subr (int i) { if ((i|3) == 1) return; /* never taken */ if ((i&4) == 2) return; /* never taken */ } Unfortunately fold-const.c neglects to fold ~C (~D) and so the detection of these cases is non-functional. I'm not sure how to demonstrate this outside the debugger, since later pieces of gcc seem to clean this up. For example ~D is computed on approx line 8391 with build1 (BIT_NOT_EXPR, TREE_TYPE (arg1), arg1))); This should be fold(build1 ...), or fold_not_const(arg1, TREE_TYPE(arg1)). Similarly for ~C on approx line 8373. -- Summary: A couple fold-const.c optimizations are non-functional Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: minor Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: trt at acm dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16632
next reply other threads:[~2004-07-19 18:05 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-07-19 18:05 trt at acm dot org [this message] 2004-07-19 18:35 ` [Bug tree-optimization/16632] " pinskia at gcc dot gnu dot org 2004-07-20 16:50 ` trt at acm dot org 2004-08-24 14:41 ` trt at acm dot org 2004-10-03 14:43 ` pinskia at gcc dot gnu dot org 2004-10-03 15:33 ` cvs-commit at gcc dot gnu dot org 2004-10-03 15:34 ` kazu at cs dot umass dot edu 2004-10-15 17:15 ` pinskia at gcc dot gnu dot 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=20040719180516.16632.trt@acm.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: 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).