aboutsummaryrefslogtreecommitdiffstats
path: root/test/FrontendC/weak_constant.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/FrontendC/weak_constant.c')
-rw-r--r--test/FrontendC/weak_constant.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/FrontendC/weak_constant.c b/test/FrontendC/weak_constant.c
new file mode 100644
index 0000000..5337948
--- /dev/null
+++ b/test/FrontendC/weak_constant.c
@@ -0,0 +1,12 @@
+// RUN: %llvmgcc -S %s -O1 -o - | grep {ret.*123}
+// Check for bug compatibility with gcc.
+
+const int x __attribute((weak)) = 123;
+
+int* f(void) {
+ return &x;
+}
+
+int g(void) {
+ return *f();
+}