Runtime error with GCC 13: reference binding to null pointer
Closed this issue · 3 comments
degauden commented
After the compilation on Fedora 38 with GCC 13, the run of EleCfitsioWrapper_CfitsioWrapper_test produces an error:
$ ./build.x86_64-fc38-gcc13-dbg/run EleCfitsioWrapper_CfitsioWrapper_test
Running 4 test cases...
/home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131:57: runtime error: reference binding to null pointer of type 'const long int'
/home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:138:84: runtime error: reference binding to null pointer of type 'long int'
*** No errors detected
degauden commented
After a bit of debugging, the stack trace points to:
(gdb) run
Starting program: /home/hubert/Work/Space/Euclid/EleFits/build.x86_64-fc38-gcc13-dbg/bin/EleCfitsioWrapper_CfitsioWrapper_test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Running 4 test cases...
Breakpoint 1.95, Euclid::Fits::ContiguousContainerMixin<long, Euclid::Fits::Position<0l> >::operator[] (this=0x7fffffff9ec0, index=0)
at /home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131
131 return *(static_cast<const TDerived&>(*this).data() + index);
(gdb) where
#0 Euclid::Fits::ContiguousContainerMixin<long, Euclid::Fits::Position<0l> >::operator[] (this=0x7fffffff9ec0, index=0)
at /home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131
#1 0x00007ffff7f14979 in Euclid::Fits::ContiguousContainerMixin<long, Euclid::Fits::Position<0l> >::operator[] (this=0x7fffffff9ec0, index=0)
at /home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:138
#2 0x00007ffff7f13812 in Euclid::Cfitsio::HduAccess::init_image<unsigned char, 0l> (fptr=0x5555555a9380, name="", shape=warning: RTTI symbol not found for class 'Euclid::Fits::Position<0l>'
warning: RTTI symbol not found for class 'Euclid::Fits::Position<0l>'
...)
at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/EleCfitsioWrapper/impl/HduWrapper.hpp:22
#3 0x00007ffff7f1122c in Euclid::Cfitsio::HduAccess::init_primary (fptr=0x5555555a9380)
at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/src/lib/HduWrapper.cpp:143
#4 0x00007ffff7f0f4a4 in Euclid::Cfitsio::FileAccess::create_open (filename="/tmp/hubert/f724-6cbe-6fa9-8c80",
policy=Euclid::Cfitsio::FileAccess::CreatePolicy::OverWrite)
at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/src/lib/FileWrapper.cpp:23
#5 0x00007ffff7f0b612 in Euclid::Fits::Test::MinimalFile::MinimalFile (this=0x7fffffffa090)
at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/src/lib/CfitsioFixture.cpp:14
#6 0x000055555557ab88 in CfitsioWrapper_test::read_ulong_record_learning_test::read_ulong_record_learning_test (this=0x7fffffffa090)
at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/tests/src/CfitsioWrapper_test.cpp:34
#7 0x000055555556b318 in CfitsioWrapper_test::read_ulong_record_learning_test_invoker ()
at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/tests/src/CfitsioWrapper_test.cpp:34
#8 0x000055555557d32f in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke (function_ptr=...)
at /usr/include/boost/function/function_template.hpp:117
#9 0x00007ffff6f99146 in boost::function0<void>::operator() (this=<optimized out>) at ./boost/function/function_template.hpp:763
#10 boost::detail::forward::operator() (this=<optimized out>) at ./boost/test/impl/execution_monitor.ipp:1388
#11 boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke (function_obj_ptr=...)
at ./boost/function/function_template.hpp:137
#12 0x00007ffff6fa0435 in boost::function0<int>::operator() (this=0x7fffffffb7f0) at ./boost/function/function_template.hpp:763
#13 boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) (tr=..., F=...) at ./boost/test/impl/execution_monitor.ipp:301
#14 boost::execution_monitor::catch_signals(boost::function<int ()> const&) (
this=this@entry=0x7ffff6fff3e0 <boost::unit_test::unit_test_monitor_t::instance()::the_inst>, F=...)
at ./boost/test/impl/execution_monitor.ipp:903
#15 0x00007ffff6fa08df in boost::execution_monitor::execute(boost::function<int ()> const&) (
this=0x7ffff6fff3e0 <boost::unit_test::unit_test_monitor_t::instance()::the_inst>, F=...) at ./boost/test/impl/execution_monitor.ipp:1301
#16 0x00007ffff6fa09cd in boost::execution_monitor::vexecute(boost::function<void ()> const&) (this=<optimized out>, F=...)
at ./boost/test/impl/execution_monitor.ipp:1397
#17 0x00007ffff6fbcee1 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) (
this=0x7ffff6fff3e0 <boost::unit_test::unit_test_monitor_t::instance()::the_inst>, func=..., timeout_microseconds=<optimized out>)
at ./boost/test/impl/unit_test_monitor.ipp:49
#18 0x00007ffff6fdb070 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) [clone .isra.0] (
this=this@entry=0x7ffff6ffeda0 <boost::unit_test::framework::impl::(anonymous namespace)::s_frk_state()::the_inst>, tu_id=<optimized out>,
timeout_microseconds=0, p_random_generator=<optimized out>) at ./boost/test/impl/framework.ipp:815
#19 0x00007ffff6fdb368 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) [clone .isra.0] (
this=this@entry=0x7ffff6ffeda0 <boost::unit_test::framework::impl::(anonymous namespace)::s_frk_state()::the_inst>, tu_id=<optimized out>,
timeout_microseconds=0, p_random_generator=<optimized out>) at ./boost/test/impl/framework.ipp:740
--Type <RET> for more, q to quit, c to continue without paging--
#20 0x00007ffff6fdb368 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) [clone .isra.0] (
this=0x7ffff6ffeda0 <boost::unit_test::framework::impl::(anonymous namespace)::s_frk_state()::the_inst>, tu_id=tu_id@entry=1, timeout_microseconds=timeout_microseconds@entry=0, p_random_generator=<optimized out>)
at ./boost/test/impl/framework.ipp:740
#21 0x00007ffff6facb61 in boost::unit_test::framework::run (id=1, continue_test=<optimized out>) at ./boost/test/impl/framework.ipp:1721
#22 0x00007ffff6fbcbd8 in boost::unit_test::unit_test_main (init_func=<optimized out>, argc=<optimized out>, argv=<optimized out>) at ./boost/test/impl/unit_test_main.ipp:250
#23 0x00007ffff7e132bb in main (argc=1, argv=0x7fffffffc008) at /usr/include/boost/test/unit_test.hpp:64
(gdb) n
/home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131:57: runtime error: reference binding to null pointer of type 'const long int'
132 }
It looks like the problem is caused by an uninitialised std::array. But the CRTP makes it difficult to locate.
kabasset commented
rather than uninitialized, it seems the array has length 0. I'll have to dig a bit, thanks for the debugging!
kabasset commented
Moved to Linx: https://github.com/kabasset/Linx/issues/30