From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Fix condition in is_aligning_offset (PR c/61271)
Date: Thu, 21 Aug 2014 15:52:00 -0000 [thread overview]
Message-ID: <20140821155210.GT14320@redhat.com> (raw)
This is one of the issues that -Wlogical-not-parentheses detected.
Interestingly, this code has been added in 2002 (!). I believe the
logical not there should be just removed; the comment above it says
/* We must now have a BIT_AND_EXPR with a constant that is one less than
power of 2 and which is larger than BIGGEST_ALIGNMENT. */
so if the constant is not one less than power of 2 (exact_log2 returns -1),
we should bail out.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
Should I backport this to 4.9/4.8 after a while?
2014-08-21 Marek Polacek <polacek@redhat.com>
PR c/61271
* expr.c (is_aligning_offset): Remove logical not.
diff --git gcc/expr.c gcc/expr.c
index 920d47b..05d81dc 100644
--- gcc/expr.c
+++ gcc/expr.c
@@ -10721,7 +10721,7 @@ is_aligning_offset (const_tree offset, const_tree exp)
|| !tree_fits_uhwi_p (TREE_OPERAND (offset, 1))
|| compare_tree_int (TREE_OPERAND (offset, 1),
BIGGEST_ALIGNMENT / BITS_PER_UNIT) <= 0
- || !exact_log2 (tree_to_uhwi (TREE_OPERAND (offset, 1)) + 1) < 0)
+ || exact_log2 (tree_to_uhwi (TREE_OPERAND (offset, 1)) + 1) < 0)
return 0;
/* Look at the first operand of BIT_AND_EXPR and strip any conversion.
Marek
next reply other threads:[~2014-08-21 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 15:52 Marek Polacek [this message]
2014-08-26 8:04 ` Richard Biener
2014-09-01 14:20 ` Marek Polacek
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=20140821155210.GT14320@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@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).