does soft-float work?
We saw similar problems and found that there was a compiler bug which emitted bad code when using varargs to pass doubles.
This only occurred when using -mcpu=8xx not with -msoft-float.
For example the following code did not work with egcs-1.1 when using -mcpu=8xx
------
#include <stdarg.h>
double d = 500.0;
vtst(char *fmt, ...) {
double z;
va_list ap;
va_start(ap,fmt);
z = va_arg(ap,double); printf("vatst=%d\n",(int)z); // should print 500
}
main() {
vtst("jj",d);
}
------
I have not tried gcc 2.95.X so the bug may have been fixed.
The problem with printf is that libc was probably compiled with -mcpu=8xx with a version of gcc with this bug. (libc/printf uses varags to pass doubles internally) We recompiled libc with -msoft-float and now things work fine.
-- Stuart
-------------------------------------
Stuart Adams
Bright Star Engineering Inc.
19 Enfield Drive
Andover MA 01810 USA
Tel: +1-978-470-8738
Fax: +1-978-470-8878
Email: [email protected]
Web: http://www.brightstareng.com/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 22 lines · Stuart Adams
We saw similar problems and found that there was a compiler bug which emitted bad code when using varargs to pass doubles.
This only occurred when using -mcpu=8xx not with -msoft-float.
For example the following code did not work with egcs-1.1 when using -mcpu=8xx
------
#include <stdarg.h>double d = 500.0;vtst(char *fmt, ...) { double z; va_list ap; va_start(ap,fmt); z = va_arg(ap,double); printf("vatst=%d\n",(int)z); // should print 500}
Quoted 6 lines
main() { vtst("jj",d);}
------I have not tried gcc 2.95.X so the bug may have been fixed.
Not fixed as of 2.95.1 at least.
Quoted 4 lines
The problem with printf is that libc was probably compiled with -mcpu=8xx with a version of gcc with this bug. (libc/printf uses varags to pass doubles internally) We recompiled libc with -msoft-float and now things work fine.
The bug is in the installed specs file that gcc uses, not in the compiler itself. See my other mail for details.
//Marcus
Signature · 6 lines
-------------------------------+------------------------------------
Marcus Sundberg | http://www.stacken.kth.se/~mackan/
Royal Institute of Technology | Phone: +46 707 295404
Stockholm, Sweden | E-Mail: [email protected]
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/