This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: floating point operations in gcc 3.3.3, glibc 2.3.2


Dan,
We've found the problem. Turns out our build script was to blame, not the patches. We were executing a loop like:


for cpu in sh4 i686 powerpc-405 powerpc-750; do
cd $TOP_DIR


           # Load definitions for current CPU into environment and build
           eval `cat $cpu.dat ../$TOOLCOMBO.dat` buildit
   done

Interestingly, this behaves differently if executed with /bin/sh instead of /bin/bash. In the former case, any variables set by $cpu.dat are preserved between iterations. In the latter case, they are only valid for a single execution of buildit.

We were all executing the script with "sh ./doit.sh", which was causing the ppc750 build to give weird floating point results *only* if it was built after sh4 and powerpc-405.

Anyway, thanks for your time, and sorry for the bogus bug report.

Ollie Wild

Dan Kegel wrote:

Kunjan Naik wrote:

Target: ppc750
Toolchain 1: crosstool-0.28-rc19, gcc3.3.3 glibc-2.3.2
Toolchain 2: crosstool-0.28-rc19, gcc3.3.3 glibc-2.3.2 without
gcc-3.3.2-arm-softfloat.patch
Sample Testcase: modified struct-ret-1.c with printf statements (see
attached)
Complier flag: --static.

Both the toolchains output the same .s file for the testcase. When executed on target, toolchain 1 binary prints garbage and toolchain 2
binary prints expected output.
For toolchain 1, the testcase compares garbage values and succeeds or aborts
and for toolchain 2 the testcase
compares valid output and always succeeds.


I just wrote a shell script to try to reproduce your result.
Before running it, I copied patches/gcc-3.3.3/gcc-3.3.2-arm-softfloat.patch
to the contrib directory, and put a copy of your struct-ret-1.c in the
current directory.
Does this look right?


#!/bin/sh
set -ex
TARBALLS_DIR=$HOME/downloads
export TARBALLS_DIR
GCC_LANGUAGES="c"
export GCC_LANGUAGES
RESULT_TOP=/opt/crosstool/xxvfp
export RESULT_TOP
mkdir -p $RESULT_TOP
cp contrib/gcc-3.3.2-arm-softfloat.patch patches/gcc-3.3.3
eval `cat powerpc-750.dat gcc-3.3.3-glibc-2.3.2.dat` sh all.sh --notest
RESULT_TOP=/opt/crosstool/novfp
export RESULT_TOP
mkdir -p $RESULT_TOP
rm -f patches/gcc-3.3.3/gcc-3.3.2-arm-softfloat.patch
eval `cat powerpc-750.dat gcc-3.3.3-glibc-2.3.2.dat` sh all.sh --notest
/opt/crosstool/xxvfp/powerpc-750-linux-gnu/gcc-3.3.3-glibc-2.3.2/bin/powerpc-750-linux-gnu-gcc -static struct-ret-1.c -o xxvfp.out
/opt/crosstool/novfp/powerpc-750-linux-gnu/gcc-3.3.3-glibc-2.3.2/bin/powerpc-750-linux-gnu-gcc -static struct-ret-1.c -o novfp.out
cmp xxvfp.out novfp.out
echo Finished


It does say that xxvfp.out and novfp.out differ, but if you run
$ cmp -l xxvfp.out novfp.out
you will see that the only differences are that 'no' has been
replaced with 'xx'.  Thus I doubt that the two programs will
behave differently.  I can send them to you if you like, but
perhaps you should run this shell script yourself and report
back the results.

- Dan



------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]