This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Cast char constant to int in sizeof.exp
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Wed, 6 Sep 2017 15:28:54 +0100
- Subject: Re: [RFA] Cast char constant to int in sizeof.exp
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1CD9A882FF
- References: <20170906045306.13440-1-tom@tromey.com>
On 09/06/2017 05:53 AM, Tom Tromey wrote:
> PR gdb/22010 concerns a regression I introduced with the scalar
> printing changes. The bug is that this code in sizeof.exp:
>
> set signof_byte [get_integer_valueof "(int) '\\377'" -1]
The cast shouldn't be here in the log. The cast is what fixes it.
>
> can incorrectly compute sizeof_byte. One underlying problem here is
> that gdb's C parser doesn't treat a char constant as an int (this is
> PR 19973).
>
> However, it seems good to have an immediate fix for the regression.
> The simplest is to cast to an int here.
>
> testsuite/ChangeLog
> 2017-09-05 Tom Tromey <tom@tromey.com>
>
> PR gdb/22010:
> * gdb.base/sizeof.exp (check_valueof): Cast char constant to int.
OK.
Thanks,
Pedro Alves