From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10746 invoked by alias); 13 Feb 2019 21:24:30 -0000 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 Received: (qmail 10704 invoked by uid 89); 13 Feb 2019 21:24:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=pleasant X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.53.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Feb 2019 21:24:25 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway20.websitewelcome.com (Postfix) with ESMTP id A0814400CF186 for ; Wed, 13 Feb 2019 15:24:23 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id u211gjyfD90onu211g7Aoi; Wed, 13 Feb 2019 15:24:23 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6cOau9/zpphNbCDgMY4IrqVrPTT9Lql5yHDDmbTQ0FE=; b=E2+p5EXVSLcnI00eXqYQ05Nw6Z ymLkKzpHmuFbi/NuxtzLO3d5lMyAzIx7e41Bj+a1bi0Uzhy+clTU8CsY4533VfQM12VuvE3HNFWEK MW+wIF0h4oYqJIKauEJyDL2Oq; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:42108 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gu211-001TXi-9h; Wed, 13 Feb 2019 15:24:23 -0600 From: Tom Tromey To: Richard Bunt Cc: "gdb-patches\@sourceware.org" , nd Subject: Re: [PATCH v2] Fortran function calls with arguments References: <57a95dca-d3cf-d1d3-eba1-7e58f73fa918@arm.com> Date: Wed, 13 Feb 2019 21:24:00 -0000 In-Reply-To: <57a95dca-d3cf-d1d3-eba1-7e58f73fa918@arm.com> (Richard Bunt's message of "Fri, 8 Feb 2019 18:10:10 +0000") Message-ID: <878syj5qm1.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-02/txt/msg00187.txt.bz2 >>>>> "Richard" == Richard Bunt writes: Richard> It is possible to call Fortran functions, but memory must be allocated in Richard> the inferior, so a pointer can be passed to the function, and the Richard> language must be set to C to enable C-style casting. This is cumbersome Richard> and not a pleasant debug experience. Baking in the compiler ABI is unfortunate but I suppose nothing gdb hasn't done before; and anyway I don't think there's a way to express this "properly". Richard> Since the GNU Fortran argument passing convention has been implemented, Richard> there is no guarantee that this patch will work correctly, in all cases, Richard> with other compilers. Do you have any information at all on other compilers, or even whether older versions of GNU Fortran differ? Richard> + /* Arguments in Fortran are passed by address. Coerce the Richard> + arguments here rather than in value_arg_coerce as otherwise Richard> + the call to malloc to place the non-lvalue parameters in Richard> + target memory is hit by this Fortran specific logic. This Richard> + results in malloc being called with a pointer to an integer Richard> + followed by an attempt to malloc the arguments to malloc in Richard> + target memory. Infinite recursion ensues. */ Thanks for writing this comment. Richard> +fortran_argument_convert (struct value *value, const bool is_artificial) I think the "const" here and in the header can be removed. It doesn't add much here, and doesn't add anything in the header. The patch is ok with that change. Thanks for doing this. Tom