float problem with optimization on pcc platforms

Ivan LAURETTE Ivan.LAURETTE@rte.fr
Mon Nov 20 13:14:00 GMT 2006


Hello,

gcc -version : powerpc-apple-darwin8-gcc-4.0.1
glibc: 2.3.5

I created a ppc-860-linux toolchain on a ppc-G5-darwin platform.
I wrote a very basic test program:

--------------------------------------------
#include <stdio.h>

int main() {
  int ires = 200;
  float fres = (float)ires;

  printf("%d %f\n", ires, fres);

  return 0;
}
--------------------------------------------

Compiled with the following options:
> g++ main.cpp -O -o test
the program results in:
> ./test
200 0.000000

Compiled with:
> g++ main.cpp -g -o test
the result is:
> ./test
200 200.000000

What's the problem ?
Thanks in advance for any help.


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list