[LLVMdev] Uninitialized variable - question

Dmitri Gribenko gribozavr at gmail.com
Sat Nov 24 04:03:27 PST 2012


On Sat, Nov 24, 2012 at 1:57 PM, Patrik Hägglund H
<patrik.h.hagglund at ericsson.com> wrote:
> I think that the relevant part in C11 is section 6.2.6.1, which tells you that accessing a trap representation, _other than using a char type_, is undefined. Objects of automatic storage, which don't have an initializer are of indeterminate value, which either is an unspecified value or a trap representation.
>
>> What I found is that with -O2:
>> LLVM (trunk) prints both "a" and "b"
>
>  I can't reproduce this with r168538. I only get "a".

I can reproduce if 'noinline' is dropped.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the llvm-dev mailing list