[issue3168] cmath test fails on Solaris 10
Jean Brouwers
report at bugs.python.org
Sat Jul 5 01:38:42 CEST 2008
Jean Brouwers <MrJean1 at Gmail.com> added the comment:
Below is the reply from SUN. It was indeed a bug which has been fixed already.
I have not yet applied the patches to my SUN compilers and tried again.
/Jean
Begin forwarded message:
From: Sun Microsystems <IncidentUpdateDaemon at sun.com>
Date: July 1, 2008 3:51:17 PM PDT
Subject: Re: (Incident Review ID: 1284413) Sun C 5.8 optimization bug for 64-bit Opteron
--- Note: you can send us updates about your Incident ---
--- by replying to this mail. Place new information ---
--- above these lines. Do not include attachments. ---
--- Our system ignores attachments and anything below ---
--- these lines. ---
Hi Jean Brouwers,
We appreciate your feedback. Using your sample I was able to get the correct results using Sun
Studio 12. This may indicate that the issue was also fixed in a backported patch to Studio 11 (Sun
C 5.8). Check to be sure that the latest patches have been applied to your installation. See:
<http://developers.sun.com/sunstudio/downloads/patches/ss11_patches.html>
Regards,
Brad Mayer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: This message, including any attachments, is for the intended
recipient(s) only. If you are not the intended recipient(s), please
reply to the sender, delete this message, and refrain from disclosing,
copying, or distributing this message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--------------- Previous Messages ----------------
--------------------- Report ---------------------
category : c
subcategory : compiler
release : other
type : bug
synopsis : Sun C 5.8 optimization bug for 64-bit Opteron
customer name : Jean Brouwers
sdn id :
language : en
hardware : x86
os : sol2.5.1
bug id : 0
date created : Sun Jun 29 11:49:10 MST 2008
date evaluated : Tue Jul 01 15:41:10 MST 2008
description :
FULL PRODUCT VERSION :
which cc
/opt/SUNWspro/bin/cc
cc -V
cc: Sun C 5.8 2005/10/13
ADDITIONAL OS VERSION INFORMATION :
uname -a
SunOS unknown 5.10 Generic_118855-14 i86pc i386 i86pc
EXTRA RELEVANT SYSTEM CONFIGURATION :
Solaris 10 on an Ultra20 Opteron machine.
A DESCRIPTION OF THE PROBLEM :
At higher optimization levels, the Sun C compiler does not handle certain function call patterns
correctly. Specifically, the values of complex_t variables q and r in the code snippet below are
different.
typedef struct {
double real;
double imag;
} complex_t;
complex_t c_comp(double real);
complex_t c_quot(complex_t a, complex_t b);
...
complex_t_t x, y, q, r;
x = c_comp(4.6051701859880918);
y = c_comp(0.69314718055994529);
q = c_quot(x, y);
r = c_quot(x, c_comp(0.6931471805599452));
...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See the attached test case. Instructions are included inside.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
rm a.out ; cc -xtarget=native64 -xO0 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
6.643856 + j 0.000000
ACTUAL -
rm a.out ; cc -xtarget=native64 -xO3 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
Inf + j 0.000000
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/* Split this file in 3 separate file, c_main.c, c_quot.h and
c_quot.c. Compile with and without optimization using Sun
C 5.8 compiler on Solaris 10 (Opteron) and run as follows.
rm a.out ; cc -xtarget=native64 -xO0 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
6.643856 + j 0.000000
rm a.out ; cc -xtarget=native64 -xO1 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
6.643856 + j 0.000000
rm a.out ; cc -xtarget=native64 -xO2 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
6.643856 + j 0.000000
rm a.out ; cc -xtarget=native64 -xO3 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
Inf + j 0.000000
rm a.out ; cc -xtarget=native64 -xO4 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
Inf + j 0.000000
rm a.out ; cc -xtarget=native64 -xO5 c_main.c c_quot.c -lm ; ./a.out
c_main.c:
c_quot.c:
6.643856 + j 0.000000
Inf + j 0.000000
*/
------------------ save as c_main.c -----------------
#include <stdio.h>
#include "c_quot.h"
int main(int argc, char* argv[])
{
complex_t x, y, q, r;
x = c_comp(4.6051701859880918);
y = c_comp(0.69314718055994529);
q = c_quot(x, y);
/* expect: 6.643856 + j 0.000000 */
printf("%f + j %f\n", q.real, q.imag);
x = c_comp(4.6051701859880918);
y = c_comp(0.69314718055994529);
r = c_quot(x, c_comp(0.6931471805599452));
/* expect: 6.643856 + j 0.000000, but ... */
printf("%f + j %f\n", r.real, r.imag);
}
------------------ save as c_quot.h -----------------
typedef struct {
double real;
double imag;
} complex_t;
complex_t c_comp(double real);
complex_t c_quot(complex_t a, complex_t b);
------------------ save as c_quot.c -----------------
#include "c_quot.h"
complex_t
c_comp(double real)
{
complex_t c;
c.real = real;
c.imag = 0.0; /* ignore imag */
return c;
}
complex_t
c_quot(complex_t a, complex_t b)
{
complex_t r;
r.real = a.real / b.real;
r.imag = 0.0; /* ignore imag */
return r;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Compiling with -xO... less than 3 avoids the problem.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3168>
_______________________________________
More information about the Python-bugs-list
mailing list