From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3591 invoked by alias); 11 Feb 2008 12:36:44 -0000 Received: (qmail 3579 invoked by uid 22791); 11 Feb 2008 12:36:43 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 11 Feb 2008 12:36:15 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id m1BCaBhV189672 for ; Mon, 11 Feb 2008 12:36:11 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 v8.7) with ESMTP id m1BCaB5w2093228 for ; Mon, 11 Feb 2008 13:36:11 +0100 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 m1BCaBUK030625 for ; Mon, 11 Feb 2008 13:36:11 +0100 Received: from bbkeks.de.ibm.com (dyn-9-152-248-39.boeblingen.de.ibm.com [9.152.248.39]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m1BCaAif030613 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 11 Feb 2008 13:36:11 +0100 Message-ID: <47B040C7.8080101@de.ibm.com> Date: Mon, 11 Feb 2008 12:36:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: GDB Patches Subject: Access to arrays in fortran buggy Content-Type: text/plain; charset=ISO-8859-15; format=flowed 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-02/txt/msg00170.txt.bz2 Hi, I see some errors in the Fortran testsuite in gdb.fortran/subarray.exp. In subarray.f is an integer array with 7 elements which contain 1-7. The test fails when printing the array members. The only command that works is "print array" which gives (gdb) p array $1 = (1, 2, 3, 4, 5, 6, 7) whereas this (gdb) p array(1:2) $2 = (2, 3) is wrong. The correct result should have been (1,2), Fortran starts counting array members with 1 instead of 0. This (gdb) p array(0:1) $3 = (1, 2) shouldn't be possible. Fortran language uses exp_descriptor_standard to evaluate "p array ...". If you for example use "p array (1:2)" GDB evaluates this expressions and sets the offset in the corresponding "struct value" to 4 which would be correct for C language for example. For my opinion Fortran should have its own evaluation routine for those expressions which access arrays. If the type is not an array Fortran could fall back to the standard routines. What do you think about this approach? I don't want to duplicate a lot of code so I'd say I try to implemenet a fortran specific evaluate_subexp_standard which only works for arrays. If the type is not an array it would fall back to evaluate_subexp_standard from eval.c. Would this be a way to go? Another idea would be to add some language specific code to evaluate_subexp_standard in eval.c but I think this belongs to language specific callbacks. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com