From: MaartenBrock Date: Thu, 20 Mar 2008 19:38:30 +0000 (+0000) Subject: * src/SDCCsymt.c (comparePtrType): fixed bug 1921073 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3e5db37d509d6ad71df792e58769955068a37266;p=fw%2Fsdcc * src/SDCCsymt.c (comparePtrType): fixed bug 1921073 * support/regression/tests/bug1921073.c: new, added git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5109 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index f3d1602d..08d5d6d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-20 Maarten Brock + + * src/SDCCsymt.c (comparePtrType): fixed bug 1921073 + * support/regression/tests/bug1921073.c: new, added + 2008-03-17 Philipp Klaus Krause * src/z80/SDCCpeeph.c.c (callFuncByName): diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index d422daf5..95228673 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -2050,7 +2050,7 @@ comparePtrType (sym_link * dest, sym_link * src, bool bMustCast) int res; if (IS_VOID (src->next) && IS_VOID (dest->next)) - return 1; + return bMustCast ? -1 : 1; if ((IS_VOID (src->next) && !IS_VOID (dest->next)) || (!IS_VOID (src->next) && IS_VOID (dest->next)) ) return -1; diff --git a/support/regression/tests/bug1921073.c b/support/regression/tests/bug1921073.c new file mode 100644 index 00000000..4caa1229 --- /dev/null +++ b/support/regression/tests/bug1921073.c @@ -0,0 +1,31 @@ +/* + bug 1921073 +*/ + +#include + +void f1(char c, const void * p) +{ + unsigned long v = (unsigned long)p; + c; + v; +#if defined(SDCC_mcs51) + ASSERT((unsigned char)(v>>16)==0x80); +#endif +} + +void f2(const void * p) +{ + unsigned long v = (unsigned long)p; + v; +#if defined(SDCC_mcs51) + ASSERT((unsigned char)(v>>16)==0x80); +#endif +} + +void +testBug(void) +{ + f1(5, (code void *)0x1234); + f2((code void *)0x1234); +}