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!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Gnat 2013 is out! Date: Thu, 30 May 2013 11:39:46 +0100 Organization: A noiseless patient Spider Message-ID: References: <32d94173-533a-471e-95a0-abb73a6cdcc2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="4ffb1c05600de3518d780cd24ef281ca"; logging-data="31428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MSRgVTp3T+tYTPoBBiIDmBRhHwWZOaK0=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:peYkVL7DdhsaLvpJoKfB3XiR+Sg= sha1:ibojv+2AHiHWksald/Ye1PV5yAI= Xref: news.eternal-september.org comp.lang.ada:15672 Date: 2013-05-30T11:39:46+01:00 List-Id: Adam Beneschan writes: > On Wednesday, May 29, 2013 3:39:44 PM UTC-7, Randy Brukardt wrote: > >> >> But it's reporting a problem with my Ada 2005 Math Extensions >> >> .. not so good (for me). >> >> > Turned out to be a warning new to GNAT GPL 2013 (also in GCC 4.8.0): >> > had a subprogram with two out parameters that designated the same >> > object. It was a dummy, though, so no harm done. >> >> > ada_numerics-generic_arrays.adb:325:28: warning: writable actual for >> > "V_L" overlaps with actual for "V_R" >> >> You do know that's illegal in some cases in Ada 2012? (A known and >> intended incompatibility.) I wouldn't be surprised if GNAT is putting >> out a warning in other modes in order to reduce the >> incompatibility. (Or, perhaps, they're using the code they had to >> write to make the Ada 2012 check to issue warnings in other cases.) >> I'd suggest getting rid of any such code. > > Even before Ada 2012, it's been possible to run into a problem with > "distinct access paths". A subprogram with two OUT parameters could > set a component in one OUT parameter, and then later try reading it > back; if it's written something into the other OUT parameter in > between, and if the caller uses the same actual for both OUT > parameters, it could cause a real problem. I'm guessing that Simon is > calling one of his own routines, so he knows that won't happen. But > it still seems like bad practice. If I read the RM right (I probably don't), then because in this case I don't read the values assigned (they are dummies, after all) I should be OK. (ARM 6.2 (12/3)). I tried declaring the dummy matrices as of zero size, but they are passed to Fortran (LAPACK) which couldn't cope with the idea; at least it returned "illegal value for parameter 12", better than an access violation! And it didn't suppress GNAT's warning anyway. So the code now has distinct writable actuals. Thanks for the discussion.