Variable initialization

In code generation do we initialize variables that are not initialized to 0 or do we print an error if it’s uninitialized and used?

for example:

int x;
int f; 
f = x + 1;

what should we do in this case?

Well, uninitialized variables are undefined behaviour. That means it’s up to you.

The common way to do this would be to just allocate some space on the stack and not do anything with the data stored there. If an uninitialized variable is read, you can actually read the value of a variable that was previously on the stack in the same location.