Commit 8dbc7c39 authored by Stefan Behnel's avatar Stefan Behnel

cast invalid pointer initialisation values also for OpenMP temps and not just normal variables

Closes #1664
parent 5b401954
......@@ -8076,7 +8076,7 @@ class ParallelStatNode(StatNode, ParallelNode):
invalid_value = entry.type.invalid_value()
if invalid_value:
init = ' = ' + invalid_value
init = ' = ' + entry.type.cast_code(invalid_value)
else:
init = ''
# Declare the parallel private in the outer block
......
......@@ -2,6 +2,7 @@
cimport cython.parallel
from cython.parallel import prange, threadid
from cython.view cimport array
from libc.stdlib cimport malloc, calloc, free, abort
from libc.stdio cimport puts
......@@ -737,3 +738,19 @@ def test_clean_temps():
except Exception, e:
print e.args[0]
def test_pointer_temps(double x):
"""
>>> test_pointer_temps(1.0)
4.0
"""
cdef Py_ssize_t i
cdef double* f
cdef double[:] arr = array(format="d", shape=(10,), itemsize=sizeof(double))
arr[0] = 4.0
arr[1] = 3.0
for i in prange(10, nogil=True, num_threads=1):
f = &arr[0]
return f[0]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment