public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb: testsuite: fix failed testcases in gdb.base/charset.exp
Date: Mon, 10 Jan 2022 11:23:18 +0800	[thread overview]
Message-ID: <29468082-9c93-b644-199f-784c992ec369@loongson.cn> (raw)
In-Reply-To: <ae434cf9-f53c-d0a8-38cd-d9e75f6c045d@polymtl.ca>



On 1/10/22 10:42, Simon Marchi wrote:
> 
> 
> On 2021-12-24 23:03, Tiezhu Yang wrote:
>> 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
> 
> Out of curiosity, on which configuration do you see these failures?

I test this on LoongArch which is a new RISC architecture.

> Asking because I don't see them on x86-64 Linux.
> 
> Is it related to the fact that some architectures have "char" signed by
> default and others unsigned by default?

Yes.

Each kind of machine has a default for what char should be. It is either 
like unsigned char by default or like signed char by default.

Ideally, a portable program should always use signed char or unsigned 
char when it depends on the signedness of an object.

https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html

Thanks,
Tiezhu

> 
> Simon


  reply	other threads:[~2022-01-10  3:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25  4:03 [PATCH 0/2] Modify gdb.base/charset.c to fix some issues Tiezhu Yang
2021-12-25  4:03 ` [PATCH 1/2] gdb: testsuite: fix failed testcases in gdb.base/charset.exp Tiezhu Yang
2022-01-10  2:42   ` Simon Marchi
2022-01-10  3:23     ` Tiezhu Yang [this message]
2022-01-12  4:28       ` Simon Marchi
2022-01-12 11:31         ` Tiezhu Yang
2022-01-12 17:14           ` Simon Marchi
2022-01-13  1:22             ` Tiezhu Yang
2022-01-13  1:26               ` Simon Marchi
2022-01-13  3:39                 ` Tiezhu Yang
2022-01-13 15:14                   ` Simon Marchi
2021-12-25  4:03 ` [PATCH 2/2] gdb: testsuite: fix wrong comment in gdb.base/charset.c Tiezhu Yang
2021-12-29  4:25 ` [PATCH 0/2] Modify gdb.base/charset.c to fix some issues Joel Brobecker
2021-12-30  3:10   ` Tiezhu Yang
2022-01-08  8:29     ` Joel Brobecker
2022-01-09  5:22       ` Tiezhu Yang
2022-01-09  8:02         ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29468082-9c93-b644-199f-784c992ec369@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).