[Python-bugs-list] [ python-Bugs-458941 ] Looks like a unary minus bug

noreply@sourceforge.net noreply@sourceforge.net
Wed, 05 Sep 2001 19:50:33 -0700


Bugs item #458941, was opened at 2001-09-05 16:29
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=458941&group_id=5470

Category: Parser/Compiler
Group: Python 2.2
Status: Open
Resolution: None
Priority: 6
Submitted By: Tim Peters (tim_one)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Looks like a unary minus bug

Initial Comment:
The attached program should print the same stuff in 
both calls to drive().  It actually prints

Using literals:
0.0
0.0
0.0
0.0

Using computation:
0.0
3.14159265359
0.0
-3.14159265359

on Windows.

The disassembly of driver() suggests the compiler is 
optimizing

-0.0

into

0.0, but the sign of a *floating* zero is significant.

This works as expected in 2.1.1; the behavior changed 
after that.

----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2001-09-05 19:50

Message:
Logged In: YES 
user_id=44345

>From the checkin comments, it looks like v 2.216 of
Python/compile.c is the culprit.  Getting rid of
com_invert_constant and reverting com_factor to the version
from 2.215 fixes the problem.  Looks like it was strictly an
optimization, so it can probably be safely removed.



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=458941&group_id=5470