summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3385.c
blob: 5b3936d36bc0e287e79ca55610064ea5b6b51766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* bug-3385.c
   A bug in an stm8 peephole optimizer rule resulting in wrong code..
 */

#include <testfwk.h>

typedef struct list_node_t {
  struct list_node_t* next;
} list_node_t;

typedef struct list_t {
  list_node_t head;
} list_t;

typedef struct {
  int x;
  list_t list;
} event_t;

void event_init(event_t* self)
{
  self->list.head.next = &self->list.head;
}

void testBug(void)
{
#if !defined(__SDCC_hc08) && !defined(__SDCC_s08) && !defined(__SDCC_mos6502) && !defined(__SDCC_mos65c02) // Bug #3386
  event_t e;
  event_init (&e);
  ASSERT (e.list.head.next == &e.list.head);
#endif
}