[R-SIG-Mac] ast2ast: bus error on r-oldrel-macos-x86_64 only, not reproducible

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Tue Oct 27 23:17:28 CET 2026


Konrad,

I can confirm that this fixes the segfault:

diff -ru ast2ast/inst/include/etr_bits/Core/Types.hpp ast2ast-1/inst/include/etr_bits/Core/Types.hpp
--- ast2ast/inst/include/etr_bits/Core/Types.hpp        2026-10-22 01:10:13
+++ ast2ast-1/inst/include/etr_bits/Core/Types.hpp      2026-10-27 18:11:54
@@ -421,8 +421,10 @@
   std::size_t inline_[N_INLINE];
   bool on_heap() const noexcept { return heap_ != nullptr; }
   void release() noexcept {
-    delete[] heap_;
-    heap_ = nullptr;
+    if (heap_ != nullptr) {
+      delete[] heap_;
+      heap_ = nullptr;
+    }
     rank_ = 0;
   }
   void copy_from(const Dim& o) {


but there is one more suspicions delete without check in resize() [Types.hpp using 511] so you may want to review that one as well.

Cheers,
Simon



> On 28/10/2026, at 11:06, Simon Urbanek <simon.urbanek using R-project.org> wrote:
> 
> Konrad, 
> 
> the setup is documented as Brian said and also recently discussed with detailed instructions at
> https://stat.ethz.ch/pipermail/r-package-devel/2026q4/012590.html
> 
> The segfault is directly reproducible, trace below. The comments in the file suggest that you know that this may be illegal - possibly missing guard to not try delete if it is inlined (=no heap)? (Just a guess).
> 
> Cheers,
> Simon
> 
> 
> Process 15893 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7ff811a46993)
>    frame #0: 0x00000001084653cf sourceCpp_24.so`f(SEXPREC*) [inlined] etr::Dim::release(this=<unavailable>) at Types.hpp:426:11 [opt]
>   423   void release() noexcept {
>   424     delete[] heap_;
>   425     heap_ = nullptr;
> -> 426     rank_ = 0;
>   427   }
>   428   void copy_from(const Dim& o) {
>   429     if (o.on_heap()) {
> Target 0: (R) stopped.
> warning: sourceCpp_24.so was compiled with optimization - stepping may behave oddly; variables may not be available.



More information about the R-SIG-Mac mailing list