Closed p5pRT closed 20 years ago
In Digital UNIX the IsUV flag somehow vanished between 5.6.0 and 5.7.0.
$ LD_LIBRARY_PATH=$PWD ./perl -Ilib -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140013cf8) at 0x140013870 REFCNT = 1 FLAGS = (IOK\,pIOK) IV = 9223372036854775807 $
No IsUV in FLAGS. Now watch the same with 5.6.0:
$ perl -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140014100) at 0x140022900 REFCNT = 1 FLAGS = (IOK\,pIOK\,IsUV) UV = 9223372036854775808 $
The IsUV knowledge is there\, it works with constants:
$ LD_LIBRARY_PATH=$PWD ./perl -Ilib -MDevel::Peek -e 'print Dump(9223372036854775808)' SV = IV(0x140013cf0) at 0x140001af0 REFCNT = 1 FLAGS = (IOK\,READONLY\,pIOK\,IsUV) UV = 9223372036854775808
The bug is OS-specific since in Solaris with 5.7.0:
$ perl -MDevel::Peek -e '$a=2147483648;print Dump($a)' SV = IV(0xffc7c) at 0x100834 REFCNT = 1 FLAGS = (IOK\,pIOK\,IsUV) UV = 2147483648
In Digital UNIX the IsUV flag somehow vanished between 5.6.0 and 5.7.0.
Please ignore/close the bug report since it's a *good* thing that the IsUV vanished from the below example: that is according to the plan. It is a good thing that Perl prefers IVs over UVs (why? because many things in the internals have been optimized for IVs\, not UVs). Move along\, there is nothing in here for you to see.
Perhaps I really shouldn't touch the code before my vacation... :-)
$ LD_LIBRARY_PATH=$PWD ./perl -Ilib -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140013cf8) at 0x140013870 REFCNT = 1 FLAGS = (IOK\,pIOK) IV = 9223372036854775807 $
Jarkko Hietaniemi \jhi@​cc\.hut\.fi wrote
In Digital UNIX the IsUV flag somehow vanished between 5.6.0 and 5.7.0.
$ LD_LIBRARY_PATH=$PWD ./perl -Ilib -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140013cf8) at 0x140013870 REFCNT = 1 FLAGS = (IOK\,pIOK) IV = 9223372036854775807 ^^^ $
No IsUV in FLAGS. Now watch the same with 5.6.0:
$ perl -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140014100) at 0x140022900 REFCNT = 1 FLAGS = (IOK\,pIOK\,IsUV) UV = 9223372036854775808 ^^^ $
You may have decided that this change isn't a bug\, but what about the change in numerical value? Presumably 5.6.0 was broken?
Mike Guy
$ LD_LIBRARY_PATH=$PWD ./perl -Ilib -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140013cf8) at 0x140013870 REFCNT = 1 FLAGS = (IOK\,pIOK) IV = 9223372036854775807 ^^^ $
No IsUV in FLAGS. Now watch the same with 5.6.0:
$ perl -MDevel::Peek -e '$a = 9223372036854775807;print Dump($a)' SV = IV(0x140014100) at 0x140022900 REFCNT = 1 FLAGS = (IOK\,pIOK\,IsUV) UV = 9223372036854775808 ^^^ $
You may have decided that this change isn't a bug\, but what about the change in numerical value? Presumably 5.6.0 was broken?
Sharp eyes\, I must have missed that one because since I was only staring at the IsUV flag. Yes\, 5.6.0 was definitely broken also in this sense. It seems that the conversion is really\, *really*\, broken (lossy):
$ perl -MDevel::Peek -le '$a = 9223372036854775800;print Dump($a);print $a' SV = IV(0x140014cf8) at 0x140028d28 REFCNT = 1 FLAGS = (IOK\,pIOK\,IsUV) UV = 9223372036854775808
9223372036854775808 $
Must be going through NVs or something....(IV eq long eq 64 bits in Digital UNIX so no strtol/strtoul could create mess like that). I think I will add some tests to 64bitint to guard against this happening again in future.
note that 5.6.0 had it wrong\, now there are tests in op/64bitint to guard against the badness coming back.
Migrated from rt.perl.org#4248 (status was 'resolved')
Searchable as RT4248$