Skip to content

Conversation

@jakobbotsch
Copy link
Member

@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 Jun 4, 2025
@dotnet-policy-service
Copy link
Contributor

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

@jakobbotsch jakobbotsch marked this pull request as ready for review June 4, 2025 17:54
Copilot AI review requested due to automatic review settings June 4, 2025 17:54
@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib

@jakobbotsch jakobbotsch requested a review from a team June 4, 2025 17:54
Copy link
Contributor

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 an issue in Compiler::printfAlloc to ensure it correctly handles long strings by accurately calculating the required buffer size and then properly formatting the output.

  • Utilizes _vscprintf to determine the correct buffer size.
  • Reinitializes the va_list to correctly pass arguments to vsprintf_s.
Comments suppressed due to low confidence (2)

src/coreclr/jit/compiler.cpp:10597

  • [nitpick] Consider renaming the variable 'result' to 'writtenCount' (or a similar name) to more clearly differentiate it from 'count', which represents the computed required size.
int result = vsprintf_s(resultStr, count + 1, format, args);

src/coreclr/jit/compiler.cpp:10596

  • [nitpick] It may be useful to add a comment explaining why va_start is called a second time to reinitialize the va_list for vsprintf_s, clarifying the two-pass approach for future maintainers.
va_start(args, format);

Copy link
Contributor

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

LGTM

@jakobbotsch
Copy link
Member Author

/ba-g Failure is #116261

@jakobbotsch jakobbotsch merged commit 571861b into dotnet:main Jun 4, 2025
108 of 110 checks passed
@jakobbotsch jakobbotsch deleted the fix-printf-limit branch June 4, 2025 18:18
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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