From: SourceForge.net <no...@so...> - 2008-07-30 18:32:46
|
Patches item #2032433, was opened at 2008-07-30 10:18 Message generated for change (Comment added) made by borutr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300599&aid=2032433&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Accepted Priority: 5 Private: No Submitted By: Mauro Giachero (maurogiachero) Assigned to: Borut Raem (borutr) Summary: PIC16: fix constant strings Initial Comment: Constant strings can contain '\0', so their "emission" cannot rely on it being present only as string termination. This patch implements a more proper way to manage string length. Fixes regression test failures on nullstring.c. Applies cleanly to revision 5199. [Thank you for applying my previous patches!] Mauro ---------------------------------------------------------------------- >Comment By: Borut Raem (borutr) Date: 2008-07-30 20:32 Message: Logged In: YES user_id=568035 Originator: NO It is strange that the warning is submitted only for pic targets. The behavior IMO should be the same for all targets. Or I'm wrong? Borut ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2008-07-30 20:08 Message: Logged In: YES user_id=888171 Originator: NO In this case I think it is disputable whether the literal string is 5 or 6 bytes long. It is allowed to provide 5 chars for the full initialization. If the literal string would be longer the warning should appear though. Maarten ---------------------------------------------------------------------- Comment By: Mauro Giachero (maurogiachero) Date: 2008-07-30 19:53 Message: Logged In: YES user_id=2160854 Originator: YES I admit I haven't investigated them a lot, but I assumed that these are due to lines like char string3[5] = "a\0b\0c" where string3 has 5 bytes allocated, but "a\0b\0c" is 6 bytes long due to the string terminator. After looking at the asm, I assumed that the policy is to use only the first 5 bytes and discard the extra bytes provided. So the warning is correctly pointing out that a part of the provided literal initialization string is discarded. Mauro ---------------------------------------------------------------------- Comment By: Borut Raem (borutr) Date: 2008-07-30 19:32 Message: Logged In: YES user_id=568035 Originator: NO Patch applied in svn revision #5202. Mario, the assertion failures are fixed, but the warnings "warning 147: excess elements in array of chars initializer after 'string3'" are still there. Any idea why? Thanks for the great work. I hope you'll continue to improve sdcc. Borut ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300599&aid=2032433&group_id=599 |