Skip to content

Test failure with GCC/Linux on non-x86 architectures at -O2 #76

Description

@musicinmybrain

Originally found while enabling tests in the python-tvb-dist package in Fedora Linux.

This can also be reproduced on a free-tier Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-1027-oracle aarch64) VM on Oracle Cloud Infrastructure as follows:

$ sudo apt install git g++ libgtest-dev
$ git clone https://github.com/the-virtual-brain/tvb-gdist.git
$ cd tvb-gdist/tests
$ g++ -O2 -g test_geodesic_utils.cpp -o test_geodesic_utils -lgtest
$ ./test_geodesic_utils 
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from compute_gdist_impl
[ RUN      ] compute_gdist_impl.flat_traingular_mesh_test

mesh has 121 vertices, 200 faces, 320 edges
40 edges are boundary edges
shortest/longest edges are 0.2/0.282843 = 0.707107
enclosing XYZ box: X[1.5,3.5] Y[-1,1] Z[0,0]
approximate diameter of the mesh is 2.82843
min/max face angles are 45/90 degrees

test_geodesic_utils: ../geodesic_library/geodesic_algorithm_exact.h:1166: void geodesic::GeodesicAlgorithmExact::construct_propagated_intervals(bool, geodesic::edge_pointer, geodesic::face_pointer, geodesic::IntervalWithStop*, unsigned int&, geodesic::interval_pointer): Assertion `p->start() < p->stop()' failed.
Aborted (core dumped)

(I mention this because it’s an easy place to get free interactive access to an aarch64/Linux VM.)

GDB backtrace:

#0  __pthread_kill_implementation (threadid=281474842429984, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at ./nptl/pthread_kill.c:44
#1  0x0000fffff7b8f254 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x0000fffff7b4a67c in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x0000fffff7b37130 in __GI_abort () at ./stdlib/abort.c:79
#4  0x0000fffff7b43fd0 in __assert_fail_base (fmt=0xfffff7c5d3f8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0xaaaaaaae9f78 "p->start() < p->stop()", 
    file=file@entry=0xaaaaaaae9680 "../geodesic_library/geodesic_algorithm_exact.h", line=line@entry=1166, 
    function=function@entry=0xaaaaaaae9e28 "void geodesic::GeodesicAlgorithmExact::construct_propagated_intervals(bool, geodesic::edge_pointer, geodesic::face_pointer, geodesic::IntervalWithStop*, unsigned int&, geodesic::interval_pointer)") at ./assert/assert.c:92
#5  0x0000fffff7b44040 in __GI___assert_fail (assertion=0xaaaaaaae9f78 "p->start() < p->stop()", 
    file=0xaaaaaaae9680 "../geodesic_library/geodesic_algorithm_exact.h", line=1166, 
    function=0xaaaaaaae9e28 "void geodesic::GeodesicAlgorithmExact::construct_propagated_intervals(bool, geodesic::edge_pointer, geodesic::face_pointer, geodesic::IntervalWithStop*, unsigned int&, geodesic::interval_pointer)")
    at ./assert/assert.c:101
#6  0x0000aaaaaaaacd24 in geodesic::GeodesicAlgorithmExact::construct_propagated_intervals (
    this=this@entry=0xffffffffecd8, invert=<optimized out>, edge=edge@entry=0xaaaaaab34170, 
    face=face@entry=0xaaaaaab2e220, candidates=candidates@entry=0xffffffffeac8, num_candidates=@0xffffffffeac4: 1, 
    source_interval=source_interval@entry=0xaaaaaab40450) at ../geodesic_library/geodesic_algorithm_exact.h:1166
#7  0x0000aaaaaaab6b9c in geodesic::GeodesicAlgorithmExact::propagate (this=this@entry=0xffffffffecd8, 
    sources=std::vector of length 1, capacity 1 = {...}, 
    max_propagation_distance=max_propagation_distance@entry=1e+100, stop_points=stop_points@entry=0xffffffffec30)
    at ../geodesic_library/geodesic_algorithm_exact.h:648
#8  0x0000aaaaaaaa9bf0 in compute_gdist_impl (points=std::vector of length 363, capacity 363 = {...}, 
    faces=std::vector of length 600, capacity 600 = {...}, sources=std::vector of length 1, capacity 1 = {...}, 
    targets=std::vector of length 1, capacity 1 = {...}, max_distance=max_distance@entry=1e+100, 
    is_one_indexed=is_one_indexed@entry=false, propagate_on_max_distance=propagate_on_max_distance@entry=false)
    at ../geodesic_library/geodesic_utils.h:29
#9  0x0000aaaaaaaaa22c in compute_gdist_impl_flat_traingular_mesh_test_Test::TestBody (this=<optimized out>)
    at /usr/include/c++/11/bits/stl_algobase.h:420
#10 0x0000aaaaaaae8bf0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#11 0x0000aaaaaaadb5cc in testing::Test::Run() ()
#12 0x0000aaaaaaadb750 in testing::TestInfo::Run() ()
#13 0x0000aaaaaaadbd50 in testing::TestSuite::Run() ()
#14 0x0000aaaaaaadc47c in testing::internal::UnitTestImpl::RunAllTests() ()
#15 0x0000aaaaaaadb89c in testing::UnitTest::Run() ()
#16 0x0000aaaaaaaa8b6c in RUN_ALL_TESTS () at /usr/include/gtest/gtest.h:2490
#17 main (argc=<optimized out>, argv=<optimized out>) at test_geodesic_utils.cpp:32

The assertion failure does not occur with -O1, -Og, or even -O3. It also did not occur at -O2 with in a quick test with clang++ on Apple Silicon.

Please let me know if there is anything else I can do to help diagnose this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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