From 6.3.2.1 (emphasis mine)
If the lvalue designates an object of automatic storage duration that could have been declared with the register storage class (never had its address taken), and that object is uninitialized (not declared with an initializer and no assignment to it has been performed prior to use), the behavior is undefined.
That means, that if the automatic object could not be declared with the register storage class (have it's address taken):
int x;
printf("just a dummy pointer print %p", &x); //taking the address to break 6.3.2.1 UB condition
if (x == 2)
{
print("x uninitialized value: %d", x);
}
Than according to 6.3.2.1 there is no undefined behavior in if (x == 2)
where I use the value of the uninitialized object.
If that is true, and there is no UB here, than what is the defined behaviour? what should I expect in x
according to the standard?