seanbaxter / circle

The compiler is available for download. Get it!
http://www.circle-lang.org/
2.42k stars 74 forks source link

Circle compiler crashes with header-only Boost.Test #209

Closed correaa closed 1 month ago

correaa commented 4 months ago

I recently migrated test for a library from Boost.Test to the header-only version of Boost.Test. Basically #include <boost/test/included/unit_test.hpp> in place of #include <boost/test/unit_test.hpp>

After doing that change, Circle is crashing (segfaulting) with no error message.

cd /builds/correaa/boost-multi/build/test && /builds/correaa/boost-multi/build_latest/circle -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE=1 -DBOOST_TEST_DYN_LINK=1 -DBOOST_TEST_MODULE="\"C++ Unit Tests for Multi allocator.cpp.x\"" -I/builds/correaa/boost-multi/include -g -Werror -Wall -MD -MT test/CMakeFiles/allocator.cpp.x.dir/allocator.cpp.o -MF CMakeFiles/allocator.cpp.x.dir/allocator.cpp.o.d -o CMakeFiles/allocator.cpp.x.dir/allocator.cpp.o -c /builds/correaa/boost-multi/test/allocator.cpp
Segmentation fault (core dumped)

https://gitlab.com/correaa/boost-multi/-/jobs/7401814548

Other compilers are doing fine: https://gitlab.com/correaa/boost-multi/-/pipelines/1383714714

correaa commented 4 months ago

I have made it minimal here: https://godbolt.org/z/7obGvzEKd

#ifndef BOOST_TEST_MODULE
    #define BOOST_TEST_MAIN
#endif

// #include <boost/test/unit_test.hpp>  // ok
#include <boost/test/included/unit_test.hpp>  // not ok

BOOST_AUTO_TEST_CASE(check_size) {
    // std::vector v(5);
    // BOOST_REQUIRE( v.size() == 5 );
}
correaa commented 1 month ago

This was fixed in 131 or before https://godbolt.org/z/vGa1Y49Yo