From: Uros Bizjak <ubizjak@gmail.com>
To: java-patches@gcc.gnu.org
Subject: Fwd: [PATCH, libjava]: Avoid suggest parentheses around comparison in operand of '|' in java/lang/natObject.cc
Date: Wed, 12 Mar 2014 15:02:00 -0000 [thread overview]
Message-ID: <CAFULd4aqwfPRk4tnThJ1QM6F1zuLpvZ8RLY+hNaH=xn+fserEg@mail.gmail.com> (raw)
In-Reply-To: <CAFULd4ZNAti1tjKeBDYGePRptfeTCYOyh990cWKw0oTApdUkug@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]
Forwarded from gcc-patches@ ML [1].
[1] http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00481.html
---------- Forwarded message ----------
From: Uros Bizjak <ubizjak@gmail.com>
Date: Mon, Mar 10, 2014 at 9:13 PM
Subject: [PATCH, libjava]: Avoid suggest parentheses around comparison
in operand of '|' in java/lang/natObject.cc
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Hello!
During libjava build, following warning is reported:
../../../gcc-svn/branches/gcc-4_8-branch/libjava/java/lang/natObject.cc:932:27:
warning: suggest parentheses around comparison in operand of '|'
[-Wparentheses]
JvAssert(he -> address == address | LOCKED );
^
It looks that parentheses are missing around (address | LOCKED),
otherwise the expression is always true - LOCKED is unconditionally
defined to 1. Attached patch adds these parentheses (and removes a
pair of superfluous ones).
2014-03-10 Uros Bizjak <ubizjak@gmail.com>
* java/lang/natObject.cc (_Jv_MonitorEnter): Add missing parenthesis
around comparison with (address | LOCKED) in JvAssert.
Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
OK for mainline SVN and release branches?
Uros.
[-- Attachment #2: j.diff.txt --]
[-- Type: text/plain, Size: 943 bytes --]
Index: java/lang/natObject.cc
===================================================================
--- java/lang/natObject.cc (revision 208455)
+++ java/lang/natObject.cc (working copy)
@@ -929,7 +929,7 @@ retry:
// only be held by other threads waiting for conversion, and
// they, like us, drop it quickly without blocking.
_Jv_MutexLock(&(hl->si.mutex));
- JvAssert(he -> address == address | LOCKED );
+ JvAssert(he -> address == (address | LOCKED));
release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY));
// release lock on he
LOG(REQ_CONV, (address | REQUEST_CONVERSION | HEAVY), self);
@@ -961,7 +961,7 @@ retry:
}
obj_addr_t was_heavy = (address & HEAVY);
if ((address & LOCKED) ||
- !compare_and_swap(&(he -> address), address, (address | LOCKED )))
+ !compare_and_swap(&(he -> address), address, address | LOCKED ))
{
wait_unlocked(he);
goto retry;
next parent reply other threads:[~2014-03-12 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAFULd4ZNAti1tjKeBDYGePRptfeTCYOyh990cWKw0oTApdUkug@mail.gmail.com>
2014-03-12 15:02 ` Uros Bizjak [this message]
2014-03-12 15:54 ` Andrew Haley
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='CAFULd4aqwfPRk4tnThJ1QM6F1zuLpvZ8RLY+hNaH=xn+fserEg@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=java-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).