bugAVR 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

Wed 28 Nov 2012 11:06:19 PM UTC, original submission:  

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 &

Georg-Johann Lay <gjlayde>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gjlayde (Submitted the item)

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4e86.
    Corresponding source code