
nick at ccl4
May 16, 2008, 12:00 PM
Post #2 of 2
(59 views)
Permalink
|
|
Re: div by zero folding deferred to run-time
[In reply to]
|
|
On Fri, May 16, 2008 at 10:57:35AM -0400, Eric Brine wrote: > Hello, > Division by zero exceptions that occur during constant folding are > being deferred to run-time. Is that intentional or is that a > regression? It's intentional. Constant folding is an optimisation, and optimisations shouldn't make a difference to the execution of the program. Compile time exceptions (or warnings - fixed that too) violate that. It means that division by zero in code that will never be executed can now be compiled at all. For example, anything that defines constants that on some platforms happen to be zero, but that code isn't run on those platforms. Effectively, anything that reduces to $ ./perl -Ilib -le 'use constant A => 0;' -e 'print 4/A if A; print $]; print A' 5.011000 0 Nicholas Clark
|