This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
cast of float to unsigned char bug on ARM with 3.4.5 - when was it fixed?
- From: Sam Ravnborg <sam at ravnborg dot org>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 8 Jan 2008 22:25:05 +0100
- Subject: cast of float to unsigned char bug on ARM with 3.4.5 - when was it fixed?
The following sample code produces different result depending on
the gcc version and target:
gcc version target output
3.4.5 i386 n1: 226 n2: -30.33
4.1.2 (RedHat) i386 n1: 226 n2: -30.33
3.4.5 arm-softfloat n1: 0 n2: -30.33
4.1.1 arm n1: 226 n2: -30.33
>From the sample code above it is obvious that gcc 3.4.5
on arm-softfloat differs from the rest.
The sample code:
====================
#include <stdio.h>
int main(void)
{
unsigned char n1;
float n2;
n2 = -30.33F;
n1 = (unsigned char)n2;
printf("n1: %d n2: %3.2f\n", n1, n2);
return 0;
}
====================
I have not yet tried with a arm-softfloat gcc > 3.4.5 because Dan Kegel's
crosstool do not have it out-of-the box.
I assume this is a know bug that got fixed in later gcc's.
I have tried searching the gcc bug database with no luck.
Can anyone give a hint of when it was fixed or how I can better look it
up myself?
Thanks in advance,
Sam