Skip to content

Commit 0be3915

Browse files
committed
[clang][Interp] Protect stores against dummy pointers
1 parent d9c20e4 commit 0be3915

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

clang/lib/AST/Interp/Interp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
399399
bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
400400
if (!CheckLive(S, OpPC, Ptr, AK_Assign))
401401
return false;
402+
if (!CheckDummy(S, OpPC, Ptr))
403+
return false;
402404
if (!CheckExtern(S, OpPC, Ptr))
403405
return false;
404406
if (!CheckRange(S, OpPC, Ptr, AK_Assign))

clang/test/Sema/warn-cast-qual.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -Wcast-qual -verify %s
2-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -x c++ -fsyntax-only -Wcast-qual -verify %s
2+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -Wcast-qual -verify %s -fexperimental-new-constant-interpreter
3+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -x c++ -fsyntax-only -Wcast-qual -verify %s -fexperimental-new-constant-interpreter
34

45
#include <stdint.h>
56

0 commit comments

Comments
 (0)