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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e859f774bbb3dfb3 X-Google-Thread: 1094ba,40d8c5edfa36ea47 X-Google-Attributes: gid103376,gid1094ba,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!news.motzarella.org!motzarella.org!not-for-mail From: Craig Powers Newsgroups: comp.lang.ada,comp.lang.fortran Subject: Re: another way to shoot yourself in the foot? Date: Thu, 10 Jul 2008 16:45:48 -0400 Organization: A noiseless patient Spider Message-ID: References: <54157920-377a-441b-9b0b-f0c4f9ddffec@f36g2000hsa.googlegroups.com> <54435596-5e7f-4686-a2b7-1e22d7c4b186@p25g2000hsf.googlegroups.com> <_wPbk.7600$L_.4566@flpi150.ffdc.sbc.com> <1ijtbxq.1t7i71w700eykN%nospam@see.signature> Reply-To: enigma@hal-pc.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: reader.motzarella.org U2FsdGVkX187wAiVOguceZyFl+VGFv6oWv9N7MopIw+KF2Dv+4q/WA2Tw3CIm+brVSkmyXpPJ6IuDQwr+NpFkN3YJZkMqOs1GS9s71QUCiRv/43wnXhh74OdyFKmTNF0wl3/a69srDckiqlKjraBjg== X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers NNTP-Posting-Date: Thu, 10 Jul 2008 20:45:48 +0000 (UTC) In-Reply-To: X-Auth-Sender: U2FsdGVkX1+c0WM08luxOLIdgeeoVAtB6BmdD5cJL7uMcbmErnLhIQ== Cancel-Lock: sha1:oyzeMlWI8KxnrTDhfGRSQFvPg8A= User-Agent: Thunderbird 1.5.0.10 (X11/20070301) Xref: g2news1.google.com comp.lang.ada:1093 comp.lang.fortran:2601 Date: 2008-07-10T16:45:48-04:00 List-Id: James Giles wrote: > Craig Powers wrote: >> Dick Hendrickson wrote: >>> Colin Paul Gloster wrote: >>>> Does Fortran always automatically check if the INTERFACE actually >>>> corresponds to the code? >>>> >>> Depends on the compiler, but in general NO. I think all >>> compilers will detect an explicit assignment to a dummy >>> argument that has INTENT(IN) in the subroutine; I'm not sure >>> any will detect an assignment if the dummy is passed on >>> to another routine and that routine (illegally) assigns to >>> its argument. >> Is that actually possible without lying about an interface? i.e. Is >> it possible to pass an INTENT(IN) dummy as an actual argument to a >> more permissive dummy argument in another routine (no intent or >> intent OUT) > > It's not permitted. The standard doesn't require implementations to > verify that it's not done. That is, it's not one of the kinds of error > that the standard requires implementations to detect and report. Actually, that's not exactly right. It's not permitted to pass an INTENT(IN) to a dummy with intent OUT (i.e. INTENT(INOUT) or INTENT(OUT)), this is a constraint in 5.1.2.3 in the F95 draft as well as constraint C545 in the F03 draft, so I think it would require a diagnostic. However, it IS permitted to pass an INTENT(IN) to an unspecified INTENT dummy, and in that case it would be possible to modify it (and I wouldn't expect a compiler to even realistically be able to detect that except in very specific circumstances).