public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Fix invalid left shift of negative value.
Date: Tue, 10 Nov 2015 11:18:00 -0000	[thread overview]
Message-ID: <20151110111752.GF17214@linux.vnet.ibm.com> (raw)
In-Reply-To: <20151110111638.GD17214@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

On Tue, Nov 10, 2015 at 12:16:38PM +0100, Dominik Vogt wrote:
> The following series of patches fixes all occurences of
> left-shifting negative constants in C code which is undefined by
> the C standard.  The patches have been tested on s390x, covering
> only a small subset of the changes.

Changes in gdb/testsuite/.  Not sure whether they are good.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0002-gdb-testsuite-Fix-left-shift-of-negative-value.patch --]
[-- Type: text/x-diff, Size: 1935 bytes --]

From d1cbc6f371e2720fe4bf4975d8ad9c81a9f01351 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Fri, 30 Oct 2015 15:18:06 +0100
Subject: [PATCH 2/2] gdb/testsuite: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C cod
which is undefined by the C standard.

gdb/testsuite/ChangeLog:

        * lib/dwarf.exp (_note): Fix left shift of negative value.
        * gdb.trace/trace-condition.exp: Likewise.
---
 gdb/testsuite/gdb.trace/trace-condition.exp | 2 +-
 gdb/testsuite/lib/dwarf.exp                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index aec0401..46fa5ed 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -152,7 +152,7 @@ foreach trace_command { "trace" "ftrace" } {
     test_tracepoints $trace_command "21 * 2 == 42" 10
     test_tracepoints $trace_command "21 << 1 == 42" 10
     test_tracepoints $trace_command "42 >> 1 == 21" 10
-    test_tracepoints $trace_command "-21 << 1 == -42" 10
+    test_tracepoints $trace_command "-(21 << 1) == -42" 10
     test_tracepoints $trace_command "-42 >> 1 == -21" 10
     test_tracepoints $trace_command "(0xabababab & 0x0000ffff) == 0xabab" 10
     test_tracepoints $trace_command "(0xabababab | 0x0000ffff) == 0xababffff" 10
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 9716795..c87da87 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -1289,7 +1289,7 @@ namespace eval Dwarf {
 	_op .ascii [_quote $name]
 	# Alignment.
 	set align 2
-	set total [expr {($namelen + (1 << $align) - 1) & (-1 << $align)}]
+	set total [expr {($namelen + (1 << $align) - 1) & -(1 << $align)}]
 	for {set i $namelen} {$i < $total} {incr i} {
 	    _op .byte 0
 	}
-- 
2.3.0


  parent reply	other threads:[~2015-11-10 11:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 11:16 [PATCH 0/2] " Dominik Vogt
2015-11-10 11:17 ` [PATCH 1/2] " Dominik Vogt
2015-11-10 11:18 ` Dominik Vogt [this message]
2015-11-10 22:42 ` [PATCH 0/2] " Kevin Buettner
2015-11-11 17:23   ` Ulrich Weigand
2015-11-11 19:27     ` Kevin Buettner
2015-11-17  5:09       ` Kevin Buettner
2015-11-17 14:13         ` Pedro Alves
2015-11-17 17:33           ` Paul_Koning
2015-11-17 15:10 ` [PATCH 3/2] " Dominik Vogt
2015-11-17 17:49   ` Kevin Buettner
2015-11-30  8:54   ` Dominik Vogt
2015-12-06 14:17     ` [SIM patch] " Joel Brobecker
2015-12-15 13:15       ` Andreas Arnez

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=20151110111752.GF17214@linux.vnet.ibm.com \
    --to=vogt@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.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).