From 960cbfaa091908bb83622a010637a69d12f7fbb6 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 25 Jul 2018 15:59:04 +0200 Subject: [PATCH] Fix "Value of unknown type" on bit shift optimization When converting x << constant to a product, we neglected to truncate the converted constant to S32. Per bug report by Tonaie Resident. --- lslopt/lslfoldconst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 6eef4ed..78fdb26 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -1041,7 +1041,7 @@ class foldconst(object): # we have {<<, something, {CONST n}} # we transform it into {*, something, {CONST n}} nt = node.nt = '*' - child[1].value = 1 << (child[1].value & 31) + child[1].value = lslfuncs.S32(1 << (child[1].value & 31)) # Fall through to optimize product