Skip to content

Tests using EXPECT_THROW fail on macOS with Apple Silicon M3 #945

Description

@hmenke

Prerequisites

Description

Tests that use EXPECT_THROW fail on macOS with Apple Silicon M3. Upon catch the tests segfault (aka bus error on macOS) somewhere in libunwind when encountering the autib instruction.

$ lldb /Users/timapple/code/triqs/triqs.build/test/c++/gfs/gf_density
(lldb) target create "/Users/timapple/code/triqs/triqs.build/test/c++/gfs/gf_density"
Current executable set to '/Users/timapple/code/triqs/triqs.build/test/c++/gfs/gf_density' (arm64).
(lldb) r
Process 48083 launched: '/Users/timapple/code/triqs/triqs.build/test/c++/gfs/gf_density' (arm64)
[==========] Running 4 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 4 tests from Gf
[ RUN      ] Gf.DensityFermion
[       OK ] Gf.DensityFermion (2 ms)
[ RUN      ] Gf.DensityBoson
[       OK ] Gf.DensityBoson (1 ms)
[ RUN      ] Gf.Density_with_not_all_moments
Process 48083 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=261, address=0xdac11410)
    frame #0: 0x000000019518ba58 libunwind.dylib`_Unwind_GetIP + 224
libunwind.dylib`:
->  0x19518ba58 <+224>: autib  x16, x0
    0x19518ba5c <+228>: mov    x17, x16
    0x19518ba60 <+232>: xpaci  x17
    0x19518ba64 <+236>: cmp    x16, x17
Target 0: (gf_density) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=261, address=0xdac11410)
  * frame #0: 0x000000019518ba58 libunwind.dylib`_Unwind_GetIP + 224
    frame #1: 0x00000001888cbc7c libc++abi.dylib`__gxx_personality_v0 + 588
    frame #2: 0x0000000100530930 libunwind.1.dylib`unwind_phase2 + 388
    frame #3: 0x0000000100530b68 libunwind.1.dylib`_Unwind_Resume + 100
    frame #4: 0x0000000100e682f8 libtriqs.3.3.dylib`triqs::gfs::density(g=gf_const_view<triqs::mesh::imfreq, triqs::gfs::matrix_valued, nda::C_stride_layout> @ 0x000000016fdfd9a8, known_moments=nda::array_const_view<dcomplex, 3> @ 0x000000016fdfd968) at density.cpp:35:7
    frame #5: 0x0000000100e65be4 libtriqs.3.3.dylib`triqs::gfs::density(g=gf_const_view<triqs::mesh::imfreq, triqs::gfs::matrix_valued, nda::C_stride_layout> @ 0x000000016fdfe248, known_moments=nda::array_const_view<dcomplex, 3> @ 0x000000016fdfe208) at density.cpp:40:42
    frame #6: 0x0000000100e82520 libtriqs.3.3.dylib`triqs::gfs::density(g=gf_const_view<triqs::mesh::imfreq, triqs::gfs::scalar_valued, nda::C_stride_layout> @ 0x000000016fdfe788, known_moments=nda::array_const_view<dcomplex, 1> @ 0x000000016fdfe760) at density.cpp:126:16
    frame #7: 0x0000000100008e80 gf_density`Gf_Density_with_not_all_moments_Test::TestBody(this=0x0000600000365c90) at gf_density.cpp:69:3
    frame #8: 0x00000001006f8a10 libgtest.1.14.0.dylib`void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(object=0x0000600000365c90, method=0x00000000000000010000000000000020, location="the test body") at gtest.cc:2635:10
    frame #9: 0x00000001006b5dfc libgtest.1.14.0.dylib`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(object=0x0000600000365c90, method=0x00000000000000010000000000000020, location="the test body") at gtest.cc:2671:14
    frame #10: 0x00000001006b5d4c libgtest.1.14.0.dylib`testing::Test::Run(this=0x0000600000365c90) at gtest.cc:2710:5
    frame #11: 0x00000001006b6c00 libgtest.1.14.0.dylib`testing::TestInfo::Run(this=0x000000014071d580) at gtest.cc:2856:11
    frame #12: 0x00000001006b7dcc libgtest.1.14.0.dylib`testing::TestSuite::Run(this=0x000000014071d350) at gtest.cc:3034:30
    frame #13: 0x00000001006c6114 libgtest.1.14.0.dylib`testing::internal::UnitTestImpl::RunAllTests(this=0x000000014071d0a0) at gtest.cc:5964:44
    frame #14: 0x00000001007036f8 libgtest.1.14.0.dylib`bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=0x000000014071d0a0, method=(libgtest.1.14.0.dylib`testing::internal::UnitTestImpl::RunAllTests() at gtest.cc:5841), location="auxiliary test code (environments or event listeners)") at gtest.cc:2635:10
    frame #15: 0x00000001006c5af0 libgtest.1.14.0.dylib`bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=0x000000014071d0a0, method=(libgtest.1.14.0.dylib`testing::internal::UnitTestImpl::RunAllTests() at gtest.cc:5841), location="auxiliary test code (environments or event listeners)") at gtest.cc:2671:14
    frame #16: 0x00000001006c59e8 libgtest.1.14.0.dylib`testing::UnitTest::Run(this=0x0000000100720140) at gtest.cc:5543:10
    frame #17: 0x0000000100031cb0 gf_density`RUN_ALL_TESTS() at gtest.h:2334:73
    frame #18: 0x0000000100031c44 gf_density`main(argc=1, argv=0x000000016fdff4b8) at gf_density.cpp:93:1
    frame #19: 0x00000001885910e0 dyld`start + 2360
(lldb) f 4
frame #4: 0x0000000100e682f8 libtriqs.3.3.dylib`triqs::gfs::density(g=gf_const_view<triqs::mesh::imfreq, triqs::gfs::matrix_valued, nda::C_stride_layout> @ 0x000000016fdfd9a8, known_moments=nda::array_const_view<dcomplex, 3> @ 0x000000016fdfd968) at density.cpp:35:7
   32    nda::matrix<dcomplex> density(gf_const_view<imfreq> g, array_const_view<dcomplex, 3> known_moments) {
   33  
   34      if (g.mesh().positive_only())
-> 35        TRIQS_RUNTIME_ERROR << "density is only implemented for g(i omega_n) with full mesh (positive and negative frequencies)";
   36  
   37      nda::array_const_view<dcomplex, 3> mom_123;
   38  
(lldb) f 7
frame #7: 0x0000000100008e80 gf_density`Gf_Density_with_not_all_moments_Test::TestBody(this=0x0000600000365c90) at gf_density.cpp:69:3
   66    triqs::clef::placeholder<0> om_;
   67  
   68    G(om_) << 1.0;
-> 69    EXPECT_THROW(triqs::gfs::density(G), triqs::runtime_error);
   70  
   71    G(om_) << om_;
   72    EXPECT_THROW(triqs::gfs::density(G), triqs::runtime_error);

Steps to Reproduce

  1. Compile TRIQS on an M3 Mac
  2. ctest -R '^gf_density$'

Expected behavior: No bus error.

Actual behavior: bus error

Versions

706967b

Formatting

Please use markdown in your issue message. A useful summary of commands can be found here.

Additional Information

As a workaround one can configure TRIQS with

$ LDFLAGS=-ld_classic cmake ...

As to why that works I have no idea.

@MichiMeix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions