From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Making the same mistake as the broken C interface to fortran Date: Tue, 02 Jul 2019 21:57:23 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="5201a3056fddd6f6df8f5ec06fc0a4a7"; logging-data="27280"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19x2uXfgOOK54jWq6Olm4ZMye9cZpeFjCA=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:fN0FgrR3Qvpr+oktpPCGwWKymo8= sha1:2WJWuKuPU+absPWqNztoBSXtx7U= Xref: reader01.eternal-september.org comp.lang.ada:56805 Date: 2019-07-02T21:57:23+01:00 List-Id: Chris M Moore writes: > Read this interesting article today: > > https://lwn.net/SubscriberLink/791393/41d57555202e8cdb/ > > Synopsis: C interfaces to Fortran makes some assumptions about how to > call fortran ABIs (I don't need to pass the hidden length parameter if > its a character*1) but now Gfortran has optimisations which assume a > different calling convention (Thou shalt pass the hidden length). > > There are work arounds (compile fortran with > ‑fno‑optimize‑sibling‑calls) but it seems that the proper fix is to > pass the hidden length parameter. > > I had a quick look at the LAPACK bindings and they both seem to use > Ada characters. :/ The code generated with Convention=Fortran should abide by the ABI, and if that says to pass a hidden length parameter then that's what should happen. I don't know enough x86_64 (or thumb) assembler to be at all sure, but it looks to me as though no length parameter gets passed.