develooper Front page | perl.perl5.porters | Postings from April 2007

[perl #42614] NAN_COMPARE_BROKEN.DIV_BY_NAN_BUG (with patch)

Thread Next
From:
patrick . dugnolle @ bnpparibas . com
Date:
April 19, 2007 08:19
Subject:
[perl #42614] NAN_COMPARE_BROKEN.DIV_BY_NAN_BUG (with patch)
Message ID:
rt-3.6.HEAD-6655-1176989657-125.42614-75-0@perl.org
# New Ticket Created by  patrick.dugnolle@bnpparibas.com 
# Please include the string:  [perl #42614]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42614 >


Hi,

using the latest devel perl which is correcting the NAN_COMPARE_BROKEN bug 
solved by Jan Dubois on Win32/MSVC6, I came accross the following bug:

perl -MPOSIX -e "print 1.0/pow(-1,0.5)" 

would trigger an "Illegal division by zero" error, instead of outputing 
"-1.#IND" (the string representation of NaN on Win32)

It appears that changes #27576 and #27577 introducing NAN_COMPARE_BROKEN 
are incomplete and need the following addendum

*** perl-5.9.4/pp.c     Tue Aug 15 14:37:41 2006
--- perl-5.9.4/pp.c     Thu Apr 19 14:29:22 2007
***************
*** 1276,1284 ****
      } /* right wasn't SvIOK */
  #endif /* PERL_TRY_UV_DIVIDE */
      {
!       dPOPPOPnnrl;
!       if (right == 0.0)
!           DIE(aTHX_ "Illegal division by zero");
        PUSHn( left / right );
        RETURN;
      }
--- 1276,1288 ----
      } /* right wasn't SvIOK */
  #endif /* PERL_TRY_UV_DIVIDE */
      {
!         dPOPPOPnnrl;
! #if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan)
!       if (! Perl_isnan(right) && right == 0.0)
! #else
!       if (right == 0.0)
! #endif
!             DIE(aTHX_ "Illegal division by zero");
        PUSHn( left / right );
        RETURN;
      }

Let me know if you need further information

Patrick DUGNOLLE

perlbug -d
---
Flags:
    category=
    severity=
---
Site configuration information for perl 5.9.4:

Configured by 225028 at Thu Apr 19 10:57:25 2007.

Summary of my perl5 (revision 5 version 9 subversion 4) configuration:
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT 
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='12.00.8804', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf 
-libpath:"c:\Appli\GTS\Dev\Perl\lib\CORE"  -machine:x86'
    libpth=C:\PROGRA~1\MICROS~3\VC98\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib 
uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib 
msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib 
uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib 
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl59.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf  -libpath:"c:\Appli\GTS\Dev\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
 

---
@INC for perl 5.9.4:
    C:/Appli/GTS/Dev/Perl/lib
    C:/Appli/GTS/Dev/Perl/site/lib
    .

---
Environment for perl 5.9.4:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=C:\Appli\GTS\Dev\Perl\bin;C:\PROGRA~1\MICROS~3\Common\msdev98\BIN;C:\PROGRA~1\MICROS~3\VC98\BIN;C:\PROGRA~1\MICROS~3\Common\TOOLS\WINNT;C:\PROGRA~1\MICROS~3\Common\TOOLS;C:\Perl\site\bin;C:\Perl\bin;C:\Perl\bin\;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\infAppdata\Notes\data;C:\Program 
Files\IDEpro\Ultraedit92\;C:\Program Files\Microsoft SQL 
Server\80\Tools\BINN;C:\Program 
Files\OpenSource\PuTTY;X:\Appli\Gts\Gnu32\Bin
    PERL_BADLANG (unset)
    SHELL (unset)


This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About