Skip to content

Commit

Permalink
[clang][bytecode] Diagnose weak reads in final load (#109515)
Browse files Browse the repository at this point in the history
They aren't allowed here either.
  • Loading branch information
tbaederr committed Sep 21, 2024
1 parent d7db094 commit 97aa8cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/AST/ByteCode/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ bool CheckFinalLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
return false;
if (!CheckTemporary(S, OpPC, Ptr, AK_Read))
return false;
if (!CheckWeak(S, OpPC, Ptr))
return false;
if (!CheckMutable(S, OpPC, Ptr))
return false;
return true;
Expand Down
1 change: 1 addition & 0 deletions clang/test/CodeGenCXX/weak-init.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -emit-llvm %s -o - -fexperimental-new-constant-interpreter | FileCheck %s

extern const int W __attribute__((weak)) = 99;
const int S = 77;
Expand Down

0 comments on commit 97aa8cc

Please sign in to comment.