Skip to content

Normalize addresses printed for non-file-scope pointers in output [] - #304

Open
mborland wants to merge 2 commits into
edgcpp:mainfrom
mborland:0002
Open

mborland wants to merge 2 commits into
edgcpp:mainfrom
mborland:0002

Conversation

@mborland

Copy link
Copy Markdown
Contributor

il_display prints a pointer to an entity outside the file-scope memory
region with its raw address. One example is the name of a function's
parameter, in the param-type entry of the function's type:

name:                    **possible non-file-scope ptr** (0x7c74a620a0): "x"

The address changes from run to run. The test output filter
(dev_tools/pylibs/edgtest/filter/__init__.py, _REGEX_REPLACEMENTS)
normalizes the other addresses (@…, @0x…, .text+0x…) but not this one.
So the recorded output of any test that displays such an IL never matches
twice.

@wchilders-nvidia

wchilders-nvidia commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

I wonder if we should consider making a change to il_display instead @daveedvdv-nvidia @nv-cmeerw thoughts ?

@daveedvdv-nvidia

Copy link
Copy Markdown
Contributor

An il_display.c change might be reasonable here. I'm seeing:

    if (displaying_file_scope_il && !is_file_scope_entry) {
      /* Reference from file scope to a pointer whose prefix indicates
         function-scope memory region kind.  For string entries this can
         happen even when the string is allocated in file-scope memory,
         because strings referenced from a function-scope memory region
         are numbered as honorary members of that region during IL output. */
      if (is_string_entry_kind(entry_kind)) {
        (void)fprintf(f_display, "**possible non-file-scope ptr** (%p)",
                      (a_void_ptr)entry_ptr);
      } else {
        (void)fprintf(f_display, "**NON FILE SCOPE PTR** (%p)",
                      (a_void_ptr)entry_ptr);
      }  /* if */

Maybe the positive branch of the inner if-statement shouldn't output anything, given the comment? Alternatively, drop the pointer value in that case.

(That comment could also use a "See assign_entry_number for details.")

@mborland

Copy link
Copy Markdown
Contributor Author

An il_display.c change might be reasonable here. I'm seeing:

    if (displaying_file_scope_il && !is_file_scope_entry) {
      /* Reference from file scope to a pointer whose prefix indicates
         function-scope memory region kind.  For string entries this can
         happen even when the string is allocated in file-scope memory,
         because strings referenced from a function-scope memory region
         are numbered as honorary members of that region during IL output. */
      if (is_string_entry_kind(entry_kind)) {
        (void)fprintf(f_display, "**possible non-file-scope ptr** (%p)",
                      (a_void_ptr)entry_ptr);
      } else {
        (void)fprintf(f_display, "**NON FILE SCOPE PTR** (%p)",
                      (a_void_ptr)entry_ptr);
      }  /* if */

Maybe the positive branch of the inner if-statement shouldn't output anything, given the comment? Alternatively, drop the pointer value in that case.

(That comment could also use a "See assign_entry_number for details.")

I'll make the change. Thanks.

@daveedvdv-nvidia daveedvdv-nvidia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants