Skip to contentSkip to conversation

python-numpy: Fix compilation if HAVE_CEXPx is defined

PATCH New Alexey Brodkin 2 participants 2 messages Sep 20, 2017 – Sep 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python-numpy: Fix compilation if HAVE_CEXPx is defined

With update of Numpy to the latest version we've got one change which breaks Numpy compilcation in some cases.

This change back-ports upstrema fix from:
https://github.com/numpy/numpy/pull/9721

Cc Rahul Bedarkar <[email protected]>
Cc Gwenhael Goavec-Merou <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
Cc Peter Korsgaard <[email protected]>
---
 ...-Fix-compilation-if-HAVE_CEXPx-is-defined.patch | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/python-numpy/0003-MAINT-Fix-compilation-if-HAVE_CEXPx-is-defined.patch
package/python-numpy/0003-MAINT-Fix-compilation-if-HAVE_CEXPx-is-defined.patch new file +54 -0
new file mode 100644
index 0000000000..6efc6e9192
@@ -0,0 +1,54 @@
+From 587e3f4239807131c963fe2294988b12ed7fdc6d Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <[email protected]>
+Date: Wed, 20 Sep 2017 18:49:46 +0300
+Subject: [PATCH] MAINT: Fix compilation if HAVE_CEXPx is defined
+
+Commit c15f7747c78e ("MAINT: remove a bunch of compiler warnings")
+broke compilation if HAVE_CEXPx is defined with no good reason.
+
+The problem is with defined HAVE_CEXPx _npy_scaled_cexp() is never
+defined and compiler:
+ 1) Reports implicitly declared function
+ 2) Uses default return type "int" in equations like:
+      z = _npy_scaled_cexp at c@(absx, y, -1);
+    where z is "@ctype@" which might very well differ from int...
+ 3) ... and finally throws an error, see:
+--------------------------->8------------------------
+numpy/core/src/npymath/npy_math_complex.c.src: In function 'npy_ccoshl':
+numpy/core/src/npymath/npy_math_complex.c.src:643:17: warning: implicit declaration of function '_npy_scaled_cexpl' [-Wimplicit-function-declaration]
+             z = _npy_scaled_cexp at c@(absx, y, -1);
+                 ^~~~~~~~~~~~~~~~~
+numpy/core/src/npymath/npy_math_complex.c.src:643:15: error: incompatible types when assigning to type 'npy_clongdouble {aka struct <anonymous>}' from type 'int'
+             z = _npy_scaled_cexp at c@(absx, y, -1);
+--------------------------->8------------------------
+               ^
+
+Signed-off-by: Alexey Brodkin <[email protected]>
+---
+ numpy/core/src/npymath/npy_math_complex.c.src | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/numpy/core/src/npymath/npy_math_complex.c.src b/numpy/core/src/npymath/npy_math_complex.c.src
+index a82a6737c..f2b391394 100644
+--- a/numpy/core/src/npymath/npy_math_complex.c.src
++++ b/numpy/core/src/npymath/npy_math_complex.c.src
+@@ -184,8 +184,6 @@ npy_carg at c@(@ctype@ z)
+ #define SCALED_CEXP_LOWERL 11357.216553474703895L
+ #define SCALED_CEXP_UPPERL 22756.021937783004509L
+ 
+-#ifndef HAVE_CEXP at C@
+-
+ static
+ @ctype@
+ _npy_scaled_cexp at c@(@type@ x, @type@ y, npy_int expt)
+@@ -212,6 +210,7 @@ _npy_scaled_cexp at c@(@type@ x, @type@ y, npy_int expt)
+                          npy_ldexp at c@(mant * mantsin, expt + exsin));
+ }
+ 
++#ifndef HAVE_CEXP at C@
+ @ctype@
+ npy_cexp at c@(@ctype@ z)
+ {
+-- 
+2.11.0
+
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 python-numpy: Fix compilation if HAVE_CEXPx is defined

Quoted 5 lines · Alexey Brodkin

With update of Numpy to the latest version we've got one change which breaks Numpy compilcation in some cases.

This change back-ports upstrema fix from:
https://github.com/numpy/numpy/pull/9721

I noticed that there are build failures in the upstream pull request:
https://travis-ci.org/numpy/numpy/builds/277862723

Is that going to be a problem for us?

Also, charris commented something, I guess that that's not integrated yet?

Regards,
Arnout

Quoted 6 lines
Cc Rahul Bedarkar <[email protected]>
Cc Gwenhael Goavec-Merou <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
Cc Peter Korsgaard <[email protected]>
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF