From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17745 invoked by alias); 9 Sep 2008 22:12:31 -0000 Received: (qmail 17424 invoked by uid 22791); 9 Sep 2008 22:12:30 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.29.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 09 Sep 2008 22:11:47 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.8/8.13.8) with ESMTP id m89MBfSQ181302 for ; Tue, 9 Sep 2008 22:11:41 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m89MBeJG3309726 for ; Wed, 10 Sep 2008 00:11:40 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m89MBeUY023548 for ; Wed, 10 Sep 2008 00:11:40 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id m89MBers023545; Wed, 10 Sep 2008 00:11:40 +0200 Message-Id: <200809092211.m89MBers023545@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 10 Sep 2008 00:11:40 +0200 Subject: Re: [rfc][00/37] Eliminate builtin_type_ macros To: brobecker@adacore.com (Joel Brobecker) Date: Tue, 09 Sep 2008 22:12:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20080909211801.GH12222@adacore.com> from "Joel Brobecker" at Sep 09, 2008 02:18:02 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2008-09/txt/msg00200.txt.bz2 Joel Brobecker wrote: > 1. Pointer arithmetics, in particular "PTR + PTR" or "PTR - PTR" > expressions. For instance: > > (gdb) print b'address - a'address > Argument to arithmetic operation not a number or boolean. > > It's worth mentioning that the problem was already present > with pointer addition (adding two pointers doesn't necessarily > make a lot of sense, but anyway...). > > The regression on the substraction is because we replaced the > call to (rip'ed) value_sub by a call to value_binop, which > doesn't support pointer differences. > > I think the semantics of pointer differences in Ada are different > from C. It's just a number substraction. So I just added support > for it directly at the caller site, thus calling value_binop > only for values that it supports. Same for addition. I see. In that case, your patch would be a bugfix completely independently of my patch set. Do you want to commit it right away? > 2. The second problem is just an oversight. You needed a variable > to store the int builtin type, and unfortunately you reused > a variable that was still in use. > See ada-lang.c (evaluate_subexp) [OP_ATR_SIZE]. > > For now, I just used builtin_type_int32. Not ideal, but should > be large enough for the vast majority of objects we actually > have to deal with in real life. Huh? I'm not sure what base this patch is against: > --- a/ada-lang.c Tue Sep 09 12:31:38 2008 -0700 > +++ b/ada-lang.c Tue Sep 09 12:57:26 2008 -0700 > @@ -10541,11 +10541,10 @@ ada_evaluate_subexp (struct type *expect > > if (noside == EVAL_SKIP) > goto nosideret; > - type = builtin_type (exp->gdbarch)->builtin_int; > if (noside == EVAL_AVOID_SIDE_EFFECTS) > - return value_zero (type, not_lval); > - else > - return value_from_longest (type, > + return value_zero (builtin_type_int32, not_lval); > + else > + return value_from_longest (builtin_type_int32, > TARGET_CHAR_BIT * TYPE_LENGTH (type)); > > case OP_ATR_VAL: The OP_ATR_SIZE in ada_evaluate_subexp in current head looks like this: case OP_ATR_SIZE: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) return value_zero (builtin_type_int, not_lval); else return value_from_longest (builtin_type_int, TARGET_CHAR_BIT * TYPE_LENGTH (value_type (arg1))); and after my patch set we have: case OP_ATR_SIZE: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; type = builtin_type (exp->gdbarch)->builtin_int; if (noside == EVAL_AVOID_SIDE_EFFECTS) return value_zero (type, not_lval); else return value_from_longest (type, TARGET_CHAR_BIT * TYPE_LENGTH (value_type (arg1))); Do you have some other patches applied? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com