summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/weak_constant.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen/weak_constant.c')
-rw-r--r--clang/test/CodeGen/weak_constant.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGen/weak_constant.c b/clang/test/CodeGen/weak_constant.c
new file mode 100644
index 0000000..726d2ef
--- /dev/null
+++ b/clang/test/CodeGen/weak_constant.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -w -emit-llvm %s -O1 -o - | FileCheck %s
+// Check for bug compatibility with gcc.
+
+const int x __attribute((weak)) = 123;
+
+int* f(void) {
+ return &x;
+}
+
+int g(void) {
+ // CHECK: ret i32 123
+ return *f();
+}