Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 13 Oct 2014 22:42:39 -0400
From: Rich Felker <dalias@...c.org>
To: bobodog <8192542@...com>
Cc: musl <musl@...ts.openwall.com>
Subject: Re: [math] The math library have some bug for
 ceil,floor,round functioin, in arm mode

On Tue, Oct 14, 2014 at 10:17:34AM +0800, bobodog wrote:
> HI,ALL
>          We use musl in arm process, but found some bugs about math library,  x86 process is ok!

I can't reproduce this issue. Are you using soft (arm) or hard (armhf)
float based target?

>         The test code:
> int test(int argc, char ** argv)
> {
> 	double n = 0.0;
> 	int i;
> 
> 
> 	for(i = 0; i < 20; i++)
> 	{
> 		n = n - 0.125;
> 		printf("ceil(%f) = %f, floor(%f) = %f, round(%f) = %f\n", n, ceil(n), n, floor(n), n, round(n));
> 	}
> 
> 
> 	return 0;
> }‍

Is this the whole test program? I don't see a main function or any
#include directives. Compiling it with gcc -Dtest=main results in:

foo.c:10:17: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
foo.c:10:78: warning: incompatible implicit declaration of built-in function ‘ceil’ [enabled by default]
foo.c:10:90: warning: incompatible implicit declaration of built-in function ‘floor’ [enabled by default]
foo.c:10:103: warning: incompatible implicit declaration of built-in function ‘round’ [enabled by default]

These warnings should all be treated as errors; calling a function
with variadic arguments (printf) or a function that returns a floating
point type without a valid declaration/prototype is a serious error
and will not work.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.