This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb/testsuite: Fix left shift of negative value.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=340c283058287c3c1307f0a8d44239e802d6c8c5

commit 340c283058287c3c1307f0a8d44239e802d6c8c5
Author: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date:   Tue Nov 17 10:56:32 2015 +0100

    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.

Diff:
---
 gdb/testsuite/ChangeLog                     | 5 +++++
 gdb/testsuite/gdb.trace/trace-condition.exp | 2 +-
 gdb/testsuite/lib/dwarf.exp                 | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 44ebf44..14c4b41 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-17  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+	* lib/dwarf.exp (_note): Fix left shift of negative value.
+	* gdb.trace/trace-condition.exp: Likewise.
+
 2015-11-13  Yao Qi  <yao.qi@linaro.org>
 
 	* gdb.base/call-sc.exp (test_scalar_returns): Remove the
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index 15efb68..fb1a568 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -142,7 +142,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
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]