From: Tiezhu Yang Date: Wed, 12 Jan 2022 00:31:02 +0000 (+0800) Subject: gdb: testsuite: fix failed testcases in gdb.base/charset.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff656e2e1cb1592617a0bb4b21538d3cea17c24f;p=binutils-gdb.git gdb: testsuite: fix failed testcases in gdb.base/charset.exp In gdb/testsuite/gdb.base/charset.c, the last argument is greater than 127 when call fill_run() in EBCDIC-US and IBM1047, but the type of string[] is char, this will change the value due to sign extension. For example, ebcdic_us_string[7] will be -63 instead of the original 193 in EBCDIC-US. Make the type of string[] as unsigned char to fix the following six failed testcases: $ grep FAIL gdb/testsuite/gdb.sum FAIL: gdb.base/charset.exp: check value of parsed character literal in EBCDIC-US FAIL: gdb.base/charset.exp: check value of parsed string literal in EBCDIC-US FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in EBCDIC-US FAIL: gdb.base/charset.exp: check value of parsed character literal in IBM1047 FAIL: gdb.base/charset.exp: check value of parsed string literal in IBM1047 FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in IBM1047 Signed-off-by: Tiezhu Yang --- diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c index ed9387b926d..98aa100f291 100644 --- a/gdb/testsuite/gdb.base/charset.c +++ b/gdb/testsuite/gdb.base/charset.c @@ -44,10 +44,10 @@ #define NUM_CHARS (71) -char ascii_string[NUM_CHARS]; -char iso_8859_1_string[NUM_CHARS]; -char ebcdic_us_string[NUM_CHARS]; -char ibm1047_string[NUM_CHARS]; +unsigned char ascii_string[NUM_CHARS]; +unsigned char iso_8859_1_string[NUM_CHARS]; +unsigned char ebcdic_us_string[NUM_CHARS]; +unsigned char ibm1047_string[NUM_CHARS]; #ifndef __cplusplus @@ -86,7 +86,7 @@ long long_array[3]; explicit casts or warnings. */ void -init_string (char string[], +init_string (unsigned char string[], unsigned char x, unsigned char alert, unsigned char backspace, @@ -115,7 +115,7 @@ init_string (char string[], void -fill_run (char string[], int start, int len, int first) +fill_run (unsigned char string[], int start, int len, int first) { int i;