Bug 97562

Summary: python miscompiled on ppc64
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Marcus Meissner <meissner>
Component: DevelopmentAssignee: Michael Matz <matz>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: jmatejek, matz
Version: Stable Snapshot 2   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: gcc testcase

Description Marcus Meissner 2005-07-21 08:33:43 UTC
python is somehow miscompiled on ppc64.  
  
the test_long testcase fails in the log10 test 
 
 
After build, do: 
cd /usr/src/packages/BUILD/Python-2.4.1 
echo "test_long" > /tmp/pynexttest 
LD_LIBRARY_PATH=/usr/src/packages/BUILD/Python-2.4.1: ./python -E 
-tt ./Lib/test/regrtest.py -s -v -v 
... 
 
log10 is  9.0 , exp is  9 
verified 
log is  
20.7232658369 
verified 
log10 is  18.7219011707 , exp is  100 
test test_long failed -- test failed 
 
 
so soemthing in log10 or exp is broken. I did not investigate deeper.
Comment 1 Michael Matz 2005-07-21 13:46:41 UTC
Without testcase this could either be glibc or gcc, or anything else. 
Assigning to ppc for stripping down. 
Comment 2 Jiri Dluhos 2005-07-27 10:53:20 UTC
LSB Python (which is Python 2.3.3 compiled only with LSB libraries) has the same
problem on ppc64. I think this could be a bug in the Python itself.

I have added a bug report to the Python developer bugzilla; you can find it at

http://sourceforge.net/tracker/index.php?func=detail&aid=1245381&group_id=5470&atid=105470
Comment 3 Olaf Hering 2005-08-01 09:18:07 UTC
assiging to package maintainer
Comment 4 Lukas Tinkl 2005-10-03 10:48:57 UTC
new maintainer 
Comment 5 Jan Matejek 2005-10-12 11:47:09 UTC
i'm not sure if this should be still open - the bug is caused by gcc's incorrect
optimization, and in our package that is already disabled, so it compiles fine
Comment 6 Marcus Meissner 2005-10-12 12:02:00 UTC
no, broken optimization concern us, -O0 is just a workaround.  
  
Can you extract a standalone testcase for this miscompilation? 
 
If you cannot, either the Architecture Team or the Compiler Team should do it. 
Comment 7 Jan Matejek 2005-10-12 12:15:35 UTC
i cannot, i don't have access to any ppc64 machine to test it on
Comment 8 Jiri Dluhos 2005-10-12 12:18:57 UTC
I have borrowed papaya.suse.de for LSB testing, you can test it there; it
happens there, I see it in the tests.
Comment 9 Jan Matejek 2005-10-12 12:44:47 UTC
ok, i'm working on it
Comment 10 Olaf Hering 2005-10-12 13:17:54 UTC
if you have a testcase, or just which file needs the -O0, we want to hear it.
Comment 11 Jan Matejek 2005-10-13 18:12:21 UTC
Created attachment 53970 [details]
gcc testcase

the file is Modules/mathmodule.c and the optimization is definitely playing havoc in there.

attached is a stripped down version of that file - as far as i could get. it's not a standalone testcase, you still need the rest of python to use it, and it only works for the following test:

import math;
print math.log (10**40, 10)

should print out something very close to 40 (I lost precision when replacing some result with a constant), and usually prints 21.9382011462

on gcc 3.3.x it works all right, bug appears on gcc 4.0.2

the part that gets optimized out is
x = func(x) + (e * (double)SHIFT) * func(2.0);
which is reduced to
x = func(x);
Comment 12 Jan Matejek 2005-10-17 09:58:30 UTC
maybe this should be reassigned to the gcc team now?
Comment 13 Olaf Hering 2005-10-18 11:32:47 UTC
yes, if -O$smallnum works and -O$bignum doesnt, its likely a gcc bug.
Comment 14 Jan Matejek 2005-10-18 14:34:58 UTC
that's exactly the case. assigning back to michael matz
Comment 15 Marcus Meissner 2005-10-18 14:53:45 UTC
however the gcc team needs a standalone testcase I guess
Comment 16 Michael Matz 2005-11-07 14:39:32 UTC
Indeed.  If you know already the place where you think GCC does some
misoptimization (as indicated in comment #11), it shouldn't be difficult to
generate a single-file testcase.  Please provide one here.
Comment 17 Jan Matejek 2005-11-25 19:57:41 UTC
hopefully, the bug seems to have disappeared by now and compilation on ppc64 is OK.
marcus, can you please confirm?
Comment 18 Jan Matejek 2005-11-25 19:58:45 UTC
(sorry about the status change, I meant to do this)
Comment 19 Marcus Meissner 2005-11-28 06:32:08 UTC
its gone now, yes.

curre