AVR C Runtime Library - Bugs: bug #37825, math.h wrong code and not C90...
You are not allowed to post comments on this tracker with your current authentication level.
bug #37825: math.h wrong code and not C90 compliant
Submitter: | Georg-Johann Lay <gjlayde> | ||
Submitted: | Wed 28 Nov 2012 11:06:19 PM UTC | ||
Category: | Header | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | None |
Status: | None | Assigned to: | None |
Percent Complete: | 0% | Open/Closed: | Open |
Release: | 1.8.0 | Fixed Release: | None |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
No changes have been made to this item
Powered by Savane 3.13-caa5.
Corresponding source code
math.h uses inline which is not C90 (similar to bug 36921 with util/delay.h), here SVN 2264:
_ATTR_CONST_ static inline int isfinite (double __x)
{
unsigned char __exp;
_asm_ (
"mov %0, %C1 nt"
"lsl %0 nt"
"mov %0, %D1 nt"
"rol %0 "
: "=r" (__exp)
: "r" (__x) );
return __exp != 0xff;
}
inline is available in C99, not in C90. You can use _inline_ or __inline. Same applies to copyfign.
Moreover, it is advisable to always inline this:
_ATTR_CONST_ static _inline_ __attribute__((_always_inline_))
int isfinite (const double __x)
This function might produce wrong code because the first instruction might clobber the input by overwriting %D1 . One solution is to early-clobber the output by means of &