From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Sergio Durigan Junior <sergiodj@redhat.com>,
Ulrich Weigand <uweigand@de.ibm.com>
Subject: [PATCH 1/4] S390: For zero, let is_power_of_two() return false
Date: Wed, 22 Apr 2015 17:49:00 -0000 [thread overview]
Message-ID: <87h9s88354.fsf@br87z6lw.de.ibm.com> (raw)
In-Reply-To: <1429724743-4603-1-git-send-email-arnez@linux.vnet.ibm.com> (Andreas Arnez's message of "Wed, 22 Apr 2015 19:44:59 +0200")
This fixes a minor issue with the helper function is_power_of_two(),
which returned non-zero ("true") if the argument was zero. This led
to a wrong decision when passing a zero-sized struct in an inferior
function call.
gdb/ChangeLog:
* s390-linux-tdep.c (is_power_of_two): Add comment. Return
false if the argument is zero.
---
gdb/s390-linux-tdep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index b83a264..44feee7 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -2484,11 +2484,12 @@ is_float_like (struct type *type)
|| is_float_singleton (type));
}
+/* Determine whether N is a power of two. */
static int
is_power_of_two (unsigned int n)
{
- return ((n & (n - 1)) == 0);
+ return n && ((n & (n - 1)) == 0);
}
/* Return non-zero if TYPE should be passed as a pointer to a copy,
--
1.9.3
next prev parent reply other threads:[~2015-04-22 17:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 17:45 [PATCH 0/4] S390: Vector ABI support Andreas Arnez
2015-04-22 17:49 ` Andreas Arnez [this message]
2015-04-23 16:02 ` [PATCH 1/4] S390: For zero, let is_power_of_two() return false Ulrich Weigand
2015-04-22 17:51 ` [PATCH 2/4] S390: Restructure s390_push_dummy_call Andreas Arnez
2015-04-23 16:03 ` Ulrich Weigand
2015-04-22 17:51 ` [PATCH 3/4] S390: Re-arrange implementation of s390_return_value Andreas Arnez
2015-04-23 16:03 ` Ulrich Weigand
2015-04-22 17:52 ` [PATCH 4/4] S390: Vector ABI support Andreas Arnez
2015-04-22 17:58 ` Andreas Arnez
2015-04-23 16:07 ` Ulrich Weigand
2015-04-24 14:46 ` Andreas Arnez
2015-04-23 16:47 ` Eli Zaretskii
2015-04-27 9:41 ` [PATCH 0/4] " Andreas Krebbel
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=87h9s88354.fsf@br87z6lw.de.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=sergiodj@redhat.com \
--cc=uweigand@de.ibm.com \
/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