Skip to content

Commit

Permalink
Fix [84a5355235] (not visible in 8.6, but meant to be forwared to 8.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Aug 23, 2023
1 parent ea37e7d commit 813e29b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions generic/tclExecute.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* This file contains procedures that execute byte-compiled Tcl commands.
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
* Copyright (c) 2002-2010 by Miguel Sofer.
* Copyright (c) 2005-2007 by Donal K. Fellows.
* Copyright (c) 1998-2000 Scriptics Corporation.
* Copyright (c) 2001 Kevin B. Kenny. All rights reserved.
* Copyright (c) 2002-2010 Miguel Sofer.
* Copyright (c) 2005-2007 Donal K. Fellows.
* Copyright (c) 2007 Daniel A. Steffen <[email protected]>
* Copyright (c) 2006-2008 by Joe Mistachkin. All rights reserved.
* Copyright (c) 2006-2008 Joe Mistachkin. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
Expand Down Expand Up @@ -6314,7 +6314,7 @@ TEBCresume(
* Quickly force large right shifts to 0 or -1.
*/

if (l2 >= (long)(CHAR_BIT*sizeof(long))) {
if (l2 >= (long)(CHAR_BIT*sizeof(l1))) {
/*
* We assume that INT_MAX is much larger than the
* number of bits in a long. This is a pretty safe
Expand Down Expand Up @@ -6382,9 +6382,9 @@ TEBCresume(
* Handle shifts within the native long range.
*/

if (((size_t) shift < CHAR_BIT*sizeof(long))
if (((size_t) shift < CHAR_BIT*sizeof(l1))
&& !((l1>0 ? l1 : ~l1) &
-(1UL<<(CHAR_BIT*sizeof(long) - 1 - shift)))) {
-(1UL<<(CHAR_BIT*sizeof(l1) - 1 - shift)))) {
lResult = (unsigned long)l1 << shift;
goto longResultOfArithmetic;
}
Expand Down
1 change: 1 addition & 0 deletions tests/expr.test
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@ test expr-24.8 {expr edge cases; shifting} {expr wide(10<<63)} 0
test expr-24.9 {expr edge cases; shifting} {expr 5>>32} 0

test expr-24.10 {INST_LSHIFT: Bug 1567222} {expr 500000000000000<<28} 134217728000000000000000
test expr-24.11 {INST_LSHIFT: Bug 84a5355235} {expr -549755813888>>32} -128

# List membership tests
test expr-25.1 {'in' operator} {expr {"a" in "a b c"}} 1
Expand Down

0 comments on commit 813e29b

Please sign in to comment.