[Bug 191754] New: *l(3) math functions are not declared properly in math.h
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Jul 8 21:23:26 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191754
Bug ID: 191754
Summary: *l(3) math functions are not declared properly in
math.h
Product: Base System
Version: 11.0-CURRENT
Hardware: Any
OS: Any
Status: Needs Triage
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: yaneurabeya at gmail.com
POSIX claims that powl(3) should be defined via math.h/libm (
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pow.html) with
std=c99, but unfortunately this appears to be broken on FreeBSD
10-STABLE/11-CURRENT. If I remove the "#if _DECLARE_C99_LDBL_MATH" guard from
math.h, things compile more cleanly (it just emits a warning about loss in
precision because of the imprecise functions). This guard should probably have
a !defined(__cplusplus) check added to it.
Before:
% clang -std=iso9899:1999 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/root/powl_undeclared.c:9:41: warning: implicitly declaring library function
'powl' with type 'long double (long double, long double)'
printf("powl(%Lf, %Lf) = %Lf\n", a, b, powl(a, b));
^
/root/powl_undeclared.c:9:41: note: please include the header <math.h> or
explicitly provide a declaration for 'powl'
1 warning generated.
/tmp/powl_undeclared-252fa5.o: In function `main':
/root/powl_undeclared.c:(.text+0x4e): warning: powl has lower than advertised
precision
% gcc -std=c99 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/root/powl_undeclared.c: In function 'main':
/root/powl_undeclared.c:9: warning: implicit declaration of function 'powl'
/root/powl_undeclared.c:9: warning: incompatible implicit declaration of
built-in function 'powl'
/tmp//ccSJGxdD.o: In function `main':
powl_undeclared.c:(.text+0x54): warning: powl has lower than advertised
precision
% gcc46 -std=c99 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/root/powl_undeclared.c: In function 'main':
/root/powl_undeclared.c:9:2: warning: implicit declaration of function 'powl'
[-Wimplicit-function-declaration]
/root/powl_undeclared.c:9:41: warning: incompatible implicit declaration of
built-in function 'powl' [enabled by default]
/tmp//ccmC02s8.o: In function `main':
powl_undeclared.c:(.text+0x54): warning: powl has lower than advertised
precision
% gcc -std=iso9899:1999 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/root/powl_undeclared.c: In function 'main':
/root/powl_undeclared.c:9: warning: implicit declaration of function 'powl'
/root/powl_undeclared.c:9: warning: incompatible implicit declaration of
built-in function 'powl'
/tmp//ccGtRDWg.o: In function `main':
powl_undeclared.c:(.text+0x54): warning: powl has lower than advertised
precision
% gcc46 -std=iso9899:1999 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/root/powl_undeclared.c: In function 'main':
/root/powl_undeclared.c:9:2: warning: implicit declaration of function 'powl'
[-Wimplicit-function-declaration]
/root/powl_undeclared.c:9:41: warning: incompatible implicit declaration of
built-in function 'powl' [enabled by default]
/tmp//ccjUVEX8.o: In function `main':
powl_undeclared.c:(.text+0x54): warning: powl has lower than advertised
precision
After:
% gcc46 -std=iso9899:1999 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/tmp//ccMsjZpJ.o: In function `main':
powl_undeclared.c:(.text+0x54): warning: powl has lower than advertised
precision
% clang -std=iso9899:1999 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/tmp/powl_undeclared-ed9797.o: In function `main':
/root/powl_undeclared.c:(.text+0x4e): warning: powl has lower than advertised
precision
% gcc -std=iso9899:1999 -lm -o /root/powl_undeclared /root/powl_undeclared.c
/tmp//ccFvfEeJ.o: In function `main':
powl_undeclared.c:(.text+0x54): warning: powl has lower than advertised
precision
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list