From b8c9c88e87db9a9ef680afa7dec0a320c42ccca6 Mon Sep 17 00:00:00 2001 From: epetrich Date: Wed, 26 Nov 2003 07:33:32 +0000 Subject: [PATCH] * src/SDCC.y (pointer): fixed bug #846006 * support/Util/SDCCerr.c: made W_PTR_TYPE_INVALID message clearer * src/SDCCast.c (decorateType): fixed bug #846009 * src/ds390/peeph.def, * src/ds390/gen.c (genAnd, genOr), * src/mcs51/peeph.def, * src/mcs51/gen.c (genAnd, genOr): fixed bug #846777 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3027 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 10 ++++++++++ src/SDCC.y | 12 ++++++++---- src/SDCCast.c | 6 ++++-- src/ds390/gen.c | 6 ++++++ src/ds390/peeph.def | 14 ++++++++++++++ src/mcs51/gen.c | 6 ++++++ src/mcs51/peeph.def | 13 +++++++++++++ support/Util/SDCCerr.c | 2 +- 8 files changed, 62 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74a856ca..e9968daa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-11-26 Erik Petrich + + * src/SDCC.y (pointer): fixed bug #846006 + * support/Util/SDCCerr.c: made W_PTR_TYPE_INVALID message clearer + * src/SDCCast.c (decorateType): fixed bug #846009 + * src/ds390/peeph.def, + * src/ds390/gen.c (genAnd, genOr), + * src/mcs51/peeph.def, + * src/mcs51/gen.c (genAnd, genOr): fixed bug #846777 + 2003-11-25 Erik Petrich Fixed several common-sub-expression bugs (#772861, #768380, & #755323) diff --git a/src/SDCC.y b/src/SDCC.y index fa781d1d..aaee44ac 100644 --- a/src/SDCC.y +++ b/src/SDCC.y @@ -1042,10 +1042,14 @@ pointer : unqualified_pointer { $$ = $1 ;} | unqualified_pointer type_specifier_list { - $$ = $1 ; - DCL_TSPEC($1) = $2; - DCL_PTR_CONST($1) = SPEC_CONST($2); - DCL_PTR_VOLATILE($1) = SPEC_VOLATILE($2); + $$ = $1 ; + if (IS_SPEC($2)) { + DCL_TSPEC($1) = $2; + DCL_PTR_CONST($1) = SPEC_CONST($2); + DCL_PTR_VOLATILE($1) = SPEC_VOLATILE($2); + } + else + werror (W_PTR_TYPE_INVALID); } | unqualified_pointer pointer { diff --git a/src/SDCCast.c b/src/SDCCast.c index a788e69a..fcf18e22 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -2383,7 +2383,7 @@ decorateType (ast * tree) goto errorTreeReturn; } - if (SPEC_SCLS (tree->left->etype) == S_REGISTER) + if (LETYPE(tree) && SPEC_SCLS (tree->left->etype) == S_REGISTER) { werror (E_ILLEGAL_ADDR, "address of register variable"); goto errorTreeReturn; @@ -2406,7 +2406,9 @@ decorateType (ast * tree) werror (E_LVALUE_REQUIRED, "address of"); goto errorTreeReturn; } - if (SPEC_SCLS (tree->left->etype) == S_CODE) + if (!LETYPE (tree)) + DCL_TYPE (p) = POINTER; + else if (SPEC_SCLS (tree->left->etype) == S_CODE) DCL_TYPE (p) = CPOINTER; else if (SPEC_SCLS (tree->left->etype) == S_XDATA) DCL_TYPE (p) = FPOINTER; diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 8a55bcd4..b75d20b3 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -6387,6 +6387,8 @@ genAnd (iCode * ic, iCode * ifx) { if (ifx) jmpTrueOrFalse (ifx, tlbl); + else + emitcode ("", "!tlabeldef", tlbl->key + 100); goto release; } } @@ -6477,6 +6479,8 @@ genAnd (iCode * ic, iCode * ifx) } else if (ifx) jmpTrueOrFalse (ifx, tlbl); + else + emitcode ("", "!tlabeldef", tlbl->key + 100); } else { @@ -6795,6 +6799,8 @@ genOr (iCode * ic, iCode * ifx) } else if (ifx) jmpTrueOrFalse (ifx, tlbl); + else + emitcode ("", "!tlabeldef", tlbl->key + 100); } else { diff --git a/src/ds390/peeph.def b/src/ds390/peeph.def index be3ff93a..7ffbf710 100644 --- a/src/ds390/peeph.def +++ b/src/ds390/peeph.def @@ -2693,3 +2693,17 @@ replace { jz %4 %1: } if labelRefCount %1 1 + +replace { + jnz %1 +%1: +} by { + ; Peephole 243a jump optimization +} if labelRefCount %1 1 + +replace { + jz %1 +%1: +} by { + ; Peephole 243b jump optimization +} if labelRefCount %1 1 diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index c6b24c9b..8cad6c3c 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -4922,6 +4922,8 @@ genAnd (iCode * ic, iCode * ifx) { if (ifx) jmpTrueOrFalse (ifx, tlbl); + else + emitcode ("", "%05d$:", tlbl->key + 100); goto release; } } @@ -5012,6 +5014,8 @@ genAnd (iCode * ic, iCode * ifx) } else if (ifx) jmpTrueOrFalse (ifx, tlbl); + else + emitcode ("", "%05d$:", tlbl->key + 100); } else { @@ -5298,6 +5302,8 @@ genOr (iCode * ic, iCode * ifx) } else if (ifx) jmpTrueOrFalse (ifx, tlbl); + else + emitcode ("", "%05d$:", tlbl->key + 100); } else for (; (size--); offset++) diff --git a/src/mcs51/peeph.def b/src/mcs51/peeph.def index 518dd796..f3b8f704 100644 --- a/src/mcs51/peeph.def +++ b/src/mcs51/peeph.def @@ -3055,3 +3055,16 @@ replace { movx @dptr,a } +replace { + jnz %1 +%1: +} by { + ; Peephole 249a jump optimization +} if labelRefCount %1 1 + +replace { + jz %1 +%1: +} by { + ; Peephole 249b jump optimization +} if labelRefCount %1 1 diff --git a/support/Util/SDCCerr.c b/support/Util/SDCCerr.c index 0770abd4..04309fad 100644 --- a/support/Util/SDCCerr.c +++ b/support/Util/SDCCerr.c @@ -276,7 +276,7 @@ struct { W_CONTROL_FLOW, ERROR_LEVEL_PEDANTIC, "conditional flow changed by optimizer '%s(%d)':so said EVELYN the modified DOG" }, { W_PTR_TYPE_INVALID, ERROR_LEVEL_WARNING, - "invalid type specifier for pointer type specifier ignored" }, + "invalid type specifier for pointer type; specifier ignored" }, { W_IMPLICIT_FUNC, ERROR_LEVEL_WARNING, "function '%s' implicit declaration" }, { W_CONTINUE, ERROR_LEVEL_WARNING, -- 2.30.2