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 <yangtiezhu@loongson.cn>
This commit is contained in:
Tiezhu Yang
2022-01-12 08:31:02 +08:00
parent e66b7536b7
commit ff656e2e1c

View File

@ -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;