Skip to content

Commit 97aa8cc

Browse files
authored
[clang][bytecode] Diagnose weak reads in final load (#109515)
They aren't allowed here either.
1 parent d7db094 commit 97aa8cc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ bool CheckFinalLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
620620
return false;
621621
if (!CheckTemporary(S, OpPC, Ptr, AK_Read))
622622
return false;
623+
if (!CheckWeak(S, OpPC, Ptr))
624+
return false;
623625
if (!CheckMutable(S, OpPC, Ptr))
624626
return false;
625627
return true;

clang/test/CodeGenCXX/weak-init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s
2+
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -emit-llvm %s -o - -fexperimental-new-constant-interpreter | FileCheck %s
23

34
extern const int W __attribute__((weak)) = 99;
45
const int S = 77;

0 commit comments

Comments
 (0)