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] |
(You're also Dutch?) On Mon, Aug 16, 2004 at 02:23:54AM +0200, Dimitry Andric wrote: > > x = 1.0; > > printf("%f\n", x); > [...] > > [root@enp2611 tmp]# ./x > > 0.000000 > [...] > > If I try to print 1.1, I get "-0.000000". > > If I try to print 1.2, I get "2.000000". > > If I try to print 1.3, I get "-2.000000". > > And if I try to print 1.4, I get (hang on) > > "26815622249480124604215817416420243243587272560002206992098063765762173090970884294781200568594023450472595307446283091495952708613797907653947046282395648.000000" > > > Maybe you have an idea off the top of your hat what's going wrong here? > > I suppose this is what crosstool's patches/glibc-2.3.2/glibc-vfp.patch > should fix. Are you sure it is applied correctly? > It seems that glibc interprets the float endianness incorrectly, > thus printing garbage. I think it's applied correctly? I'm trying this with hardfloat, if I use fpa or vfp softfloat it does print the right number. > Can you try producing some .s files with your compiler, to see what it > generates for the floating point constants? OK, this: <source> #include <stdio.h> #include <stdlib.h> int main() { volatile float x; x = 1.0; printf("%f\n", x); return 0; } </source> gives me this: <assembly> .file "x.c" .section .rodata.str1.4,"aMS",%progbits,1 .align 2 .LC0: .ascii "%f\n\000" .text .align 2 .global main .type main, %function main: @ args = 0, pretend = 0, frame = 4 @ frame_needed = 0, uses_anonymous_args = 0 str lr, [sp, #-4]! ldr r3, .L2 @ float ldr r0, .L2+4 sub sp, sp, #4 str r3, [sp, #0] @ float ldfs f1, [sp, #0] mvfd f0, f1 stfd f0, [sp, #-8]! ldmfd sp!, {r1, r2} bl printf mov r0, #0 add sp, sp, #4 ldmfd sp!, {pc} .L3: .align 2 .L2: .word 1065353216 .word .LC0 .size main, .-main .ident "GCC: (GNU) 3.4.1" </assembly> thanks, Lennert ------ 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] |