mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 08:27:39 +00:00
b6093e0728
Storing a variable into a dereference pointer (*p = x) is not marking the variable as used (due to a mistake while converting to Ruamoko statement format) resulting in assignments to that variable being dropped due to it being a dead assignment as the assignment to the variable and the storing need to be in separate basic blocks (thus the call in the test, though an if would have worked, I think) for the bug to trigger.
29 lines
289 B
R
29 lines
289 B
R
void printf (string fmt, ...) = #0;
|
|
int getval(void)
|
|
{
|
|
return 42;
|
|
}
|
|
|
|
void magic (void)
|
|
{
|
|
}
|
|
|
|
void storeval (int *p)
|
|
{
|
|
int x = getval ();
|
|
magic ();
|
|
*p = x;
|
|
}
|
|
|
|
int val;
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
storeval (&val);
|
|
if (val != 42) {
|
|
printf ("val is dead: %d\n", val);
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|