Tests fail to compile: error: 'ret_count' is an unsafe buffer that does not perform bounds checks
yurivict opened this issue · 4 comments
yurivict commented
clang-16 fails:
/usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:30:33: error: 'ret_count' is an unsafe buffer that does not perform bounds checks [-Werror,-Wunsafe-buffer-usage]
static std::atomic<std::size_t> ret_count[7];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:56:7: note: used in buffer access here
ret_count[m->func()]++;
^~~~~~~~~
/usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:29:33: error: 'call_count' is an unsafe buffer that does not perform bounds checks [-Werror,-Wunsafe-buffer-usage]
static std::atomic<std::size_t> call_count[7];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:3869:7: note: in instantiation of function template specialization 'allow(size_t, int)::(anonymous class)::operator()<std::tuple<>>' requested here
a(t);
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:3858:5: note: in instantiation of member function 'trompeloeil::side_effect<int (), (lambda at /usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:10)>::action' requested here
side_effect(
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:4548:25: note: in instantiation of function template specialization 'trompeloeil::side_effect<int (), (lambda at /usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:10)>::side_effect<(lambda at /usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:10)>' requested here
auto effect = new side_effect<Sig, S>(std::forward<S>(s));
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:3958:16: note: in instantiation of function template specialization 'trompeloeil::call_matcher<int (), std::tuple<>>::add_side_effect<(lambda at /usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:10)>' requested here
matcher->add_side_effect(std::forward<A>(a));
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:10: note: in instantiation of function template specialization 'trompeloeil::call_modifier<trompeloeil::call_matcher<int (), std::tuple<>>, C::trompeloeil_l_tag_type_trompeloeil_11, trompeloeil::call_limit_injector<trompeloeil::matcher_info<int ()>, 18446744073709551615>>::sideeffect<(lambda at /usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:10)>' requested here
.SIDE_EFFECT(++call_count[id])
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:5890:35: note: expanded from macro 'SIDE_EFFECT'
#define SIDE_EFFECT TROMPELOEIL_SIDE_EFFECT
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:5515:41: note: expanded from macro 'TROMPELOEIL_SIDE_EFFECT'
#define TROMPELOEIL_SIDE_EFFECT(...) TROMPELOEIL_SIDE_EFFECT_(=, __VA_ARGS__)
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:5549:3: note: expanded from macro 'TROMPELOEIL_SIDE_EFFECT_'
sideeffect([capture](auto& trompeloeil_x) { \
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/test/thread_terror.cpp:69:24: note: used in buffer access here
.SIDE_EFFECT(++call_count[id])
^~~~~~~~~~
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:5890:35: note: expanded from macro 'SIDE_EFFECT'
#define SIDE_EFFECT TROMPELOEIL_SIDE_EFFECT
^
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:5515:69: note: expanded from macro 'TROMPELOEIL_SIDE_EFFECT'
#define TROMPELOEIL_SIDE_EFFECT(...) TROMPELOEIL_SIDE_EFFECT_(=, __VA_ARGS__)
^~~~~~~~~~~
/usr/ports/devel/trompeloeil/work/trompeloeil-46/include/trompeloeil.hpp:5566:5: note: expanded from macro 'TROMPELOEIL_SIDE_EFFECT_'
__VA_ARGS__; \
^~~~~~~~~~~
2 errors generated.
Version: 46
rollbear commented
Right. Thank you for reporting. I'll get back to you.
rollbear commented
Please have a look at branch fix_322 to ensure that the issue has indeed been solved there.
rollbear commented
I've merged this to main now. Leaving it open until a release has been tagged.
rollbear commented
Just tagged release v48 which includes this.