llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/237146.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+3) 
- (modified) clang/test/AST/ByteCode/c2y.c (+7-2) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 8fefaa97c9f63..84edb0bce4a10 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -2237,6 +2237,9 @@ static bool interp__builtin_load8(InterpState &S, CodePtr 
OpPC,
   if (!isReadable(Ptr) && !Ptr.isOnePastEnd())
     return false;
 
+  if (!Ptr.isReadablePointerType())
+    return false;
+
   if (IsAligned) {
     CharUnits RequiredAlign =
         S.getASTContext().getTypeAlignInChars(Call->getType());
diff --git a/clang/test/AST/ByteCode/c2y.c b/clang/test/AST/ByteCode/c2y.c
index bbb163ab83833..7f5f0bc972fa1 100644
--- a/clang/test/AST/ByteCode/c2y.c
+++ b/clang/test/AST/ByteCode/c2y.c
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux %s -std=c2y -verify=expected,both 
-fexperimental-new-constant-interpreter
 // RUN: %clang_cc1 -triple x86_64-linux %s -std=c2y -verify=ref,both
 
-// both-no-diagnostics
-
 struct S {
   int x;
   char c;
@@ -21,3 +19,10 @@ int quorble() {
   const struct S *s_ptr = (struct S *)((struct T *)buffer)->buffer;
   return s_ptr->x;
 }
+
+
+__UINT_LEAST32_TYPE__ stdc_load8_aligned_leu32(const unsigned char *);
+alignas(8) unsigned char buf[4] = {};
+__UINT_LEAST32_TYPE__ fail_load8 = stdc_load8_aligned_leu32(buf + 4); // 
both-error {{not a compile-time constant}}
+
+

``````````

</details>


https://github.com/llvm/llvm-project/pull/237146
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to