From: SourceForge.net <no...@so...> - 2006-05-20 10:13:48
|
Bugs item #1487644, was opened at 2006-05-12 22:45 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1487644&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: pic14 target Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: gen.c assumes "sizeof(float) == sizeof(long)" Initial Comment: When trying to compile code for the PIC16F864 on a debian x86_64 host, I get sdcc: gen.c:9359: bitpatternFromVal: Assertion `sizeof (float) == sizeof (long)' failed. A quick look to the corresponding line in the source code reveals that it makes the illegal assumption that float and long have the same storage size. My email: la...@gn... ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2006-05-20 12:13 Message: Logged In: YES user_id=888171 I'd recommend to include stdint.h and use uint32_t instead of unsigned long. ---------------------------------------------------------------------- Comment By: Raphael Neider (tecodev) Date: 2006-05-19 19:45 Message: Logged In: YES user_id=1115835 Hmm..., what's the `correct' way to do cast the bitpattern of a float into a long? float f; long l = *(long *)(&f); --- float f; long l = 0; memcpy(&l, &f, sizeof( float ) ); --- have two unions, one { double; long } and the other { float, long } and select the correct one based on sizeof( double ) == sizeof( long ) vs. sizeof( float ) == sizeof( long ), and emit an error if neither holds? Can you verify the result is correct if the assertion is simply removed? I cannot due to lack of x86_64 machines ;-) Regards, Raphael ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1487644&group_id=599 |