From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26002 invoked by alias); 6 Feb 2015 11:19:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 25901 invoked by uid 48); 6 Feb 2015 11:19:22 -0000 From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64952] Missing temporary in assignment from elemental function Date: Fri, 06 Feb 2015 11:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00559.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64952 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #2 from Mikael Morin --- (In reply to Paul Thomas from comment #0) > Fortunately, it only affects contained functions so that we do not have to > carry it across when using modules. > Don't we have to? Wouldn't it be the same if ARRAY and FRED were use-associated symbols, or if FRED was accessing ARRAY through use-association instead of host-association? (In reply to Tobias Burnus from comment #1) > On the other hand, it would be probably > faster to do: > tmp = pure_function() > array = elemental(array) * tmp > which also avoids this problem. As far as I know, the scalarizer does this already (in both cases where pure_function is scalar and non-scalar). By the way, a temporary is also necessary for array = Fred(index, other_array) that is, array need not be as argument to Fred.