Closed p5pRT closed 10 years ago
Firstly\, rename {max\,j} -> {j\,n} since j as the count is very confusing.
The j > SSize_t_MAX cannot (usually) fire.
If the IV and SSize_t are the same (very likely) the count (an IV) cannot be larger than the max of SSize_t.
If IV is larger than SSize_t (e.g. long longs for IVs but only 32-bit pointers available) the count could conceivably be larger than the max of SSize_t\, but we still need to correctly dance around the max: the signed maxima are tricky since we should not depend on any particular overflow/wraparound behavior.
If IV is smaller than SSize_t (I32 for IV but 64-bit pointers available: sounds unlikely\, but possible)\, the count again cannot be larger than the max.
NOTE: this logic only protects against the wraparound\, not against an OOM: we will run out of memory long before we create SSize_t_MAX SVs. There is nothing magical about SSize_t as such\, except that it is a likely wraparound spot.
On Fri May 16 08:53:53 2014\, jhi wrote:
the signed maxima are tricky since we should not depend on any particular overflow/wraparound behavior.
Before we go adding complexity to fix Perl to run on ANSI C Virtual Machine\, does Perl run on any 1s complement CPUs?
-- bulk88 ~ bulk88 at hotmail.com
The RT System itself - Status changed from 'new' to 'open'
On Friday-201405-16\, 15:12\, bulk88 via RT wrote:
Before we go adding complexity to fix Perl to run on ANSI C Virtual Machine\, does Perl run on any 1s complement CPUs?
You may curse the gods of ANSI but they are not hearing our pleas: the signed behavior of is not a defect: http://blog.regehr.org/archives/1149
I'm pretty certain Perl's code is beyond redemption for one's complement machines. In early eighties CDC Cybers were still around (though their prime time was 1970s)\, and they were one's complement machines\, or so I hear (I was busy programming in Z80 assembler\, so cannot vouch for it).
On 05/16/2014 07:41 PM\, Jarkko Hietaniemi wrote:
CDC Cybers were still around (though their prime time was 1970s)\, and they were one's complement machines\, or so I hear
I can confirm that CDC machines were 1's complement; I imagine Crays as well\, but can't remember for sure.
On Fri\, May 16\, 2014 at 08:53:53AM -0700\, Jarkko Hietaniemi wrote:
If IV is smaller than SSize_t (I32 for IV but 64-bit pointers available: sounds unlikely\, but possible)\, the count again cannot be larger than the max.
This can't be true.
IVs are used to hold pointers and are always at least as large as a pointer.
(I haven't looked at the patch yet.)
Tony
On Saturday-201405-17\, 0:08\, Tony Cook wrote:
On Fri\, May 16\, 2014 at 08:53:53AM -0700\, Jarkko Hietaniemi wrote:
If IV is smaller than SSize_t (I32 for IV but 64-bit pointers available: sounds unlikely\, but possible)\, the count again cannot be larger than the max.
This can't be true.
IVs are used to hold pointers and are always at least as large as a pointer.
Right. So doubly cannot be true.
On Friday-201405-16\, 23:46\, Karl Williamson wrote:
On 05/16/2014 07:41 PM\, Jarkko Hietaniemi wrote:
CDC Cybers were still around (though their prime time was 1970s)\, and they were one's complement machines\, or so I hear
I can confirm that CDC machines were 1's complement; I imagine Crays as well\, but can't remember for sure. .
Early Crays\, possibly\, they were contemporaries with Cyber and could have had "compatibility". But already C90 and T3D were firmly two's complement. Cray over their history has been through many wildly different implementations.
On Saturday-201405-17\, 0:09\, Tony Cook via RT wrote:
On Fri\, May 16\, 2014 at 08:53:53AM -0700\, Jarkko Hietaniemi wrote:
If IV is smaller than SSize_t (I32 for IV but 64-bit pointers available: sounds unlikely\, but possible)\, the count again cannot be larger than the max.
This can't be true.
IVs are used to hold pointers and are always at least as large as a pointer.
(I haven't looked at the patch yet.)
Updated patch attached. (Only diddled with the commit message.)
Tony
On Mon May 19 15:01:05 2014\, jhi wrote:
On Saturday-201405-17\, 0:09\, Tony Cook via RT wrote:
On Fri\, May 16\, 2014 at 08:53:53AM -0700\, Jarkko Hietaniemi wrote:
If IV is smaller than SSize_t (I32 for IV but 64-bit pointers available: sounds unlikely\, but possible)\, the count again cannot be larger than the max.
This can't be true.
IVs are used to hold pointers and are always at least as large as a pointer.
(I haven't looked at the patch yet.)
Updated patch attached. (Only diddled with the commit message.)
Applied as b262c4c91294fc9179a7343473b880ca445c4e43 by Jarkko.
Tony
@tonycoz - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#121896 (status was 'resolved')
Searchable as RT121896$