eyalroz / printf

Tiny, fast(ish), self-contained, fully loaded printf, sprinf etc. implementation; particularly useful in embedded systems.
MIT License
402 stars 50 forks source link

print_exponential_number()'s variable "abs_exp10_covered_by_powers_table" may be really uninitialized #158

Closed me9atherion closed 1 year ago

me9atherion commented 1 year ago

https://github.com/eyalroz/printf/blob/5190e484100b19b076fb852893c6bcfd5624c1a4/src/printf/printf.c#L939C1-L939C1

Most recent GCC 12 compiler from ARM complained for potential uninitialization of "abs_exp10_covered_by_powers_table" variable also (I built code from "master" branch, not "develop"). And I noticed that probably this is really a bug. "abs_exp10_covered_by_powers_table" is a boolean variable which is declared without an initialization. And it receives the initial value conditionally only in else branch of checking the condition "if(abs_number == 0.0)". So, I suspect that it is really a bug and adding this pragma here really hides the problem, not solves it.

eyalroz commented 1 year ago

Duplicate of #123 ; it's a compiler bug.