<p dir="auto">Following up on <a href="https://discourse.julialang.org/t/inv-causes-stack-overflow-on-julia-1-7-0-and-mac-os/72411" rel="nofollow">this Discourse post</a>. According to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/stevengj/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/stevengj">@stevengj</a>, this issue might be solved by the resolution <a href="https://github.com/JuliaPackaging/Yggdrasil/issues/3996" data-hovercard-type="issue" data-hovercard-url="/JuliaPackaging/Yggdrasil/issues/3996/hovercard">this Yggdrasil issue</a>.</p>
<p dir="auto">I am running into an odd error when using Julia 1.7.0 on my 2017 Mac Book Pro (Intel i7) on Mac OS 12.01. In particular, executing</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="n = 1000;
A = randn(Float32, n, n);
inv(A)
   ERROR: StackOverflowError:"><pre class="notranslate">n <span class="pl-k">=</span> <span class="pl-c1">1000</span>;
A <span class="pl-k">=</span> <span class="pl-c1">randn</span>(Float32, n, n);
<span class="pl-c1">inv</span>(A)
   ERROR<span class="pl-k">:</span> StackOverflowError<span class="pl-k">:</span></pre></div>
<p dir="auto">With no further stack trace printed afterwards.</p>
<ul dir="auto">
<li>The same error occurs with <code class="notranslate">ComplexF32</code> and <code class="notranslate">ComplexF64</code> types, but not <code class="notranslate">Float64</code>.</li>
<li>According to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/carstenbauer/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/carstenbauer">@carstenbauer</a>, the issue is also present in 1.6.4, 1.7.0.rc-2, 1.7.0.rc-3, 1.7.0.</li>
<li>1.6.3 and the current master branch do not exhibit the issue.</li>
</ul>
<p dir="auto">More detailed info: On my machine, inv works for all element types up to a certain size. For <code class="notranslate">Float32</code>, the failure size is 514 by 514 and for the complex types, it’s 258 by 258. Below these cutoffs, everything works as usual.</p>
<p dir="auto">On macos, using version <code class="notranslate">1.7.0-rc2</code>, julia just shows <code class="notranslate">StackOverflowError</code> with no other info when taking the matrix exp with a ~ 300x300 complex-valued matrix. Minimum example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="using LinearAlgebra

n = 300
m = rand(ComplexF64, n, n);
mex = exp(m);"><pre class="notranslate"><code class="notranslate">using LinearAlgebra

n = 300
m = rand(ComplexF64, n, n);
mex = exp(m);
</code></pre></div>
<p dir="auto">Alro ran with <code class="notranslate">--startup-file=no</code> to make sure it's not some clash with other packages.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/25255906/140830950-e321af22-8fa9-4175-8cac-b1412da98143.png"><img width="1187" alt="Screen Shot 2021-11-08 at 5 52 35 PM" src="https://user-images.githubusercontent.com/25255906/140830950-e321af22-8fa9-4175-8cac-b1412da98143.png" style="max-width: 100%;"></a></p>
<p dir="auto">my <code class="notranslate">versioninfo()</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Julia Version 1.7.0-rc2
Commit f23fc0d27a (2021-10-20 12:45 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_MATHLINK = /Applications/Mathematica.app/Contents/Frameworks/mathlink.framework
  JULIA_MATHKERNEL = /Applications/Mathematica.app/Contents/MacOS/MathKernel"><pre class="notranslate"><code class="notranslate">Julia Version 1.7.0-rc2
Commit f23fc0d27a (2021-10-20 12:45 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_MATHLINK = /Applications/Mathematica.app/Contents/Frameworks/mathlink.framework
  JULIA_MATHKERNEL = /Applications/Mathematica.app/Contents/MacOS/MathKernel
</code></pre></div>
<p dir="auto">Same code runs fine with <code class="notranslate">Version 1.6.3 (2021-09-23)</code>.</p>
<p dir="auto">Hardware: Macbook pro (intel) with 16 GB ram, activity monitor shows low memory usage.</p>
<p dir="auto">In addition, the same code sometimes gives <code class="notranslate">ERROR: LoadError: ReadOnlyMemoryError()</code>, not sure how to reproduce that one...</p>
<p dir="auto">Thanks!</p>