New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storable dclone() broken (latest VS 2017 32-bit) #16421
Comments
From jacques.germishuys@gmail.comCreated by jacques.germishuys@gmail.comThe following program shows that freeze() and thaw() is currently use Data::Dumper; my $x = print Dumper ($x); my $y = dclone ($x); print Dumper ($y); Output: $VAR1 = { The value of 1 got changed to -255. I've also seen 0 change to -256! Perl Info
|
From jacques.germishuys@gmail.comOn Thu, 15 Feb 2018 05:11:22 -0800, jacques.germishuys@gmail.com wrote:
I've confirmed that the 64-bit version of the compiler has exactly the same problem. The 15.4 series of Visual Studio 2017 does not exhibit this behaviour, so far I've only seen it with the 15.5 series. |
From @tonycozOn Thu, 15 Feb 2018 05:11:22 -0800, jacques.germishuys@gmail.com wrote:
Reproduced in blead: J:\dev\perl\git\perl>.\perl -Ilib -MStorable=dclone -MData::Dumper -le "$x = { a => 1 }; print Dumper(dclone($x))" J:\dev\perl\git\perl>cl Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Sun, 18 Feb 2018 18:32:32 -0800, tonyc wrote:
I suspect the compiler is being confused by the AIX compiler workaround. The attached patch prevented the issue for me. Considering tmp is a signed char (limited to -128 through 127), this can only be a compiler bug. Tony |
From @tonycoz0001-perl-132870-workaround-possibe-VC2017-compiler-bug.patchFrom 670e7f513fc6b52eddde46ff414d339dc021c02f Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 20 Feb 2018 16:18:05 +1100
Subject: (perl #132870) workaround possibe VC2017 compiler bug
For non-debug builds MSVC could read small integers like 1 as -255.
It's possible it was confused by the AIX compiler bug workaround.
---
dist/Storable/Storable.xs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dist/Storable/Storable.xs b/dist/Storable/Storable.xs
index df0c433b0e..45af7be210 100644
--- a/dist/Storable/Storable.xs
+++ b/dist/Storable/Storable.xs
@@ -6106,14 +6106,20 @@ static SV *retrieve_byte(pTHX_ stcxt_t *cxt, const char *cname)
SV *sv;
HV *stash;
int siv;
+#ifndef _MSC_VER
signed char tmp; /* Workaround for AIX cc bug --H.Merijn Brand */
+#endif
TRACEME(("retrieve_byte (#%d)", (int)cxt->tagnum));
GETMARK(siv);
TRACEME(("small integer read as %d", (unsigned char) siv));
+#ifdef _MSC_VER
+ sv = newSViv(siv - 128);
+#else
tmp = (unsigned char) siv - 128;
sv = newSViv(tmp);
+#endif
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
--
2.14.1.windows.1
|
From @tonycozOn Mon, 19 Feb 2018 21:22:55 -0800, tonyc wrote:
Applied as 32ce30d with a minor change to the commit message. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#132870 (status was 'resolved')
Searchable as RT132870$
The text was updated successfully, but these errors were encountered: