In the following code the function 'fun' sets 'x' to the value of 'norm' which is NOT properly initialised.
In the presence of this bug the printed value of 'x' depends on whether 'HELLO!' is printed on screen or not (by commenting line 16). Does anybody know why?
Because you are using uninitialized variable norm which is undefined behavior. That means anything can happen.
As stack memory is constantly repurposed, execution of other code will change memory, then either uninitialized variables would be placed it this memory, or UB avoidane compiler optimisations will work or something else.