This is a slippery issue which has bitten me before.
You'll never guess what this does in some recent versions of GCC :)

    int* x;
    if (1) {
        int i = 1;
        x = &i;
    }
    if (1) {
        int j = 2;
    }
    println("x=%d", *x);

Your code looked like it would be ok but I wanted to make it "technically correct" because this one has scarred me before.