diff options
| author | Duncan Sands <baldrick@free.fr> | 2009-03-20 21:53:29 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2009-03-20 21:53:29 +0000 |
| commit | a09e0afe748ce5d14ceb7d948a2660f6360c845e (patch) | |
| tree | b99067907ba0148462ee35f858a0d5a65b175131 /llvm/test/FrontendC | |
| parent | 692c6e3729149e44ba688a173c42b99c66821aa1 (diff) | |
| download | bcm5719-llvm-a09e0afe748ce5d14ceb7d948a2660f6360c845e.tar.gz bcm5719-llvm-a09e0afe748ce5d14ceb7d948a2660f6360c845e.zip | |
Don't load values out of global constants with weak
linkage: the value may be replaced with something
different at link time. (Frontends that want to
allow values to be loaded out of weak constants can
give their constants weak_odr linkage).
llvm-svn: 67407
Diffstat (limited to 'llvm/test/FrontendC')
| -rw-r--r-- | llvm/test/FrontendC/weak_constant.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/FrontendC/weak_constant.c b/llvm/test/FrontendC/weak_constant.c new file mode 100644 index 00000000000..53379482cb4 --- /dev/null +++ b/llvm/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(); +} |

