perfectly if optimization is off.
C source:
Code: Select all
#include "stdio.h"
typedef struct poly {
struct poly *next;
int v0;
int v1;
int v2;
} poly;
int main(int argc, char **argv)
{
poly *span, *active;
span = (poly *)&active;
span->next = 0;
while(span->next) {
fprintf(stderr,"will not print but needed for bug\n");
span = span->next;
}
span->next = (poly *)20;
fprintf(stderr,"active value is %d\n", (int)span->next);
fprintf(stderr,"active value is %d\n", (int)active);
}
Code: Select all
all:
cc bug.c -o bug
cc bug.c -o bug02 -O2
cc bug.c -o bug03 -O3
