This is the mail archive of the mailing list for the crossgcc project.

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

Bug in newlib-1.8.1?

Hi all,
Some time in July I wrote to this list about problems with newlib-1.8.1
and powerpc-eabi target...

I got an answer from Ranjith <> saying:

> I compiled your test case and used our simulator to verify the output.
> My results are all correct (the same as your newlib-1.8.0 output).

Unfortunately Ranjith didn't mention the host used... Sparc Solaris2?

Now I decided to upgrade a couple target compilers, especially the
'v850-elf32'-one that hasn't worked quite well, with egcs-1.1a and
newlib-1.8.1 and got quite the same kind of problems with them :

My little test program :

  #include <stdio.h>
  #include <float.h>

    double d = FLT_MIN;

    printf ("%.17e\n", d / 2);
    printf("g-style big:\t\"%.60g\"\n", 1e20);
    printf ("%15.5e\n", 4.9406564584124654e-324);

    return 0;

When using newlib-1.8.0 all tools give the same correct output:

  g-style big:	"100000000000000000000"

But when using newlib-1.8.1, all kind of bullshit is got instead:

With 'gcc-ppc-eabi' :

  g-style big:	"147452918349690830848"

With 'gcc-mips-ecoff' :

  g-style big:	"147523287093870182400"
  program stopped with signal 7.

With 'gcc-v850-elf32' :

  g-style big:	"147525572073966534656"

All the runs were done using the simulators for the targets, included
in gdb-4.17 or gdb-4.17.1.  The host where the compilers & libs were
made was RH4.0 / Linux-2.0.32 / egcs-1.0.2. The cross-compiler versions
were egcs-1.0.3a (ppc and mips) and egcs-1.1a (v850-elf32).

Earlier I checked all my ppc-eabi target simulators under Linux, Win32
and DJGPP/go32 hosts and all these (x86-hosts!) gave the same result.
So my conclusion is that the problem lies with newlib-1.8.1 or the 'x86'
as the host for simulators...

BTW, for those wondering how I could use newlib-1.8.0 with the 'v850' when
this target wasn't supported with it:

The newlib-1.8.0 for 'v850-elf32' was got by copying the v850-specific dirs:
'newlib/libc/machine/v850' and 'newlib/libc/sys/sysnecv850' to newlib-1.8.0
sources, adding the configure info from newlib-1.8.1 for v850 into
'newlib/', configuring for 'v850-elf32' and doing the build ...
Just a piece of cake because of the very good backwards compatability... Now
the 'v850-elf32' target tools seem to work a lot better...

Has anyone got something similar with other hosts and targets?  Any fixes
available? (Ok, newlib-1.8.0 is good enough for me, just being worried
about newlib-1.8.1 and the 'x86' as the host for simulators...)

Any help will be appreciated...

Regards, Kai

PS. What the hell is that __attribute__((__sda__)) in <sys/config.h> :

  #ifdef __v850
  #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__))

(perhaps this was aimed to be '__attribute__ ((__section__ (".sdata")))',
to which I changed it...)

and what are the 'v850-elf32-gcc' options :

  -msmall-sld -mno-app-regs

(the 'sparc' targets know the '-mapp-regs'/'-mno-app-regs', I just
disabled them with an inserted '#')

which 'newlib/' tries to use for the 'v850-elf32' target