@@ -1184,6 +1184,10 @@ static bool interp__builtin_ia32_bzhi(InterpState &S, CodePtr OpPC,
11841184 const InterpFrame *Frame,
11851185 const Function *Func,
11861186 const CallExpr *Call) {
1187+ QualType CallType = Call->getType ();
1188+ if (!CallType->isIntegerType ())
1189+ return false ;
1190+
11871191 PrimType ValT = *S.Ctx .classify (Call->getArg (0 ));
11881192 PrimType IndexT = *S.Ctx .classify (Call->getArg (1 ));
11891193
@@ -1197,7 +1201,7 @@ static bool interp__builtin_ia32_bzhi(InterpState &S, CodePtr OpPC,
11971201 if (Index < BitWidth)
11981202 Val.clearHighBits (BitWidth - Index);
11991203
1200- pushInteger (S, Val, Call-> getType () );
1204+ pushInteger (S, Val, CallType );
12011205 return true ;
12021206}
12031207
@@ -1210,7 +1214,7 @@ static bool interp__builtin_ia32_lzcnt(InterpState &S, CodePtr OpPC,
12101214 return false ;
12111215
12121216 APSInt Val = peekToAPSInt (S.Stk , *S.Ctx .classify (Call->getArg (0 )));
1213- pushInteger (S, Val.countLeadingZeros (), Call-> getType () );
1217+ pushInteger (S, Val.countLeadingZeros (), CallType );
12141218 return true ;
12151219}
12161220
@@ -1223,7 +1227,7 @@ static bool interp__builtin_ia32_tzcnt(InterpState &S, CodePtr OpPC,
12231227 return false ;
12241228
12251229 APSInt Val = peekToAPSInt (S.Stk , *S.Ctx .classify (Call->getArg (0 )));
1226- pushInteger (S, Val.countTrailingZeros (), Call-> getType () );
1230+ pushInteger (S, Val.countTrailingZeros (), CallType );
12271231 return true ;
12281232}
12291233
0 commit comments