Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "storing the address of local variable" in trcmain.c #20172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

knn-k
Copy link
Contributor

@knn-k knn-k commented Sep 17, 2024

This commit stops storing the address of a local variable, to fix a build error with runtime/rastrace/trcmain.c.

Fixes: #20171

This commit stops storing the address of a local variable, to fix a
build error with runtime/rastrace/trcmain.c.

Fixes: eclipse-openj9#20171

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
@knn-k knn-k added the comp:ras label Sep 17, 2024
@knn-k
Copy link
Contributor Author

knn-k commented Sep 17, 2024

Jenkins test sanity amac jdk11

@knn-k knn-k marked this pull request as ready for review September 17, 2024 10:06
Comment on lines +1041 to +1042
memset(tempThr, 0, sizeof(UtThreadData));
initHeader(&(tempThr->header), UT_THREAD_DATA_NAME, sizeof(UtThreadData));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the documentation in rastrace_external.h. It currently says

 * @param[out]    thr A UtThreadData pointer. *thr can point to NULL, initialize trace will initialize it.

That is not true: if NULL == *thr, this will fail.

@@ -333,6 +334,7 @@ J9VMDllMain(J9JavaVM *vm, IDATA stage, void *reserved)
* Find UTE thread slot inside VM thread structure
*/
tempThr = UT_THREAD_FROM_VM_THREAD(vm->mainThread);
*tempThr = &thrData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some comments (or assertions) would be helpful:

  • before line 337 *tempThr is expected to be NULL
  • after the call to initializeTrace() *tempThr is again expected to be NULL (eliminating the reference to thrData)
  • the call to threadStart() should allocate storage to which *tempThr will then point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build error: "storing the address of local variable" in runtime/rastrace/trcmain.c
2 participants