Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-3385.c
blob5b3936d36bc0e287e79ca55610064ea5b6b51766
1 /* bug-3385.c
2 A bug in an stm8 peephole optimizer rule resulting in wrong code..
3 */
5 #include <testfwk.h>
7 typedef struct list_node_t {
8 struct list_node_t* next;
9 } list_node_t;
11 typedef struct list_t {
12 list_node_t head;
13 } list_t;
15 typedef struct {
16 int x;
17 list_t list;
18 } event_t;
20 void event_init(event_t* self)
22 self->list.head.next = &self->list.head;
25 void testBug(void)
27 #if !defined(__SDCC_hc08) && !defined(__SDCC_s08) && !defined(__SDCC_mos6502) && !defined(__SDCC_mos65c02) // Bug #3386
28 event_t e;
29 event_init (&e);
30 ASSERT (e.list.head.next == &e.list.head);
31 #endif