cppcheck noticed that, in the file lib/readline/bind.c, the function rl_generic_bind contains a loop that declares a variable named ic in the loop body, and relies on that variable being initialized with its value from the previous iteration (in the line "prevkey = ic;"), which is not something that the compiler guarantees. This patch lifts the declaration of ic outside the loop to ensure that its value is preserved across those iterations.
The file produced by running "strip" on the resulting bind.o file is unchanged by this patch on the x86_64 and i686 configurations that I tried. I have not signed an FSF copyright assignment, but I hereby release my copyright interest in this trivial change to the public domain. I hope that suffices, but please let me know if that is not the case. Thanks in advance for considering this patch submission. Adam
diff --git a/lib/readline/bind.c b/lib/readline/bind.c index 57ae10f..f69243d 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -356,6 +356,7 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) register int i; KEYMAP_ENTRY k; Keymap prevmap; + int ic; k.function = 0; @@ -385,7 +386,6 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) for (i = 0; i < keys_len; i++) { unsigned char uc = keys[i]; - int ic; if (i > 0) prevkey = ic;