Skip to content

Conversation

kg
Copy link
Member

@kg kg commented Aug 18, 2025

I think this is a bug.

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 18, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@kg kg marked this pull request as ready for review August 18, 2025 22:31
@Copilot Copilot AI review requested due to automatic review settings August 18, 2025 22:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the JIT allocator where zero-length allocations were causing incorrect deallocation behavior. The issue occurs when the allocator returns a reference to a static target for zero-length allocations, but then attempts to deallocate that reference as if it were a normal heap allocation.

  • Adds a safety check to prevent deallocation of the zero-length allocation target
  • Protects against potential crashes or undefined behavior during memory cleanup

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

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

CompAllocator::dellocate called below is a no-op, so no actual bug here. But the change seems good anyway to mirror what happens in alloc.

@kg kg merged commit 19b9833 into dotnet:main Aug 19, 2025
111 of 113 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants