llvm / llvm/llvm-project

[libc][stdlib] strfromf does not handle inf correctly

Open Beginner friendly
#217,708 1 comment 0 reactions 0 assignees View on GitHub
libc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Calling `strfromf()` with "%f" as the format string and positive or negative infinity results in "nan" being written to the output buffer (ran on x86_64 linux).

Tests cover only `strfromd` and `strfroml` in [StrfromTest.h](https://github.com/llvm/llvm-project/blob/main/libc/test/src/stdlib/StrfromTest.h#L122-L127).

Contributor guide

Open the contributing guide

Research direction

Start with the strfromf entry point and inspect libc/test/src/stdlib/StrfromTest.h, especially the existing strfromd and strfroml coverage. Reproduce the %f case for positive and negative infinity, then add equivalent strfromf coverage and ensure the output is no longer "nan".

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.