bugAVR C Runtime Library - Bugs: bug #37825, math.h wrong code and not C90...

 
 

bug #37825: math.h wrong code and not C90 compliant

Submitted by:  Georg-Johann Lay <gjlayde>
Submitted on:  Wed 28 Nov 2012 11:06:19 PM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: NonePercent Complete: 0%
Assigned to: NoneOpen/Closed: Open
Release: 1.8.0Fixed Release: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup