From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9156 invoked by alias); 11 Jun 2015 17:58:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 9144 invoked by uid 89); 11 Jun 2015 17:58:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 11 Jun 2015 17:58:52 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id F33C15423DA; Thu, 11 Jun 2015 19:58:47 +0200 (CEST) Date: Thu, 11 Jun 2015 18:19:00 -0000 From: Jan Hubicka To: Mikael Morin Cc: Jan Hubicka , Richard Biener , Joseph Myers , gcc-patches@gcc.gnu.org, burnus@net-b.de Subject: Re: Fortran's C_CHAR type Message-ID: <20150611175847.GB51916@kam.mff.cuni.cz> References: <20150608144415.GA23542@kam.mff.cuni.cz> <20150608150837.GC23542@kam.mff.cuni.cz> <20150608153132.GB17321@kam.mff.cuni.cz> <5578239D.4050504@sfr.fr> <20150610143803.GC60741@kam.mff.cuni.cz> <557864E5.3020008@sfr.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <557864E5.3020008@sfr.fr> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-06/txt/msg00875.txt.bz2 > I have had a look at the table and the text around, and first I should > correct myself. > C_CHAR is 1, C_SIGNED_CHAR is 1, and the default values for len= and > kind= are 1 as well. > So, even if CHARACTER(KIND=C_CHAR) is what should be used as it's not > dependent on the implementation's default kind choice, it boils down to > the same as CHARACTER(C_CHAR), namely CHARACTER(len=1, kind=1) actually. Thanks for explanation - as I said I hardly wrote any Fortran code except for these few testcases :)) > > > And about the line saying CHARACTER(KIND=C_CHAR) interoperable with char > in table 15.2: > You're right, while I would myself prefer to use an > INTEGER(KIND=C_SIGNED_CHAR) type, CHARACTER(KIND=C_CHAR) should be > supported as well. > That means that char should be compatible with char[1], I think. > You said there is no guarantee they are passed the same way? With LTO we definitely don't consider the types compatible, so we produce bogus warning. Things may work on TBAA side because it basically ignores arrays, but I am not 100% sure - will double check. For passing conventions, it is definitely not a requirement of C ABI to pass arrays of size 1 and scalars same way. I think there are ABIs passing scalars in registers and everything else in memory (PPC SYSV ABI?). If we consider my testcase defined, I would suggest simply adding it to testsuite and lets see if something breaks. > > > > If you can look at the other c-bind testcases I produced, I would really appreachiate that. > I have looked at: > https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00693.html > https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00713.html > I saw nothing wrong with the tests. > Avoiding character interoperability avoids most of the pain. ;-) Hehe, quite on the contrary, I would say that both Richard and me had quite some pain from the rest of interoperability rules, too ;)) Honza > > Mikael