[clang-cl] Slow miscompilation

Hello all,

I'm trying to compile following example:

#define BOOST_TEST_MODULE TestName
#include <boost/test/included/unit_test.hpp>

void fun()
{
    throw std::exception();
}

BOOST_AUTO_TEST_CASE(test_name)
{
    BOOST_CHECK_THROW(fun(), std::exception);
}

It checks that given function does throw an exception of given type.

On Windows the invocation:

"C:\Program Files\LLVM\bin\clang-cl.exe" "test.cpp" /O2 /Ob2 /GR
/Zc:forScope /Zc:wchar_t /MT /wd4675 /EHs -fsanitize=address
-fsanitize=undefined -D_HAS_AUTO_PTR_ETC=1 -DNDEBUG "-Iboost_1_63_0"
-Xclang -ftime-report

takes about 85 seconds to complete on my machine (normally it should
be 3 at most).

And the resulting executable outputs this:

boost/test/utils/class_properties.hpp:60:55: runtime error: load of
value 193, which is not a valid value for type 'bool'
SUMMARY: AddressSanitizer: undefined-behavior
boost/test/utils/class_properties.hpp:60:55 in

This also can't be right because it is Boost.Test, it can't have any
bugs. Right?

Thanks.

time-report (38 KB)

Hello all,

I'm trying to compile following example:

#define BOOST_TEST_MODULE TestName
#include <boost/test/included/unit_test.hpp>

void fun()
{
    throw std::exception();
}

BOOST_AUTO_TEST_CASE(test_name)
{
    BOOST_CHECK_THROW(fun(), std::exception);
}

It checks that given function does throw an exception of given type.

On Windows the invocation:

"C:\Program Files\LLVM\bin\clang-cl.exe" "test.cpp" /O2 /Ob2 /GR
/Zc:forScope /Zc:wchar_t /MT /wd4675 /EHs -fsanitize=address
-fsanitize=undefined -D_HAS_AUTO_PTR_ETC=1 -DNDEBUG "-Iboost_1_63_0"
-Xclang -ftime-report

takes about 85 seconds to complete on my machine (normally it should
be 3 at most).

And the resulting executable outputs this:

boost/test/utils/class_properties.hpp:60:55: runtime error: load of
value 193, which is not a valid value for type 'bool'
SUMMARY: AddressSanitizer: undefined-behavior
boost/test/utils/class_properties.hpp:60:55 in

This also can't be right because it is Boost.Test, it can't have any
bugs. Right?

Boost may actually have some bugs :slight_smile:
https://svn.boost.org/trac/boost/ticket/12818