Skip to content

Commit

Permalink
Fix variable-length array warning in clang
Browse files Browse the repository at this point in the history
The maxCount parameter is a dynamic quantity, and creating an array of
that length in C++ causes a warning-as-error with Clang 18.

Signed-off-by: Christian Despres <[email protected]>
  • Loading branch information
cjjdespres committed Dec 10, 2024
1 parent 996cedb commit a801128
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1901,12 +1901,12 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
TR_ResolvedJ9Method *callerMethod = std::get<3>(recv);
TR_YesNoMaybe useGetResolvedInterfaceMethod = std::get<4>(recv);

TR_ResolvedMethod *implArray[maxCount];
std::vector<TR_ResolvedMethod *> implArray(maxCount, NULL);
TR_PersistentClassInfo *classInfo = comp->getPersistentInfo()->getPersistentCHTable()->findClassInfoAfterLocking(clazz, comp, true);
int32_t implCount =
TR_ClassQueries::collectImplementorsCapped(
classInfo,
implArray,
implArray.data(),
maxCount,
slotOrIndex,
callerMethod,
Expand Down

0 comments on commit a801128

Please sign in to comment.