From: SourceForge.net <no...@so...> - 2007-04-13 17:26:29
|
Bugs item #1699543, was opened at 2007-04-12 23:05 Message generated for change (Comment added) made by hohensoh You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520074&aid=1699543&group_id=68108 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: Closed Resolution: Rejected Priority: 5 Private: No Submitted By: Jörg Hohensohn (hohensoh) Assigned to: Eric Weddington (arcanum) Summary: <avr/boot.h> minor flaw prevents -mint8 compilation Initial Comment: Within avr/boot.h, the line #elif (FLASHEND > USHRT_MAX) should rather be #elif (FLASHEND > UINT16_MAX) because when compiling with -mint8 USHRT_MAX becomes half and as a result the wrong functions get selected. ---------------------------------------------------------------------- >Comment By: Jörg Hohensohn (hohensoh) Date: 2007-04-13 18:12 Message: Logged In: YES user_id=741001 Originator: YES Consider this my first patch: replace that particular USHRT_MAX with UINT16_MAX. ;-) OK, I'll check that mailing list. I didn't know that -mint8 is a new option, or at least newer than the library parts. IMHO there are only a few places where the lib can't be -mint8 proof (but I may be terribly wrong): when the C standard mandates an int and it has to be wider than a char. Within our own functions, we can work with the fixed-width stdint.h types and are safe. The lib itself is compiled, so problems can "only" occur at the interfaces, when a narrowed type is used. I'd have a patch for stdint.h with gcc v4.1.1, the 64 bit types need to be ifdef'd out in case of -mint8, they're not available then. ---------------------------------------------------------------------- Comment By: Eric Weddington (arcanum) Date: 2007-04-13 15:51 Message: Logged In: YES user_id=543419 Originator: NO It is not being "sabotaged". There has been *zero* work done to support -mint8. <avr/boot.h> was originally written years ago. If you would like to have avr-libc support -mint8 then please write about it on the avr-libc-dev mailing list and submit patches to the avr-libc project. Patches are always welcome! ---------------------------------------------------------------------- Comment By: Jörg Hohensohn (hohensoh) Date: 2007-04-13 12:56 Message: Logged In: YES user_id=741001 Originator: YES Sorry for nagging/nitpicking, I know -mint8 is "not really supported" by avr-libc, but on the other hand we don't need to sabotage it... What can be bad about replacing this USHRT_MAX with UINT16_MAX? Comes closer to the original intention, namely to check if the addressing is 16 bit or above. IMHO it is formally wrong now, works by chance while a short is 16 bit, becomes visible as a bug when using -mint8. -mint8 helps a lot to make the code smaller, especially important for bootloaders. An this is the situation where one wants to use boot.h. ---------------------------------------------------------------------- Comment By: Eric Weddington (arcanum) Date: 2007-04-12 23:15 Message: Logged In: YES user_id=543419 Originator: NO In the avr-libc user manual here: <http://www.nongnu.org/avr-libc/user-manual/using_tools.html#using_avr_gcc> about the options available for avr-gcc, it says: * -mint8 Assume int to be an 8-bit integer. Note that this is not really supported by avr-libc, so it should normally not be used. The default is to use 16-bit integers. So the solution is: don't use -mint8. However, I agree that this should be more prominent in the documentation of avr-libc. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520074&aid=1699543&group_id=68108 |