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.
This commit is contained in:
Sei Lisa 2018-07-25 15:59:04 +02:00
parent 21cecc46f8
commit 960cbfaa09

View file

@ -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