Skip to content

Commit 869e99a

Browse files
committed
Ensure Logger is initialized in SVM_ASSERT_IMPL
The assert may fire before a Logger is installed on the Compilation object. Check if the Logger exists before logging. Signed-off-by: Daryl Maier <maier@ca.ibm.com>
1 parent 346a6ec commit 869e99a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

runtime/compiler/runtime/SymbolValidationManager.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ class AOTCacheWellKnownClassesRecord;
5757
if (!(nonfatal) && ::TR::SymbolValidationManager::assertionsAreFatal()) \
5858
::TR::fatal_assertion(__FILE__, __LINE__, condStr, "" format "", ##__VA_ARGS__); \
5959
else \
60-
if (::TR::comp()->log()->isEnabled_DEPRECATED()) \
61-
::TR::comp()->log()->printf("" format "\n", ##__VA_ARGS__); \
60+
{ \
61+
/* \
62+
* It is possible that this assert will fire before even the default Logger is \
63+
* initialized. Check if it is available before logging. \
64+
*/ \
65+
OMR::Logger *log = ::TR::comp()->log(); \
66+
if (log && log->isEnabled_DEPRECATED()) \
67+
log->printf("" format "\n", ##__VA_ARGS__); \
68+
} \
6269
\
6370
::TR::comp()->failCompilation< ::J9::AOTSymbolValidationManagerFailure>( \
6471
SVM_ASSERT_LOCATION(__LINE__) ": " assertName " failed: " condStr); \

0 commit comments

Comments
 (0)