This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin Perl and -Duselongdouble


Sisyphus wrote:

> It certainly works for me for 'sqrtl' (but fails for 'frexpl' with
> "undefined reference to `_frexpl'"):

This is an invalid testcase in several ways.

It only "works" inasmuch as the compiler recognises that 7 is a constant
and replaces the call to sqrtl() with a value.  Any nontrivial use of
sqrtl() however will result in a linker error, so this testcase is not
doing what you think it is.

Also, you didn't include math.h, which if combined with -Wall would have
given you an "implicit declaration of sqrtl" warning.  As it is you're
relying on the fact that ancient C conventions allow for calling a
function without first seeing a definition or declaration for that
function, but in the modern age doing this is extremely bad because the
compiler has to guess as to the argument types.

    long double x = sqrtl(7);
  40106a:       b8 bc 4d c7 97          mov    $0x97c74dbc,%eax
  40106f:       ba 4e fd 53 a9          mov    $0xa953fd4e,%edx
  401074:       b9 00 40 00 00          mov    $0x4000,%ecx
  401079:       89 45 e8                mov    %eax,0xffffffe8(%ebp)
  40107c:       89 55 ec                mov    %edx,0xffffffec(%ebp)
  40107f:       89 4d f0                mov    %ecx,0xfffffff0(%ebp)
    printf("%.19Lf\n", x);
  401082:       8b 45 e8                mov    0xffffffe8(%ebp),%eax
  401085:       8b 55 ec                mov    0xffffffec(%ebp),%edx
  401088:       8b 4d f0                mov    0xfffffff0(%ebp),%ecx
  40108b:       89 44 24 04             mov    %eax,0x4(%esp)
  40108f:       89 54 24 08             mov    %edx,0x8(%esp)
  401093:       89 4c 24 0c             mov    %ecx,0xc(%esp)
  401097:       c7 04 24 00 20 40 00    movl   $0x402000,(%esp)
  40109e:       e8 ad 00 00 00          call   401150 <_printf>

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]