-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uninitialised variable in print_exponential_number #123
Comments
This is a compiler "bug". Look at the logic:
You see? It can't be used uninitialized. See it GodBolt also. What compiler are you using? |
I don't know what ESP-IDF means. Please file a bug against either the IDE or the compiler it uses to generate warnings. |
It will not compile with -Wmaybe-uninitialized unless I default abs_exp10_covered_by_powers_table to false. |
First of all, you're treating warnings as errors. That is your prerogative, but the library's build mechanism does not do that on its own. Secondly, and again - a warning here is a bug in your compiler. There is no sense in complaining about it here. The code is correct. Please file a bug against the compiler. |
The only place that abs_exp10_covered_by_powers_table is defined is at Line 873 in 19a487c
which is under an if-else statement. I don't see how this is a compiler error. |
I see, the code won't check for abs_exp10_covered_by_powers_table if floored_exp10 == 0 |
@203Null : Exactly. |
The compiler I used is Xtensa ESP32 gcc 8.4.0 (2021r2) I will make an issue in their Github repo |
I saw you did some commits regarding this issue. Line 631 in f8ed5a9
Those codes are actually fine with my compiler (not sure about others) These lines in print_exponential_number are actually the ones causing issues for me. Porting your changes over solves it. Line 908 in f8ed5a9
|
@203Null : Please open a separate about your issue; explain exactly on which system and with which compiler in what version you get an error, and copy the relevant compiler output. |
It's the exact same issue. I posted my log earlier #123 Just want to point out the |
Ok, I'll add the pragma there as well. |
Hi - I get the following warning when compiling printf.c (master [8b831c1]):
printf.c:899:47: warning: 'abs_exp10_covered_by_powers_table' may be used uninitialized in this function [-Wmaybe-uninitialized]
I've not done any in-depth analysis of how print_exponential_number works, so I'm not sure if this really matters. Still, it would be nice if abs_exp10_covered_by_powers_table could be initialised with a default value to get rid of this warning.
The text was updated successfully, but these errors were encountered: