To me this seems like a problem with pushing to and popping from stack during wait.
wait() actively halts the function in execution and any local variables are put to the stack, so their values are not lost.
This way other functions can run during the wait() command.
However when the execution of the function is continued afterwards, the local variables are popped from the stack and may now be at a different address, making the pointer invalid.

justsid possibly can explain in a more correct and more technical way, but this is what I assume is happening.

In short: Might be a bug with the compiler (or simply not supported, and I'm not even sure if it can be done so easily out of the box)...
This is also important to know when calling functions with local pointers as parameters. Once the called function uses wait() the pointers will screw up. I think this is even mentioned somewhere in the manual.

Lesson learned: don't write code like this. wink

Code:
#include <acknex.h>
#include <default.c>

function main()
{
 // 'min' shall point on the value of the smallest variable
 var x = 6,y = 5;
 var* min=NULL;
 
 if(x < y)
    min = &x;
 else
    min = &y;
 
 // output 'min'
printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) );
 
 // determine, whether 'min' is bigger than 4
 if (*min > 4.0)
    printf(">4");
 else
    printf("<=4");
 printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) ); // 5 -> ok  
 y+=5;
 printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) ); // 10 -> ok
 printf("ptr min 0x%x\nadr y 0x%x", (int)min, (int)&y);
 wait(1);
 printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) ); // rubish (often 0) -> wtf !?
 printf("ptr min 0x%x\nadr y 0x%x", (int)min, (int)&y);
 
}