diff options
Diffstat (limited to 'test/CodeGen/weak_constant.c')
-rw-r--r-- | test/CodeGen/weak_constant.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGen/weak_constant.c b/test/CodeGen/weak_constant.c new file mode 100644 index 000000000000..726d2ef122e1 --- /dev/null +++ b/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(); +} |