1 /* 2 bug-2628.c, fetchLitPair() overwrites live IY register 3 */ 4 5 #include <testfwk.h> 6 7 struct list { 8 struct list *next; 9 void *p; 10 }; 11 12 void *data; 13 static struct list *base; 14 15 static void add(struct list * e)16add(struct list *e) 17 { 18 struct list *l; 19 20 if(e->p != 0) { 21 for(l = base; l != 0; l = l->next) { 22 if(l == e) { 23 e->p = data; 24 return; 25 } 26 } 27 } 28 29 e->p = data; 30 } 31 32 void testBug(void)33testBug(void) 34 { 35 static int d = 1234; 36 struct list e; 37 volatile void *tmp; 38 39 data = &d; 40 base = 0; 41 42 add (&e); 43 44 tmp = e.p; 45 46 ASSERT(e.p == data); 47 } 48 49