@@ -1169,8 +1169,7 @@ static bool interp__builtin_is_aligned_up_down(InterpState &S, CodePtr OpPC,
1169
1169
const InterpFrame *Frame,
1170
1170
const CallExpr *Call,
1171
1171
unsigned BuiltinOp) {
1172
- PrimType AlignmentT = *S.Ctx .classify (Call->getArg (1 ));
1173
- const APSInt &Alignment = popToAPSInt (S.Stk , AlignmentT);
1172
+ const APSInt &Alignment = popToAPSInt (S, Call->getArg (1 ));
1174
1173
1175
1174
if (Alignment < 0 || !Alignment.isPowerOf2 ()) {
1176
1175
S.FFDiag (Call, diag::note_constexpr_invalid_alignment) << Alignment;
@@ -1184,8 +1183,7 @@ static bool interp__builtin_is_aligned_up_down(InterpState &S, CodePtr OpPC,
1184
1183
return false ;
1185
1184
}
1186
1185
1187
- // The first parameter is either an integer or a pointer (but not a function
1188
- // pointer).
1186
+ // The first parameter is either an integer or a pointer.
1189
1187
PrimType FirstArgT = *S.Ctx .classify (Call->getArg (0 ));
1190
1188
1191
1189
if (isIntegralType (FirstArgT)) {
@@ -1204,12 +1202,12 @@ static bool interp__builtin_is_aligned_up_down(InterpState &S, CodePtr OpPC,
1204
1202
}
1205
1203
return true ;
1206
1204
}
1207
-
1208
1205
assert (FirstArgT == PT_Ptr);
1209
1206
const Pointer &Ptr = S.Stk .pop <Pointer>();
1207
+ if (!Ptr.isBlockPointer ())
1208
+ return false ;
1210
1209
1211
- unsigned PtrOffset = Ptr.getByteOffset ();
1212
- PtrOffset = Ptr.getIndex ();
1210
+ unsigned PtrOffset = Ptr.getIndex ();
1213
1211
CharUnits BaseAlignment =
1214
1212
S.getASTContext ().getDeclAlign (Ptr.getDeclDesc ()->asValueDecl ());
1215
1213
CharUnits PtrAlign =
0 commit comments