delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/30/13:31:15

X-Spam-Check-By: sourceware.org
Message-ID: <ba40711f0611301030o1c685b27hbbd7620b3cd2f473@mail.gmail.com>
Date: Thu, 30 Nov 2006 13:30:51 -0500
From: "Lev Bishop" <lev DOT bishop AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: isnan() causes segfault
In-Reply-To: <ekmm5a$fcm$1@sea.gmane.org>
MIME-Version: 1.0
References: <ekmm5a$fcm$1 AT sea DOT gmane DOT org>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 11/30/06, Eric Lilja wrote:
> If compiled with:
> $ g++ -Wall -Wextra -std=c++98 -pedantic -g isnantest.cpp -o run
> (those are the flags we have been using in this course).
> But it doesn't stackdump if compiled simply with:
> $ make isnantest
> g++     isnantest.cpp   -o isnantest

I was able to reproduce this behaviour.

There seems to be a difference in the generated assembler.
The -std=c++98 seems to be the only switch that matters.
Here is a diff. File isnantest2.s is the stackdumping one (ie the one
with -std=c++98)

--- isnantest.s 2006-11-30 13:14:12.718750000 -0500
+++ isnantest2.s        2006-11-30 13:26:55.984375000 -0500
@@ -1,4 +1,4 @@
-       .file   "isnantest.cpp"
+       .file   "isnantest2.cpp"
        .def    ___main;        .scl    2;      .type   32;     .endef
        .text
        .align 2
@@ -47,12 +47,9 @@
        movl    %esp, %ebp
        subl    $8, %esp
        movl    8(%ebp), %eax
-       movl    %eax, -4(%ebp)
-       fildl   -4(%ebp)
-       fstps   (%esp)
-       call    ___isnanf
+       movl    %eax, (%esp)
+       call    __ZN9__gnu_cxx5isnanIiEEiT_
        leave
        ret
-       .def    ___isnanf;      .scl    3;      .type   32;     .endef
        .def    __ZN9__gnu_cxx15__capture_isnanIiEEiT_; .scl    3;
 .type   32;     .endef
        .def    __ZN9__gnu_cxx5isnanIiEEiT_;    .scl    3;      .type   32;
.endef

Lev

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