From patchwork Wed Sep 6 04:53:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 22665 Received: (qmail 125059 invoked by alias); 6 Sep 2017 04:53:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 123428 invoked by uid 89); 6 Sep 2017 04:53:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy10-pub.mail.unifiedlayer.com Received: from gproxy10-pub.mail.unifiedlayer.com (HELO gproxy10-pub.mail.unifiedlayer.com) (69.89.20.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Sep 2017 04:53:14 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy10.mail.unifiedlayer.com (Postfix) with ESMTP id 17A001405EF for ; Tue, 5 Sep 2017 22:53:13 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id 64t91w00J2f2jeq014tCfc; Tue, 05 Sep 2017 22:53:13 -0600 X-Authority-Analysis: v=2.2 cv=fJ5J5dSe c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=PWkG9H6AXEEuUOy9qmgA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:51322 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dpSKr-003JG4-O8; Tue, 05 Sep 2017 22:53:09 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Cast char constant to int in sizeof.exp Date: Tue, 5 Sep 2017 22:53:06 -0600 Message-Id: <20170906045306.13440-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dpSKr-003JG4-O8 X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:51322 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes 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] 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 PR gdb/22010: * gdb.base/sizeof.exp (check_valueof): Cast char constant to int. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/sizeof.exp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b3bed5c..01c6249 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-09-05 Tom Tromey + PR gdb/22010: + * gdb.base/sizeof.exp (check_valueof): Cast char constant to int. + +2017-09-05 Tom Tromey + * lib/gdb.exp (gdb_compile): Don't use universal_compile_options for rust. diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index 5d89407..13d36f8 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -86,7 +86,7 @@ proc check_valueof { exp val } { # Check that GDB and the target agree over the sign of a character. -set signof_byte [get_integer_valueof "'\\377'" -1] +set signof_byte [get_integer_valueof "(int) '\\377'" -1] set signof_char [get_integer_valueof "(int) (char) -1" -1] set signof_signed_char [get_integer_valueof "(int) (signed char) -1" -1] set signof_unsigned_char [get_integer_valueof "(int) (unsigned char) -1" -1]