================
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++14 -emit-llvm -o - 
%s | FileCheck %s
+
+int b = 10;
+const int f = (__builtin_assume_dereferenceable((char*)&b + 1, 3), 12);
+int use_f = f;
+
+constexpr int g = 20;
+const int h = (__builtin_assume_dereferenceable((char*)&g + 1, 2), 42);
+int use_h = h;
+
+constexpr char arr[] = "hello";
+constexpr const char* ptr = arr + 1;
+constexpr int fully_constexpr() {
+  __builtin_assume_dereferenceable(ptr, 2);
+  return 100;
+}
+constexpr int i = fully_constexpr();
+int use_i = i;
+
+void test_integral_ptr() {
+  __builtin_assume_dereferenceable((int*)0x1234, 4);
----------------
tbaederr wrote:

I think this example is incorrect, sorry. There are no readable bytes after 
that address.

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

Reply via email to