Skip to content

Commit d85a1ad

Browse files
committed
mkCast: add ad-hoc exception for bitfields
1 parent 75924c7 commit d85a1ad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

py/dml/ctree.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,6 +4825,11 @@ def mkCast(site, expr, new_type):
48254825
# 1.2 integer expressions often lie about their actual type,
48264826
# and require a "redundant" cast! Why yes, this IS horrid!
48274827
return Cast(site, expr, new_type)
4828+
if real.is_int and real.members is not None:
4829+
# An integer type can be compatible with a bitfields without being
4830+
# equal to it, as DMLC will treat bitfields differently. Leverage
4831+
# Cast in this case
4832+
return Cast(site, expr, new_type)
48284833
return mkRValue(expr)
48294834
if isinstance(real, (TStruct, TExternStruct, TVector, TTraitList)):
48304835
raise ECAST(site, expr, new_type)

0 commit comments

Comments
 (0)