From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13246 invoked by alias); 21 Jan 2008 15:04:54 -0000 Received: (qmail 13238 invoked by uid 22791); 21 Jan 2008 15:04:53 -0000 X-Spam-Check-By: sourceware.org Received: from ics.u-strasbg.fr (HELO ics.u-strasbg.fr) (130.79.112.250) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 21 Jan 2008 15:04:30 +0000 Received: from ICSMULLER (laocoon.u-strasbg.fr [130.79.112.72]) by ics.u-strasbg.fr (Postfix) with ESMTP id 299F0187022; Mon, 21 Jan 2008 16:10:45 +0100 (CET) From: "Pierre Muller" To: "'Eli Zaretskii'" , "'Joel Brobecker'" Cc: References: <002d01c85849$ef420f80$cdc62e80$@u-strasbg.fr> <20080117115741.GC28020@adacore.com> <20080117120327.GD28020@adacore.com> In-Reply-To: Subject: RE: [RFA] Handle BINOP_INTDIV in valarith.c Date: Mon, 21 Jan 2008 15:04:00 -0000 Message-ID: <004101c85c3e$ef8be670$cea3b350$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us 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-01/txt/msg00506.txt.bz2 I would like to have some feedback from the other languages that seem to also use BINOP_INTDIV. Furthermore, my patch is incomplete, I forgot the eval.c part that is required: I send here a minimal patch to allow to get a 'print 13 div 3' to return '4' Does this patch work for fortran, ada, modula-2? I suspect that the type checking is not appropriate for most of these languages: Boolean types are not considered as ordinals in pascal, and probably also not in the languages cited above. For pascal, 'print 13 div true' as well as print 12 + true' should not be allowed, but it is now... Is this OK? ChangeLog entry: 2008-01-21 Pierre Muller * eval.c (evaluate_subexp_standard): Support BINOP_INTDIV opcode. Index: gdb/eval.c =================================================================== RCS file: /cvs/src/src/gdb/eval.c,v retrieving revision 1.77 diff -u -p -r1.77 eval.c --- gdb/eval.c 18 Jan 2008 17:07:39 -0000 1.77 +++ gdb/eval.c 21 Jan 2008 14:55:45 -0000 @@ -1496,6 +1496,7 @@ evaluate_subexp_standard (struct type *e case BINOP_EXP: case BINOP_MUL: case BINOP_DIV: + case BINOP_INTDIV: case BINOP_REM: case BINOP_MOD: case BINOP_LSH: @@ -1510,7 +1511,8 @@ evaluate_subexp_standard (struct type *e if (binop_user_defined_p (op, arg1, arg2)) return value_x_binop (arg1, arg2, op, OP_NULL, noside); else if (noside == EVAL_AVOID_SIDE_EFFECTS - && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD)) + && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD + || op == BINOP_INTDIV)) return value_zero (value_type (arg1), not_lval); else return value_binop (arg1, arg2, op);