> Old-Status: Open
> Status: Bogus
> <?php
> $var=-1073741824;
> #####^ Here!
>
> $var*=2;$var*=2;
> var_dump($var);
> ?>
> It will print out "int(0)".
> but I believe it should print out"int(-2147483648)" or
"float(-2147483648)" like this program:

IMO the output is wrong indeed. On integer overflow, it should be
automatically converted to float.

In zend_operators.c, line 614. there is only a check for integer addition
overflow towards POSITIVE infinity, NOT the other way around.

Same story with substraction and multiplication (the latter one being the
issue here.)

I'll submit a patch later today.

Jeroen



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to