From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3990 invoked by alias); 25 Jan 2010 19:57:42 -0000 Received: (qmail 3981 invoked by uid 22791); 25 Jan 2010 19:57:41 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jan 2010 19:57:37 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0PJvZqT002967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Jan 2010 14:57:35 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0PJvZY9018782; Mon, 25 Jan 2010 14:57:35 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o0PJvYva026931; Mon, 25 Jan 2010 14:57:34 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id CC28637819A; Mon, 25 Jan 2010 12:57:33 -0700 (MST) From: Tom Tromey To: gdb-patches@sourceware.org Subject: RFC: fix PR 7643 Reply-To: tromey@redhat.com Date: Mon, 25 Jan 2010 19:57:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00570.txt.bz2 This fixes PR exp/7643. The bug is: (gdb) ptype &*"foo" type = char [4] ... where the correct answer is "char *". The fix is to add a call coerce_array in the optimized UNOP_IND case in evaluate_subexp_for_address. I plan to check this in, but before doing so I thought I would ask to see whether this messes anything up for non-C languages (specifically Ada, I suppose). I built and regtested this on x86-64 (compile farm). So, if this is in fact wrong for some other language, a test case would be handy. Tom 2010-01-25 Tom Tromey PR exp/7643: * eval.c (evaluate_subexp_for_address) : Call coerce_array on result. 2010-01-25 Tom Tromey PR exp/7643: * gdb.base/printcmds.exp (test_print_string_constants): Remove setup_kfail. Index: eval.c =================================================================== RCS file: /cvs/src/src/gdb/eval.c,v retrieving revision 1.125 diff -u -r1.125 eval.c --- eval.c 18 Jan 2010 20:54:33 -0000 1.125 +++ eval.c 25 Jan 2010 19:53:35 -0000 @@ -2629,7 +2629,7 @@ goto default_case_after_eval; } - return x; + return coerce_array (x); case UNOP_MEMVAL: (*pos) += 3; Index: testsuite/gdb.base/printcmds.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/printcmds.exp,v retrieving revision 1.28 diff -u -r1.28 printcmds.exp --- testsuite/gdb.base/printcmds.exp 25 Jan 2010 19:31:24 -0000 1.28 +++ testsuite/gdb.base/printcmds.exp 25 Jan 2010 19:53:37 -0000 @@ -647,7 +647,6 @@ gdb_test "p *\"foo\"" " = 102 'f'" gdb_test "ptype *\"foo\"" " = char" gdb_test "p &*\"foo\"" " = \"foo\"" - setup_kfail "gdb/538" *-*-* gdb_test "ptype &*\"foo\"" "type = char \\*" gdb_test "p (char *)\"foo\"" " = \"foo\"" }