RFR: 8307147: [x86] Dangling pointer warning for Assembler::_attributes

Andrew Haley aph at openjdk.org
Tue May 2 10:00:15 UTC 2023


On Tue, 2 May 2023 07:54:00 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to work around a false positive -Wdangling-pointer
> warning from gcc13.1.  The approach being taken is to suppress the warning,
> with a comment describing why it's a false positive.  Also a little code
> restructuring to make it more obvious.
> 
> I tried various code modifications to avoid the warning, but they were either
> obscure, large and instrusive, or didn't seem reliably future-proof against
> further changes in gcc's analysis.  And that's just for the attempts that
> worked.
> 
> Testing:
> mach5 tier1-3 with gcc11.2 (current default in Oracle's CI)
> 
> Local (linux-x64) tier1 with gcc13.1, and verified the relevant warnings are
> not reported.  This required disabling compiler warnings as errors, as there
> are other new warnings from gcc13.1: JDK-8307210 and JDK-8307196.

That's a weird one. Good.

src/hotspot/cpu/x86/assembler_x86.cpp line 223:

> 221:   // Record the assembler in the attributes, so the attributes destructor can
> 222:   // clear the assembler's attributes, cleaning up the otherwise dangling
> 223:   // pointer.  gcc13 has a false positive warning, as it doesn't tie that

Suggestion:

  // pointer.  gcc13 has a false positive warning because it doesn't tie that

This wording is clearer because it's more definite, IMO.

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

Marked as reviewed by aph (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13751#pullrequestreview-1408786706
PR Review Comment: https://git.openjdk.org/jdk/pull/13751#discussion_r1182342467


More information about the hotspot-dev mailing list