summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2018-02-20 16:18:05 +1100
committerTony Cook <tony@develop-help.com>2018-03-07 15:52:36 +1100
commit32ce30d709666239149a4f04ddcfbdec00005288 (patch)
treed25986bec1fd354c0fcad2340b010e38df36c146 /dist
parent814eedc877a5aa1dbba0047735733e9491aa94a4 (diff)
downloadperl-32ce30d709666239149a4f04ddcfbdec00005288.tar.gz
(perl #132870) workaround 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. This change needs no further tests, the integer.t fails without this workaround.
Diffstat (limited to 'dist')
-rw-r--r--dist/Storable/Storable.xs6
1 files changed, 6 insertions, 0 deletions
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" */