BUG: npy_math.h complex accessors call UCRT creal/cimag, but npy_cdouble is C99 _Complex for icx on Windows
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #32512 di @mitre88 — chiusa senza merge
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- build-system, devtools, operating-systems
Direzione di ricerca
Inizia in numpy/npy_common.h e numpy/npy_math.h, confrontando la selezione di npy_cdouble con gli accessor del percorso C npy_creal e npy_cimag. Esegui la compilazione fornita di repro.c con icx rispetto agli header installati, quindi verifica che gli header vengano compilati correttamente senza rendere indefinito __INTEL_LLVM_COMPILER.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the issue:
Since gh-31389 (fix for gh-31337), npy_common.h excludes __INTEL_LLVM_COMPILER from
the _MSC_VER branch, so for icx on Windows npy_cdouble is double _Complex rather
than _Dcomplex:
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER)
typedef _Dcomplex npy_cdouble;
#else
typedef double _Complex npy_cdouble;
But npy_math.h's accessors still call the UCRT functions in the C path:
static inline double npy_creal(const npy_cdouble z)
{
#if defined(__cplusplus)
return z._Val[0];
#else
return creal(z);
#endif
}
Windows UCRT declares creal(_Dcomplex), crealf(_Fcomplex), creall(_Lcomplex)
regardless of which frontend compiles it, since it is the same CRT. So the two
headers disagree and including <numpy/npy_math.h> alone fails to compile.
Note the __cplusplus path already avoids the UCRT call by using z._Val[0]; only the
C path is affected.
Suggested fix: use real/imag (or z._Val[0]) instead of UCRT creal/cimag when
_MSC_VER is defined, or do not switch the typedefs based on the CRT at all.
Compiling with -U__INTEL_LLVM_COMPILER makes it build again, which confirms the
typedef selection is the trigger.
This is a different failure location than gh-31337 - that one was numpy's own
meson.build _Fcomplex type check; this one is npy_math.h and affects downstream
projects using the installed headers.
Affects numpy >= 2.4.5 and all 2.5.x.
Reproduce the code example:
// repro.c
#include <Python.h>
#include <numpy/npy_math.h>
icx /c repro.c -I"%PREFIX%\Lib\site-packages\numpy\_core\include" -I"%PREFIX%\Include"
Error message:
npy_math.h(368,18): error: passing 'const npy_cdouble' (aka 'const _Complex double') to parameter of incompatible type '_Dcomplex' (aka 'struct _C_double_complex')
368 | return creal(z);
| ^
ucrt\complex.h(89,49): note: passing argument to parameter '_Z' here
89 | _ACRTIMP double __cdecl creal(_In_ _Dcomplex _Z);
| ^
6 errors generated.
Python and NumPy Versions:
numpy 2.5.2
Python 3.13.15
Runtime Environment:
Windows x86_64
Intel oneAPI DPC++/C++ Compiler (icx) 2026.2.0
Windows SDK / UCRT 10.0.26100.0
How does this issue affect you or how did you find it:
It breaks Windows builds of mkl_umath (https://github.com/IntelPython/mkl_umath),
which compiles with icx against the installed numpy headers. Bisected by compiling
the reproducer against each release: 2.4.4 builds, 2.4.5 fails. The 2.4.4 headers
have no __INTEL_LLVM_COMPILER reference at all; 2.4.5 introduces it.
- Lingua principale
- Python
- Stelle
- 33.5k
- Fork
- 13.1k
- Merge medio
- 1g 19h
- PR unite (30g)
- 143
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di numpy/numpy
-
00 - Bug component: numpy.linalg
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
00 - Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
00 - Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
numpy/numpy#33422 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
BUG: f2py treats a backslash as an escape inside character literalsForse già presa @HaoZeke l’ha presa 17 giorni fa. Aperta00 - Bug component: numpy.f2py
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
numpy/numpy#33220 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
DOC: use CITATION.cff file format for citation informationForse già presa @JaroCamphuijsen l’ha presa 58 giorni fa. Aperta04 - Documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
numpy/numpy#32817 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
521xueweihan/HelloGitHub#4543 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
emeryberger/CSrankings#15700 ·
I maintainer di solito rispondono entro 2 giorni
-
Bug | 工作不正常 Triage | 待检查
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
OneDragon-Anything/ZenlessZoneZero-OneDragon#3084 ·
I maintainer di solito rispondono entro 1 giorno
-
Task select patterns with uppercase letters never matchForse già presa @manobhisriram l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno