Skip to content

fix(rocjitsu): suppress GCC 14 -Wfree-nonheap-object false positive on ppc64le - #14412

Merged
kuhar merged 1 commit into
developfrom
users/benrichard-amd/rocjitsu-gcc14-free-nonheap-object
Oct 28, 2026
Merged

kuhar merged 1 commit into
developfrom
users/benrichard-amd/rocjitsu-gcc14-free-nonheap-object

Conversation

@benrichard-amd

@benrichard-amd benrichard-amd commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Part of work for ROCm/TheRock#5518

rocjitsu fails to build on ppc64le with GCC 14 due to a false-positive -Wfree-nonheap-object warning in execution_fuzz_core.cpp, promoted to an error by -Werror. This is a known GCC regression (GCC PR 115180) triggered by std::vector<uint8_t>::_M_realloc_append inlining at -O3. A similar false positive was previously worked around in rocjitsu in #13075.

Technical Details

GCC 14.3.1 on ppc64le loses track of the vector's base pointer when inlining reserve() followed by push_back() in random_input(), and incorrectly warns that operator delete is called on a non-heap pointer:

Test Plan

Built rocjitsu on a POWER10 ppc64le machine (GCC 14.3.1) via cmake --build in the TheRock build tree. Verified all 476 targets compile and link.

Test Result

476/476 targets succeeded, exit 0. The remaining compiler notes about SIMD parameter passing (std::experimental::parallelism_v2) are harmless informational messages, not warnings or errors.

@therock-pr-bot

therock-pr-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@kuhar kuhar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would help to correct the GCC reference and document the trigger beside the suppression. GCC 104568 concerns a C++20 compiler crash involving zero-sized new, rather than this vector warning, so it does not explain when this workaround can be removed.

Please include the GCC 14.3.1 ppc64le diagnostic and inlining chain in the PR description, then link the matching compiler report from a short rationale comment. That would identify the affected operation and give future maintainers a way to reassess the workaround. The description should also reflect the final scope: as written, x86 GCC 14+ warning handling changes too.

)
target_compile_options(
${target}
PRIVATE -Wno-error=free-nonheap-object

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should scope this demotion to execution_fuzz_core.cpp on the affected POWER configuration. The guard currently changes every rj_configure_target(... WARNINGS) target on all GCC 14+ architectures. In a native x86_64 GCC 16 fixture using this helper, freeing a stack variable fails compilation before this change but succeeds afterward, with the warning still emitted. That broadens the warning policy beyond the reported ppc64le false positive.

The source-specific COMPILE_OPTIONS workaround for lds_test.cpp in tests/CMakeLists.txt:685-697, combined with the existing ppc64 processor guard, provides a nearby pattern. Putting this beside the execution-fuzzer target would preserve the error policy elsewhere without needing to extend the demotion to the separate object-library helper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the commit message. And updated the change so it only affects POWER.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should still limit this to execution_fuzz_core.cpp in fuzz/execution/CMakeLists.txt, using the source-level COMPILE_OPTIONS pattern in tests/CMakeLists.txt:685-697 and retaining the POWER/GNU guard. The new processor check fixes the x86 concern, but on POWER this still demotes the warning for every rj_configure_target(... WARNINGS) target, including unrelated tests and tools. Object-library targets use a separate helper and retain the error policy. Scoping the exception to the reported source keeps that policy intact elsewhere and puts the rationale beside the affected target.

@benrichard-amd benrichard-amd Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Scoped the suppression to execution_fuzz_core.cpp only

@benrichard-amd
benrichard-amd force-pushed the users/benrichard-amd/rocjitsu-gcc14-free-nonheap-object branch from 8a2e61f to 6286c8a Compare October 28, 2026 14:54

@kuhar kuhar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left an inline reply and a new comment

# new_allocator.h:172 on a pointer the compiler loses track of
# after reserve() + push_back(). Only observed on ppc64le; x86
# inlining decisions do not trigger it. Revisit when the project
# moves to GCC 16+, where the libstdc++ fix has landed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would help to replace the definite GCC 16 libstdc++ fix claim with a verified removal criterion. GCC 115180 redirects to 115016, whose discussion reports that its testcase stopped reproducing on trunk; it does not establish that this POWER build is fixed by a GCC 16 libstdc++ change.

Please name execution_fuzz_core.cpp in the rationale and say to recheck it on ppc64le at -O3 with the demotion removed. That gives maintainers a concrete check instead of relying on new_allocator.h:172, which varies by libstdc++ version. Narrow the version guard once that check establishes which compiler versions no longer need the workaround.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed the rationale comment

…n ppc64le

GCC 14 on ppc64le emits a false-positive -Wfree-nonheap-object inside
std::vector<uint8_t>::push_back / _M_realloc_append when inlining
random_input() in execution_fuzz_core.cpp at -O3 (GCC PR 115016).

The inlining chain is:
  random_input (execution_fuzz_core.cpp:500)
    -> vector::push_back (stl_vector.h:1314)
      -> vector::emplace_back (vector.tcc:123)
        -> vector::_M_realloc_append (vector.tcc:688)
          -> __new_allocator::deallocate (new_allocator.h:172)
            => -Wfree-nonheap-object

Scope the suppression to execution_fuzz_core.cpp only, guarded to
GCC >= 14 on ppc64 targets, following the per-source COMPILE_OPTIONS
pattern used for lds_test.cpp in tests/CMakeLists.txt. The warning
is demoted from error but still emitted, so real instances remain
visible in build logs.

Recheck: remove this block and build execution_fuzz_core.cpp on
ppc64le at -O3 with the next GCC upgrade.

Co-Authored-By: Claude <noreply@anthropic.com>
@benrichard-amd
benrichard-amd force-pushed the users/benrichard-amd/rocjitsu-gcc14-free-nonheap-object branch from 6286c8a to 9c47d6f Compare October 28, 2026 18:45
@kuhar
kuhar merged commit b9d9da9 into develop Oct 28, 2026
67 checks passed
@kuhar
kuhar deleted the users/benrichard-amd/rocjitsu-gcc14-free-nonheap-object branch October 28, 2026 19:55
@github-actions

Copy link
Copy Markdown
Contributor

rocjitsu post-commit fuzz passed

The 32-worker multiplexer campaigns for commit b9d9da936aae completed without recording a crash or hang.

  • ASan+UBSan (6-minute): 604,031 input executions (1,710.57 inputs/s)
  • TSan (6-minute): 558,724 input executions (1,592.04 inputs/s)

View the workflow run.

@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants