Skip to content

Commit 0e431b4

Browse files
committed
Fix checks double evaluation
1 parent d88a97d commit 0e431b4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/core/include/openvino/core/except.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ OPENVINO_FORCE_INLINE void check_condition(const CharT (&)[N]) noexcept {
189189
//
190190
#define OPENVINO_ASSERT_HELPER2(exc_class, ctx, check, ...) \
191191
do { \
192-
OPENVINO_CHECK_CONDITION(check); \
193-
if (!static_cast<bool>(check)) { \
192+
bool check_result = static_cast<bool>(check); \
193+
OPENVINO_CHECK_CONDITION(check_result); \
194+
if (!check_result) { \
194195
::std::ostringstream ss___; \
195196
::ov::write_all_to_stream(ss___, __VA_ARGS__); \
196197
exc_class::create(__FILE__, __LINE__, (#check), (ctx), ss___.str()); \
@@ -199,8 +200,9 @@ OPENVINO_FORCE_INLINE void check_condition(const CharT (&)[N]) noexcept {
199200

200201
#define OPENVINO_ASSERT_HELPER1(exc_class, ctx, check) \
201202
do { \
202-
OPENVINO_CHECK_CONDITION(check); \
203-
if (!static_cast<bool>(check)) { \
203+
bool check_result = static_cast<bool>(check); \
204+
OPENVINO_CHECK_CONDITION(check_result); \
205+
if (!check_result) { \
204206
exc_class::create(__FILE__, __LINE__, (#check), (ctx), exc_class::default_msg); \
205207
} \
206208
} while (0)

0 commit comments

Comments
 (0)