warning in modfl

Joel Sherrill joel.sherrill@oarcorp.com
Mon Nov 18 19:30:00 GMT 2013


OK.. how about this patch and the changelog entry?

OK to commit?

2013-11-18  Joel Sherrill <joel.sherrill@oarcorp.com>

        * libm/common/modfl.c: Remove warning.


On 11/18/2013 12:37 PM, Craig Howland wrote:
> 
> On 11/18/2013 01:13 PM, Joel Sherrill wrote:
>> Hi
>>
>> Any thoughts on how to fix this warning?
>>
>> ../../../../../newlib-cvs/src/newlib/libm/common/modfl.c: In function
>> 'modfl':
>> ../../../../../newlib-cvs/src/newlib/libm/common/modfl.c:39:3: warning:
>> passing argument 2 of 'modf' from incompatible pointer type [enabled by
>> default]
>>     return modf(x, iptr);
>>     ^
>> In file included from
>> ../../../../../newlib-cvs/src/newlib/libm/common/modfl.c:31:0:
>> /users/joel/test-gcc/newlib-cvs/src/newlib/libc/include/math.h:114:15:
>> note: expected 'double *' but argument is of type 'long double *'
>>   extern double modf _PARAMS((double, double *));
> This file is dedicated for long double=double, so just a cast:
>    return modf(x, (double *) iptr);
> 



-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985
-------------- next part --------------
Index: ./libm/common/modfl.c
===================================================================
RCS file: /cvs/src/src/newlib/libm/common/modfl.c,v
retrieving revision 1.2
diff -u -r1.2 modfl.c
--- ./libm/common/modfl.c	17 Apr 2009 22:15:43 -0000	1.2
+++ ./libm/common/modfl.c	18 Nov 2013 19:26:47 -0000
@@ -36,7 +36,7 @@
 long double
 modfl (long double x, long double *iptr)
 {
-  return modf(x, iptr);
+  return modf(x, (double *)iptr);
 }
 #endif
 


More information about the Newlib mailing list