[pacman-dev] [PATCH 0/3] Char signedness issues
Rikard Falkeborn
rikard.falkeborn at gmail.com
Thu Dec 31 13:19:28 UTC 2015
I tried compiling pacman on my RPi (Arm), where char is unsigned by default.
That leads to some things not working the way they are expected too. The
problem is as follows:
char a = -1;
if (a == -1) { ... }
If char is unsigned, we will not enter the if-statement (a is converted to int)
before making the comparisson.
Gcc will warn about these comparissons. The first two patches fixes the
cases I (and Gcc) could find, and the third one is a couple of tests I wrote
to convince myself there was a problem in pacsort (and more importantly, that
the changes actually fixes something).
After doing this, I realize that the simplest solution probably would be to
add -fsigned-char as an argument to the compiler... thoughts?
Rikard Falkeborn (3):
Make alpm_graph state signedness explicit
pacsort, introduce define for escape_char error code
Add pacsort tests with invalid input
lib/libalpm/graph.h | 2 +-
src/util/pacsort.c | 11 ++++++-----
test/util/pacsorttest.sh | 18 +++++++++++++++++-
3 files changed, 24 insertions(+), 7 deletions(-)
--
2.6.4
More information about the pacman-dev
mailing list