From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by sourceware.org (Postfix) with ESMTPS id 5971E3858D37 for ; Fri, 23 Jun 2023 08:04:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5971E3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orange.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=orange.fr Received: from [192.168.1.16] ([86.215.161.51]) by smtp.orange.fr with ESMTPA id Cbmjqvy5CxfPbCbmpq2tiX; Fri, 23 Jun 2023 10:04:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1687507495; bh=rvHrEbOpTKdmccML/aftLp4YGsPL3ufoK5exuqKFSI8=; h=Date:Subject:To:References:From:In-Reply-To; b=RnYuDgDKNUMdEqnHrDApCcKonBSjthxa2VGFmO2wfEMa7bPQDyueWKBvrUlFkW/JU bb65Z9WWyTiAhyIqsYelJKV449BoWdi94R4xHwYVVWdgemgjGeB0rI7sYlcJBFexWK fZpDVuvjk3htA9CnE5qg5rwgqQs3zlUr4hBCmI3MxKS7SFX+Pv/s8QY7EVRCDass48 c2JpR34QGxXXsqjJVvkjldfIPWxxQ68uo35OhkYvr1m2yBnHisonFQw6sDsCPeUWcS 56aRJD6zRfWWe89xpPpQDquVmCzq3NGdlbLx4zszKiCfT7H5oAT47AE62bPT3Jj4Ib 0F9kte1A7dCLA== X-ME-Helo: [192.168.1.16] X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Fri, 23 Jun 2023 10:04:55 +0200 X-ME-IP: 86.215.161.51 Message-ID: <56040e97-30ee-ef69-4582-248a4e46f4ae@orange.fr> Date: Fri, 23 Jun 2023 10:04:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] Fortran: ABI for scalar CHARACTER(LEN=1),VALUE dummy argument [PR110360] To: Harald Anlauf , fortran , gcc-patches References: Content-Language: fr From: Mikael Morin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,JMQ_SPF_NEUTRAL,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Le 22/06/2023 à 22:23, Harald Anlauf via Fortran a écrit : > Dear all, > > gfortran's ABI specifies that actual arguments to CHARACTER(LEN=1),VALUE > dummy arguments are passed by value in the scalar case. That did work > for constant strings being passed, but not in several other cases, where > pointers were passed, resulting in subsequent random junk... > > The attached patch fixes this for the case of a non-constant string > argument. > > It does not touch the character,value bind(c) case - this is a different > thing and may need separate work, as Mikael pointed out - and there is > a missed optimization for the case of actual constant string arguments > of length larger than 1: it appears that the full string is pushed to > the stack. I did not address that, as the primary aim here is to get > correctly working code. (I added a TODO in a comment.) > > Regtested on x86_64-pc-linux-gnu. OK for mainline? > OK, thanks. > Thanks, > Harald >