RFR: JDK-8301477: Replace NULL with nullptr in os/aix

Johan Sjölen jsjolen at openjdk.org
Fri Feb 17 10:10:23 UTC 2023


On Wed, 15 Feb 2023 15:57:20 GMT, Tyler Steele <tsteele at openjdk.org> wrote:

> With the patch I added above, testing on AIX looks good. Thanks for your work on these changes, and for pinging me to test them out.

Hi, thanks for providing the patch. I applied it with two changes of my own:


-  size_t stack_size = (size_t)nullptr;
+  size_t stack_size = 0;


The line above is: `stackptr_t stack_base = nullptr;`, so it's likely that assigning both to `NULL` was a mistake that wasn't caught by the compiler (as `NULL == 0`).

And


-  while ((*pc2 != (size_t)nullptr) && (searchcount++ < MAX_FUNC_SEARCH_LEN)) {
+ while ((*pc2 != 0) && (searchcount++ < MAX_FUNC_SEARCH_LEN)) {


Here I thought maybe we dereference the pointer by accident, and we really meant `while ((pc2 != nullptr))`, but just below that we have:

```c++
  if (*pc2 != 0) {
    trcVerbose("no traceback table found");
    return false;
  }


It's unlikely you make the same mistake twice, and this time referring to the value as `0` instead of `NULL`.

-------------

PR: https://git.openjdk.org/jdk/pull/12313


More information about the hotspot-runtime-dev mailing list