Michael G Schwern wrote:
On Wed, Jun 22, 2005 at 11:24:12AM -0000, Piotr Fusik wrote:

The "x" operator gives an unexpected result (i.e. null string)
with large right side operands.

perl580 -le "print 1x1e8 ne '' ? 'ok' : 'not ok'"
ok

perl580 -le "print 1x1e9 ne '' ? 'ok' : 'not ok'"
(crash)


I believe the issue is you're trying to allocate a string of 1 billion characters, consuming about a gig of memory, and simply running out. This falls under the "don't do that" category.



perl580 -le "print 1x1e10 ne '' ? 'ok' : 'not ok'"
not ok


Though I can't explain why this doesn't crash, too.

1e9 < 2**31 but 1e10 > 2**31 so it overflows when converted to an IV on 32 bits platforms.

Cheers,

  - Salvador

Reply via email to