Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] float, va_arg, printf on x86_64
@ 2009-08-04  9:30 bbj17 at gmx.de
  2009-08-04  9:37 ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: bbj17 at gmx.de @ 2009-08-04  9:30 UTC (permalink / raw)
  To: buildroot

Hi,

I found the bug. IT seems to be a bad combination of Host-GCC and Target-GCC:

Host1-Environment:
GNU make version '3.81'
C compiler version '4.2.1'
C++ compiler version '4.2.1'

Target architecture = x86_64
Target GCC => 4.3.3
printf %f 7 => error => -26815615859...

----------------------------------

Host2-Environment:
GNU make version '3.81'
C compiler version '4.2.1'
C++ compiler version '4.2.1'

Target architecture = x86_64
Target GCC => 4.4.1
printf %f 7 => OK => 7.0000

-----------------------------------

Host3-Environment:
GNU make version '3.81'
C compiler version '4.3.2'
C++ compiler version '4.3.2'

Target architecture = x86_64
Target GCC => 4.3.3
printf %f 7 => OK => 7.0000




-- 
GRATIS f?r alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Buildroot] float, va_arg, printf on x86_64
@ 2009-08-03 15:17 bbj17 at gmx.de
  0 siblings, 0 replies; 3+ messages in thread
From: bbj17 at gmx.de @ 2009-08-03 15:17 UTC (permalink / raw)
  To: buildroot

Hi,

I use buildroot-2009.08-rc1 and want to build a small system for a 64-Bit system.
I build my version with the following settings: 
Target architecture = x86_64
kernel type = advanced
kernel version = 2.6.30.2

The target image boots fine and everything is working, except the output of float values:

(printf - busyboy) => printf %f 7 => 0.000000
(printf - ash) => printf %f 7 => -2681561585988519419770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

(tcl format) => format %f 7 => 0.000000

Only perl-printf works right.
Can anyone explain this behaviour?

PS: same with buildroot-2009.05

c-code example:

#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <stdarg.h>


void my(int param1, ...) {
     double f;
     va_list argptr;

    va_start( argptr, param1 );
      f = va_arg( argptr, double );
      va_end( argptr );

      if (f==4.2) {
      printf("YES #2\n");
    }

    printf("my -> %.2f \n", f);

}

int main(int argc, char *argv[]) {

  float f3;
  f3 = 4.2f;

  printf("%d\n", (int)f3);
  if (f3==4.2f) {
        printf("YES %2.2f\n",f3);
  }

  my(3,f3);
  return 0;

}


correct output (opensuse 10.2):
./a.out
4
YES 4.20
my -> 4.20

incorrect output (BR-2009.08-rc1):
./testprintf
4
YES 0.00
my -> 0.00

If the target architecture is 32-Bit everything is OK!

Regards BC

-- 
GRATIS f?r alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

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

end of thread, other threads:[~2009-08-04  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-04  9:30 [Buildroot] float, va_arg, printf on x86_64 bbj17 at gmx.de
2009-08-04  9:37 ` Peter Korsgaard
  -- strict thread matches above, loose matches on Subject: below --
2009-08-03 15:17 bbj17 at gmx.de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox