From 813e29b286e73dc7e4d3a40eddb9aff2988689ad Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 23 Aug 2023 16:13:58 +0000 Subject: [PATCH] Fix [84a5355235] (not visible in 8.6, but meant to be forwared to 8.7) --- generic/tclExecute.c | 16 ++++++++-------- tests/expr.test | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 44ace68afdd..33730793d16 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -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 - * 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. @@ -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 @@ -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; } diff --git a/tests/expr.test b/tests/expr.test index 01f832edea2..2a0c7ed0ea2 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -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