From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17207 invoked by alias); 22 Jun 2010 19:57:44 -0000 Received: (qmail 17197 invoked by uid 22791); 22 Jun 2010 19:57:43 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Tue, 22 Jun 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 o5MJvZRY020370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Jun 2010 15:57:35 -0400 Received: from qcore.mollernet.net (vpn-9-94.rdu.redhat.com [10.11.9.94]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5MJvYVb032212; Tue, 22 Jun 2010 15:57:34 -0400 Message-ID: <4C2115AE.408@redhat.com> Date: Tue, 22 Jun 2010 19:57:00 -0000 From: Chris Moller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: tromey@redhat.com CC: "gdb-patches@sourceware.org" Subject: Re: [patch] pr11594 References: <4C20A875.7060204@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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-06/txt/msg00488.txt.bz2 On 06/22/10 14:38, Tom Tromey wrote: > > Chris> case BINOP_COMMA: > Chris> - evaluate_subexp (NULL_TYPE, exp, pos, noside); > Chris> - return evaluate_subexp (NULL_TYPE, exp, pos, noside); > Chris> + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); > Chris> + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); > Chris> + if (noside == EVAL_SKIP) > Chris> + goto nosideret; > Chris> + if (current_language->la_language == language_cplus > Chris> + && binop_user_defined_p (op, arg1, arg2)) > Chris> + { > Chris> + struct value *rc; > Chris> + > Chris> + rc = value_x_binop (arg1, arg2, op, OP_NULL, noside); > Chris> + if (rc != NULL) > Chris> + return rc; > Chris> + else > Chris> + return arg2; > > I think I understand why the current_language check and the result check > of value_x_binop are needed. > > However, I think it would be better to do all the work in value_x_binop > and also remove the current_language check. This is more similar to > what other code does and it consolidates the (broken) current_language > checks in the value code. > > I'm guessing this means a change to value_user_defined_op. > I went down that route--that's what's taken so long about getting this patch out. Under some circumstances, you wind up special-case checking for BINOP_COMMA and strcmp("operator," ) all over the place and eventually wind up in a place where there's not enough contextual information left to determine if you're dealing with an overloaded comma and call value_addr() that tries to take the target address of a register value. The value_x_binop() result is checked because binop_user_defined_p() only asserts that it's possible for the operands to represent an overload, not that there is in fact an overload in this instance. That's apparently determined in value_x_binop() and if the operator isn't overloaded, I'm defaulting back to non-overloaded behaviour. (It seems to me that the language check ought to be in binop_user_defined_p() or binop_types_user_defined_p()--is there ever a circumstance other than language_cplus where you can have overloaded operators?) If the language check really is unacceptable, I'll revisit this, but the patch gets significantly more complicated. I'm going to back-burner this, though--I've gone back to the matrix pretty-print stuff for a while. -cm