Skip to content

Commit bd691a1

Browse files
committed
Enable complex retstyle detection on windows as well
I previously thought that the Intel standard for complex return values on windows was the default for the platform, and so disabled the shims to work around it. However, it turns out that gfortran uses a consistent ABI across platforms, and we want to standardize on that, so let's enable this again. This should fix the memory corruption seen when calling MKL's `cdotc_64` on `x86_64` Windows.
1 parent e37ba6b commit bd691a1

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/Make.inc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,11 @@ ifneq (,$(filter $(ARCH), x86_64 i686))
9191
CBLAS_DIVERGENCE_AUTODETECTION := 1
9292
endif
9393

94-
# If we're on x86_64 (and NOT on windows), we can do complex return style autodetection
95-
# We don't do this on Windows because Windows actually prefers arugment retstyle
96-
ifneq ($(OS),WINNT)
94+
# If we're on x86_64, we can do complex return style autodetection
9795
ifneq (,$(filter $(ARCH), x86_64))
9896
LBT_CFLAGS += -DCOMPLEX_RETSTYLE_AUTODETECTION
9997
COMPLEX_RETSTYLE_AUTODETECTION := 1
10098
endif
101-
endif
10299

103100

104101
ifeq ($(VERBOSE),0)

test/direct.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ lbt_handle = dlopen("$(lbt_prefix)/$(binlib)/lib$(lbt_link_name).$(shlib_ext)",
7272
if Sys.ARCH == :x86_64
7373
@test libs[1].cblas == LBT_CBLAS_CONFORMANT
7474
if Sys.iswindows()
75-
# Technically, this should be "argument", but we disable complex return style
76-
# autodetection on windows since the default compilers seem to prefer argument
77-
# style, so we'd rather just not touch things on that platform.
78-
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_UNKNOWN
75+
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_ARGUMENT
7976
else
8077
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_NORMAL
8178
end
@@ -244,11 +241,7 @@ if MKL_jll.is_available() && Sys.ARCH == :x86_64
244241
@test length(libs) == 1
245242
@test libs[1].interface == LBT_INTERFACE_ILP64
246243
@test libs[1].cblas == LBT_CBLAS_DIVERGENT
247-
if Sys.iswindows()
248-
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_UNKNOWN
249-
else
250-
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_ARGUMENT
251-
end
244+
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_ARGUMENT
252245

253246
# Call cblas_zdotc_sub, asserting that it does not try to call a forwardless-symbol
254247
empty!(stacktraces)

0 commit comments

Comments
 (0)