public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* Mipsel - big float problem with g++, not gcc (crosstool-ng.1.3.4)
@ 2012-02-20 10:15 Yatko
  2012-02-22 23:59 ` Bryan Hundven
  0 siblings, 1 reply; 2+ messages in thread
From: Yatko @ 2012-02-20 10:15 UTC (permalink / raw)
  To: crossgcc

Hello list, 

we are trying to compile a program which is written in c++.
All the outputs for float values are NAN. After some research we was able to produce this on a simple testprogram see below (fl2.c):

g++ configured as shown below:
$ mipsel-unknown-linux-gnu-g++ -v
Using built-in specs.
Target: mipsel-unknown-linux-gnu
Configured with: /crosstool-ng-1.13.4/.build/src/gcc-4.3.2/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=mipsel-unknown-linux-gnu --prefix=/x-tools/mipsel-unknown-linux-gnu --with-sysroot=/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sysroot --enable-languages=c,c++ --disable-multilib --with-arch=mips1 --with-abi=32 --with-float=soft --with-pkgversion='crosstool-NG 1.13.4' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/crosstool-ng-1.13.4/.build/mipsel-unknown-linux-gnu/build/static --with-mpfr=/crosstool-ng-1.13.4/.build/mipsel-unknown-linux-gnu/build/static --enable-threads=posix --enable-target-optspace --with-local-prefix=/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sysroot --disable-nls --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.3.2 (crosstool-NG 1.13.4) 



program in action:
[ mipsel-mips32-linux-gnu-g++ fl2.c -o fl2 ]
$./fl2
min float value == nan
max float value == nan
 
[ mipsel-mips32-linux-gnu-g++ fl2.c -o fl2 -static ]
$./fl2
FATAL: kernel too old
Segmentation fault
 
[ mipsel-mips32-linux-gnu-g++ fl2.c -o fl2 ] (changing in the program float to double works, but we need to use floats)
$./fl2
min float value == 0.000000
max float value == 340282346638528859811704183484516925440.000000

 ---
 
testprogram reproduce this problem:
compile with g++, not gcc:
mipsel-mips32-linux-gnu-g++ fl2.c -o fl2

fl2.c:
#include <float.h>
#include <stdio.h>
 
int main()
{
float minval = FLT_MIN; // with float NAN
float maxval = FLT_MAX; // with float NAN
 
printf("min float value == %f\n"
"max float value == %f\n",
(double)minval, maxval);
 
return 0;
}

all kind of support is much appreciated.
Thanks !
Yatko
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Mipsel - big float problem with g++, not gcc (crosstool-ng.1.3.4)
  2012-02-20 10:15 Mipsel - big float problem with g++, not gcc (crosstool-ng.1.3.4) Yatko
@ 2012-02-22 23:59 ` Bryan Hundven
  0 siblings, 0 replies; 2+ messages in thread
From: Bryan Hundven @ 2012-02-22 23:59 UTC (permalink / raw)
  To: Yatko; +Cc: crossgcc

On Mon, Feb 20, 2012 at 2:15 AM, Yatko <yatko@gmx.net> wrote:
> Hello list,
>
> we are trying to compile a program which is written in c++.
> All the outputs for float values are NAN. After some research we was able to produce this on a simple testprogram see below (fl2.c):
>
> g++ configured as shown below:
> $ mipsel-unknown-linux-gnu-g++ -v
> Using built-in specs.
> Target: mipsel-unknown-linux-gnu
> Configured with: /crosstool-ng-1.13.4/.build/src/gcc-4.3.2/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=mipsel-unknown-linux-gnu --prefix=/x-tools/mipsel-unknown-linux-gnu --with-sysroot=/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sysroot --enable-languages=c,c++ --disable-multilib --with-arch=mips1 --with-abi=32 --with-float=soft --with-pkgversion='crosstool-NG 1.13.4' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/crosstool-ng-1.13.4/.build/mipsel-unknown-linux-gnu/build/static --with-mpfr=/crosstool-ng-1.13.4/.build/mipsel-unknown-linux-gnu/build/static --enable-threads=posix --enable-target-optspace --with-local-prefix=/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sysroot --disable-nls --enable-c99 --enable-long-long
> Thread model: posix
> gcc version 4.3.2 (crosstool-NG 1.13.4)

It would be helpful if you posted your .config to pastebin.com or something.
I'm guessing that you intended on building with soft-float?

> program in action:
> [ mipsel-mips32-linux-gnu-g++ fl2.c -o fl2 ]
> $./fl2
> min float value == nan
> max float value == nan

Something wrong with soft-float... or...

> [ mipsel-mips32-linux-gnu-g++ fl2.c -o fl2 -static ]
> $./fl2
> FATAL: kernel too old
> Segmentation fault

Kernel too old? Hmm, maybe you need to set CT_LIBC_GLIBC_MIN_KERNEL to
a lower version number?

> [ mipsel-mips32-linux-gnu-g++ fl2.c -o fl2 ] (changing in the program float to double works, but we need to use floats)
> $./fl2
> min float value == 0.000000
> max float value == 340282346638528859811704183484516925440.000000
>
>  ---
>
> testprogram reproduce this problem:
> compile with g++, not gcc:
> mipsel-mips32-linux-gnu-g++ fl2.c -o fl2
>
> fl2.c:
> #include <float.h>
> #include <stdio.h>
>
> int main()
> {
> float minval = FLT_MIN; // with float NAN
> float maxval = FLT_MAX; // with float NAN
>
> printf("min float value == %f\n"
> "max float value == %f\n",
> (double)minval, maxval);
>
> return 0;
> }
>
> all kind of support is much appreciated.
> Thanks !
> Yatko

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-22 23:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20 10:15 Mipsel - big float problem with g++, not gcc (crosstool-ng.1.3.4) Yatko
2012-02-22 23:59 ` Bryan Hundven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).