delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/07/27/12:51:28

X-Spam-Check-By: sourceware.org
Message-ID: <46AA2279.DE063CDA@dessent.net>
Date: Fri, 27 Jul 2007 09:51:05 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin Perl and -Duselongdouble
References: <B762313E2F744EE8A72B2113F081D0D3 AT desktop2> <46A8939C DOT 340DF017 AT dessent DOT net> <11CF7C4D0D334F4EBC16B015D7CB1993 AT desktop2> <46A8ABD9 DOT 4AABEABF AT dessent DOT net> <780856ABB39B4C7F98A74B7131E4932C AT desktop2>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019