Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.91k stars 543 forks source link

[PATCH] isnan identifier can't be used as a var #14369

Closed p5pRT closed 9 years ago

p5pRT commented 9 years ago

Migrated from rt.perl.org#123502 (status was 'resolved')

Searchable as RT123502$

p5pRT commented 9 years ago

From @bulk88

Created by @bulk88

See attached patch. CPP output below to explain error.

C​:\perl521\srcnewb4opt\win32>nmake ..\pp_sys.i

OP * Perl_pp_gmtime(PerlInterpreter* my_perl ) {   SV **sp = (my_perl->Istack_sp);   Time64_T when;   struct TM64 tmbuf;   struct TM64 *err;   const char *opname = (my_perl->Iop)->op_type == OP_LOCALTIME ? "localtime" : "gmtime";   static const char * const dayname[] =   {"Sun"\, "Mon"\, "Tue"\, "Wed"\, "Thu"\, "Fri"\, "Sat"};   static const char * const monname[] =   {"Jan"\, "Feb"\, "Mar"\, "Apr"\, "May"\, "Jun"\,   "Jul"\, "Aug"\, "Sep"\, "Oct"\, "Nov"\, "Dec"};

  if (((my_perl->Iop)->op_private & 0x0f) \< 1 || (!(*sp) && ((void)(*sp--)\, 1))) {   time_t now;   (void)time(&now);   when = (Time64_T)now;   }   else {   NV input = floor(((((my_perl->ISv) = ((*sp--)))\, (((((my_perl->ISv))->sv_flags & (0x00000200|0x00200000)) == 0x00000200) ? ((XPVNV*) ((my_perl->ISv))->sv_any)->xnv_u.xnv_nv : Perl_sv_2nv_flags(my_perl\, (my_perl->ISv)\,2)))));   const char _isnan = _isnan(input);   when = (Time64_T)input;   if ((((_isnan || when != input) ? (char)1 : (char)0))) {  
  Perl_ck_warner(my_perl\, (15 )\,   "%s(%.0" "f" ") too large"\, opname\, input);   if (_isnan) {   err = 0;   goto failed;   }   }   }

Perl Info ``` Flags: category=core severity=low Site configuration information for perl 5.21.7: Configured by Owner at Sat Nov 22 21:54:54 2014. Summary of my perl5 (revision 5 version 21 subversion 7) configuration: Local Commit: 1bce52df028aabe28c20b2d97949e35c17ea811e Ancestor: 7072da8afeba4c87ae623cd913e274396ffcf1cd 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 use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -G7 -GL -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_HASH_FUNC_ONE_AT_A_TIME -DNO_MATHOMS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T', optimize='-O1 -MD -Zi -DNDEBUG -G7 -GL', cppflags='-DWIN32' ccversion='13.10.6030', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234, doublekind=3 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=0 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 -ltcg -libpath:"c:\perl521\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\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 comctl32.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 comctl32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl521.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl521\lib\CORE" -machine:x86' Locally applied patches: ce7a4d57d0acca9f39a84d36d708c4505dfe45ca ca0b263f4b167ddf97416f657d79ab5bd3344357 08919bf863666074243240abbd19cd1a74cc7b74 b8a043377dbf39548709b107a11e5cc2714c0e9a efa855eb5cffb7739616c295dd968d1510efeeb0 1d47d0b810e26d9a2f9101fb813bd5b3dd332cc9 3faca062ddb056db54f73fa55b0a9d473675dd33 0b3e905bda3e75ad948a1213f620656b60807393 1b1efc719fde05d215e5a13fb38c03e12a3aab08 1bce52df028aabe28c20b2d97949e35c17ea811e @INC for perl 5.21.7: ..\lib C:/perl521/srcnewb4opt/lib . Environment for perl 5.21.7: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\WINDOWS\system32;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\WINDOWS;C:\Program Files\Git\cmd;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin;C:\perl\bin PERL_BADLANG (unset) PERL_JSON_BACKEND=Cpanel::JSON::XS PERL_YAML_BACKEND=YAML SHELL (unset) ```
p5pRT commented 9 years ago

From @bulk88

0001-isnan-identifier-can-t-be-used-as-a-var.patch ```diff From c5c6bb9c25dc43920cc4c6bb8d5026d3a28a3512 Mon Sep 17 00:00:00 2001 From: Daniel Dragan Date: Fri, 26 Dec 2014 00:34:03 -0500 Subject: [PATCH] isnan identifier can't be used as a var cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -O1 -MD -Zi -DNDEBUG -G7 -GL -DPERL_EXTE RNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\pp_sys.obj ..\pp_sys.c pp_sys.c ..\pp_sys.c(4610) : error C2063: '_isnan' : not a function NMAKE : fatal error U1077: 'cl' : return code '0x2' See RT ticket for details. --- pp_sys.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pp_sys.c b/pp_sys.c index da69cb0..aa006e6 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4607,13 +4607,13 @@ PP(pp_gmtime) } else { NV input = Perl_floor(POPn); - const bool isnan = Perl_isnan(input); + const bool pl_isnan = Perl_isnan(input); when = (Time64_T)input; - if (UNLIKELY(isnan || when != input)) { + if (UNLIKELY(pl_isnan || when != input)) { /* diag_listed_as: gmtime(%f) too large */ Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), "%s(%.0" NVff ") too large", opname, input); - if (isnan) { + if (pl_isnan) { err = NULL; goto failed; } -- 1.7.9.msysgit.0 ```
p5pRT commented 9 years ago

From @cpansprout

On Thu Dec 25 21​:39​:00 2014\, bulk88 wrote​:

This is a bug report for perl from bulk88@​hotmail.com\, generated with the help of perlbug 1.40 running under perl 5.21.7.

----------------------------------------------------------------- [Please describe your issue here]

See attached patch. CPP output below to explain error.

Thank you. I was rather puzzled by that failure. I have applied your patch as 2b9215fdb83c9.

--

Father Chrysostomos

p5pRT commented 9 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 9 years ago

@cpansprout - Status changed from 'open' to 'resolved'