1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-03 10:07:02 +00:00
cc65/test/val/bug1438.c

36 lines
563 B
C
Raw Normal View History

2021-03-27 14:11:47 +00:00
2022-04-17 14:07:52 +00:00
/* Issue #1438 fix #1439 - crash in cc65, related to delayed post-counting
2021-03-27 14:11:47 +00:00
this is an odd issue, the compile would crash *sometimes*, perhaps in one
of ten compilation runs.
*/
2021-03-27 14:13:32 +00:00
/* #define __fastcall__ */
2021-03-27 14:11:47 +00:00
unsigned short a[10] = {0,1,2,3,4,5,6,7,8,9};
unsigned short __fastcall__ func2(void)
{
return 42;
}
void func1(unsigned short *wp)
{
*wp++ = func2();
}
int main(void)
{
func1(&a[3]);
if (a[2] != 2) {
return 1;
}
if (a[3] != 42) {
return 1;
}
if (a[4] != 4) {
return 1;
}
return 0;
}