[LLVMdev] LLVM 2.4 problem? (resend)
Tatu Vaajalahti
tatuvaaj at mac.com
Wed Oct 15 03:47:51 PDT 2008
On 15.10.2008, at 13.28, Duncan Sands wrote:
>> 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 guess this is a bit academic case since you can easily circumvent
this by marking variables as "static const volatile" or by just not
initializing the variables to the same value (or leaving the
initialization out).
Just wanted to report the mismatch between gcc and llvm-gcc :)
> 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.
---
Tatu Vaajalahti
Tampere, Finland
More information about the llvm-dev
mailing list