* support/regression/tests/bug1712928.c: new, added
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4787
4a8a32a2-be11-0410-ad9d-
d568d2c75423
* src/z80/peeph-z80.def,
* src/z80/peeph.def: whole set of new rules by Philipp Krause with some
modifications, see patch 1700823
+ * src/mcs51/peep.c (): fixed bug 1712928
+ * support/regression/tests/bug1712928.c: new, added
2007-05-05 Borut Razem <borut.razem AT siol.net>
/*-----------------------------------------------------------------*/
/* isCallerSaveFunc - returns TRUE if it's a 'normal' function */
-/* call and it's a 'caller save' (not 'callee save') */
+/* call and it's a 'caller save' (not 'callee save' or 'naked') */
/*-----------------------------------------------------------------*/
static bool
isCallerSaveFunc (const lineNode *pl)
return FALSE;
if (FUNC_CALLEESAVES(OP_SYM_TYPE(IC_LEFT(pl->ic))))
return FALSE;
+ if (FUNC_ISNAKED(OP_SYM_TYPE(IC_LEFT(pl->ic))))
+ return FALSE;
return TRUE;
}
--- /dev/null
+/*
+ bug1712928.c
+*/
+
+#include <testfwk.h>
+
+#if defined (SDCC_mcs51)
+unsigned char NakedFunc(void) __naked
+{
+ __asm
+ mov dpl,#0x01
+ ret
+ __endasm;
+}
+#endif
+
+void
+testBug(void)
+{
+#if defined (SDCC_mcs51)
+ unsigned char hsum, sum;
+
+ hsum = NakedFunc();
+ sum = NakedFunc();
+ sum += hsum;
+
+ ASSERT(sum == 2);
+#endif
+}