fenv.h fixes for softfloat

Ian Lepore freebsd at damnhippie.dyndns.org
Sat Jan 14 20:02:57 UTC 2012


On Sat, 2012-01-14 at 12:07 -0700, Ian Lepore wrote:
> On Sat, 2012-01-14 at 13:29 -0500, David Schultz wrote:
> > It would be interesting to see the results of the test-printfloat
> > test in regression/lib/libc/stdio.
> 
> Well that narrowed it down quickly.  I commented out the abort() calls
> so all the tests would run, and commented out the alternate locale
> testing because we don't install locales on our boxes.  I'm also adding
> -fno-builtin to the test compiles now.  
> 
> Everything relating to printing a long double fails.  I don't know yet
> whether it's just printing, or whether all the failures at this point
> are being caused by wrong or incomplete long double support in my
> environment.
> 

It does appear to be just printf().  I can do math on long doubles and
pass them as args to other functions and so on and it all works fine and
everything has the expected values as long as I cast the value to double
and printf that way.

While writing the above, another thought popped into my head and I just
tested it: it's not the va_args mechanism corrupting the long doubles,
this code prints the expected values for the long doubles you pass in:

        void foo(int x, ...)
        {
        	va_list args;
        	long double ld;
        
        	va_start(args, x);
        	ld = va_arg(args, long double);
        	va_end(args);
        
        	printf("foo: %f\n", (double)ld);
        }

So something is wrong in the long double printf support in my libc,
although a cursory glance at the code shows that it has some support for
long doubles.  I haven't yet done any repo spelunking to see if there
may be fixes I don't have in the 8.2 lib.

-- Ian




More information about the freebsd-arm mailing list