Re: [RFC] Signed/unsigned character arrays are not strings

Daniel Jacobowitz
2007-02-12T22:15:06Z

On Thu, Jan 25, 2007 at 12:32:06PM +0100, Jan Kratochvil wrote:
> Attaching also "gdb-cvs-nosign-char.patch" for possible comments.
> It starts printing
> $1 = {65 'A', 0 '\0'}
> finally as
> $1 = {65, 0}
> Not submitting it for commit review as it breaks the whole testsuite.
> Still if anybody could update the testsuite it would be IMO a helpful patch.
> Currently GDB displays the variants " 'X'" in many inappropriate cases.

I must have forgotten about this message when the other patch went in.
This would be a painful testsuite update... but I think it would be
really nice. Does anyone else have an opinion?

Before Jan's now committed patch, for strings:
(gdb) p $mm0.v8_int8
$1 = "\000\000\000\000\000\000\000"

After, i.e. CVS HEAD:
(gdb) p $mm0.v8_int8
$2 = {0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0'}

That's better... but it really should be:
$2 = {0, 0, 0, 0, 0, 0, 0, 0}

This is int8_t, we know it's not a char, and when I'm trying to do
math with an eight-element integer vector the chars are confusing.

If this is a good idea, I'll take care of the testsuite updates for at
least two platforms. That will cover most of it, and then we can
fix the rest as they are noticed.

--
Daniel Jacobowitz
CodeSourcery