Gurusamy Sarathy <gsar@engin.umich.edu> writes:
> On 01 Jul 1997 20:49:15 +0200, Gisle Aas wrote:
> >The following patch (relative to perl5.004) makes this bug go away.
> >Perl still passes all it's tests and the original example works as it
> >did in perl5.003.
> >
> >--- sv.c.orig Tue Jul 1 20:26:40 1997
> >+++ sv.c Tue Jul 1 20:38:13 1997
> >@@ -1713,6 +1713,7 @@
> > sv_upgrade(sv, SVt_PVIV);
> > olderrno = errno; /* some Xenix systems wipe out errno here */
> > sv_setpvf(sv, "%Vd", SvIVX(sv));
> >+ SvIOK_on(sv); /* it is still valid */
> > errno = olderrno;
> > s = SvEND(sv);
> > }
>
> That should restore precisely those flags that were active
> before sv_setpvf() was called. eg: the case where {pIOK,NOK,pNOK}
> are set, the resulting SV should have {pPOK,POK,pIOK,NOK,pNOK}
> set.
NOK or pNOK can't be set at this point. The only possibility is that
pIOK is set and not IOK (but I don't know how can I trigger this
condition?)
This patch should then be safer (it also passes all tests):
p5p-msgid: hbu4l96z2.fsf@bergen.sn.no
#endif
}
else if (SvIOKp(sv)) {
+ U32 oldIOK = SvIOK(sv);
if (SvTYPE(sv) < SVt_PVIV)
sv_upgrade(sv, SVt_PVIV);
olderrno = errno; /* some Xenix systems wipe out errno here */
sv_setpvf(sv, "%Vd", SvIVX(sv));
errno = olderrno;
s = SvEND(sv);
+ if (oldIOK)
+ SvIOK_on(sv);
+ else
+ SvIOKp_on(sv);
}
else {
if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))