Skip to content

Commit e962c53

Browse files
tbaederrDebadri Basak
authored andcommitted
[clang][bytecode] Check builtin carryops for non-block out pointers (llvm#165512)
Fixes llvm#165372
1 parent 5d12282 commit e962c53

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static bool interp__builtin_carryop(InterpState &S, CodePtr OpPC,
859859
APSInt RHS = popToAPSInt(S.Stk, RHST);
860860
APSInt LHS = popToAPSInt(S.Stk, LHST);
861861

862-
if (CarryOutPtr.isDummy())
862+
if (CarryOutPtr.isDummy() || !CarryOutPtr.isBlockPointer())
863863
return false;
864864

865865
APSInt CarryOut;

clang/test/AST/ByteCode/builtin-functions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,8 @@ namespace InitParam {
18561856

18571857
#endif
18581858

1859-
namespace SAddOverflowInt {
1859+
namespace NonBlockPointerStore {
18601860
int a;
18611861
void foo(void) { a *= __builtin_sadd_overflow(1, 2, 0); }
1862+
void foo2(void) { a *= __builtin_addc(1, 2, 0, 0); }
18621863
}

0 commit comments

Comments
 (0)