From 6a3a8ae8ff86616bd067ce4fdc775550903afab9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 16 Dec 2021 21:02:15 +0000 Subject: Suggested fix for [b0f84119c8]: TEBCresume(): undefined behavior for INST_LSHIFT --- generic/tclExecute.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 8963472..7e014d4 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -6379,10 +6379,10 @@ TEBCresume( * Handle shifts within the native long range. */ - if ((size_t) shift < CHAR_BIT*sizeof(long) && (l1 != 0) + if (((size_t) shift < CHAR_BIT*sizeof(long)) && !((l1>0 ? l1 : ~l1) & - -(1L<<(CHAR_BIT*sizeof(long) - 1 - shift)))) { - lResult = l1 << shift; + -(1UL<<(CHAR_BIT*sizeof(long) - 1 - shift)))) { + lResult = (unsigned long)l1 << shift; goto longResultOfArithmetic; } } -- cgit v0.12