[LLVMdev] LLVM 2.4 problem? (resend)

Duncan Sands baldrick at free.fr
Wed Oct 15 03:28:23 PDT 2008


> With this program llvm-gcc -O2 optimizes test2 away even though it's  
> address is taken in program (gcc-4.2 does not, neither does llvm-gcc  
> with -O or -O0):

I can confirm that test2 is replaced with test1 everywhere using llvm-gcc
from svn head.

> #include <stdio.h>
> 
> static const char test1 = 'x';
> static const char test2 = 'x';
> 
> int main(int argc, char **argv)
> {
>    printf("%p\n", &test1);
>    printf("%p\n", &test2);
> 
>    return 0;
> }

Ciao,

Duncan.



More information about the llvm-dev mailing list