c7fd47
From 0fce0e589353d772ceda4d493b147138406b22fd Mon Sep 17 00:00:00 2001
c7fd47
From: =?UTF-8?q?Moritz=20Wanzenb=C3=B6ck?= <moritz.wanzenboeck@catalysts.cc>
c7fd47
Date: Wed, 11 Jul 2018 11:57:46 +0200
c7fd47
Subject: [PATCH] Add missing return statement in numpy import
c7fd47
c7fd47
This adds a missing return statement in the python3 specific
c7fd47
import logic of boost.python.numpy.
c7fd47
c7fd47
For python3 wrap_import_array() needs to return a pointer value.
c7fd47
The import_array() macro only returns NULL in case of error. The
c7fd47
missing return statement is UB, so the compiler can assume it does
c7fd47
not happen. This means the compiler can assume the error branch
c7fd47
is always taken, so import_array must always fail.
c7fd47
---
c7fd47
 src/numpy/numpy.cpp | 1 +
c7fd47
 1 file changed, 1 insertion(+)
c7fd47
c7fd47
diff --git a/src/numpy/numpy.cpp b/src/numpy/numpy.cpp
c7fd47
index 8e259bc75..3ae2295e3 100644
c7fd47
--- a/libs/python/src/numpy/numpy.cpp
c7fd47
+++ b/libs/python/src/numpy/numpy.cpp
c7fd47
@@ -19,6 +19,7 @@ static void wrap_import_array()
c7fd47
 static void * wrap_import_array()
c7fd47
 {
c7fd47
   import_array();
c7fd47
+  return NULL;
c7fd47
 }
c7fd47
 #endif
c7fd47