avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #37825] math.h wrong code and not C90 compliant


From: Georg-Johann Lay
Subject: [avr-libc-dev] [bug #37825] math.h wrong code and not C90 compliant
Date: Wed, 28 Nov 2012 23:06:20 +0000
User-agent: Opera/9.80 (Windows NT 5.0; U; de) Presto/2.6.30 Version/10.63

URL:
  <http://savannah.nongnu.org/bugs/?37825>

                 Summary: math.h wrong code and not C90 compliant
                 Project: AVR C Runtime Library
            Submitted by: gjlayde
            Submitted on: Mi 28 Nov 2012 23:06:19 GMT
                Category: Header
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.8.0
           Fixed Release: None

    _______________________________________________________

Details:

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 &






    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?37825>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]