From: SourceForge.net <no...@so...> - 2003-12-18 21:25:07
|
Bugs item #862241, was opened at 2003-12-18 07:06 Message generated for change (Comment added) made by epetrich You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=862241&group_id=599 Category: None >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Erik Petrich (epetrich) Summary: Make an empty string are optimized away Initial Comment: /* * The empty string symptom * Make an empty string and sdcc will optimize it away. */ void doit(char *str); void doit(char *str) { str; } void main() { doit("Test"); // This line produces __str_0: doit("Test\0Test"); // This line produces __str_1: doit("\0"); // This line produces __str_2: doit(""); // This line produces __str_3: } /* * This is the tail of the assmbly code you will get with sdcc: * * .area CSEG (CODE) * __str_0: * .ascii "Test" * .db 0x00 * __str_1: * .ascii "Test" * .db 0x00 * .ascii "Test" * .db 0x00 * __str_2: * __str_3: * .area XINIT (CODE) * * In my oppinion this would be better, wouldn't it? * * .area CSEG (CODE) * __str_0: * .ascii "Test" * .db 0x00 * __str_1: * .ascii "Test" * .db 0x00 * .ascii "Test" * .db 0x00 * __str_2: * .db 0x00 ; This string is not empty. It contains a NULL, * .db 0x00 ; and it is terminated by a NULL (It makes no sence, but it is the truth.) * __str_3: * .db 0x00 ; This string is an empty string, terminatet by NULL. * .area XINIT (CODE) * */ ---------------------------------------------------------------------- >Comment By: Erik Petrich (epetrich) Date: 2003-12-18 15:25 Message: Logged In: YES user_id=635249 Fixed with src/SDCCast.c 1.203 and src/SDCCglue.c 1.161 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=862241&group_id=599 |