xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/weak_constant.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -w -emit-llvm %s -O1 -o - | FileCheck %s
2*f4a2713aSLionel Sambuc // Check for bug compatibility with gcc.
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc const int x __attribute((weak)) = 123;
5*f4a2713aSLionel Sambuc 
f(void)6*f4a2713aSLionel Sambuc int* f(void) {
7*f4a2713aSLionel Sambuc   return &x;
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc 
g(void)10*f4a2713aSLionel Sambuc int g(void) {
11*f4a2713aSLionel Sambuc   // CHECK: ret i32 123
12*f4a2713aSLionel Sambuc   return *f();
13*f4a2713aSLionel Sambuc }
14