From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105754 invoked by alias); 23 Jul 2015 07:04:20 -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 105712 invoked by uid 55); 23 Jul 2015 07:04:16 -0000 From: "paul.richard.thomas at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64986] class_to_type_4.f90: valgrind error: Invalid read/write of size 8 Date: Thu, 23 Jul 2015 07:04: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: paul.richard.thomas at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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: 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-07/txt/msg01954.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64986 --- Comment #13 from paul.richard.thomas at gmail dot com --- Dear Mikael, A good principle in general is to assume cock-up, rather than conspiracy :-) The reason for this spreading between two functions is incremental development done at very different times. If you can see a way to rationalize the implementation, please do it. Many thanks for the patch - assume that it is OK for trunk and 5.x Paul On 22 July 2015 at 18:24, mikael at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64986 > > --- Comment #12 from Mikael Morin --- > (In reply to Dominique d'Humieres from comment #6) >> The test has been introduced at revision r220482, > > That revision adds interesting comments: > >> /* For a function with a class array result, save the result as >> a temporary, set the info fields needed by the scalarizer and >> call the finalization function of the temporary. Note that the >> nullification of allocatable components needed by the result >> is done in gfc_trans_assignment_1. */ > > and in gfc_trans_assignment_1, there is: > >> /* Nullify the allocatable components corresponding to those of the lhs >> derived type, so that the finalization of the function result does not >> affect the lhs of the assignment. Prepend is used to ensure that the >> nullification occurs before the call to the finalizer. > > > So, if finalization for derived types with allocatable components means freeing > the allocatable components, the above is more or less a justification for the > patch in comment #9. > > What I don't understand is why there is need for two functions > gfc_conv_procedure_call and gfc_trans_assignment_1 doing half of the job, and > why deallocation of components, deallocation of whole allocatable and > finalization are not handled all at once in a single place. > > -- > You are receiving this mail because: > You are on the CC list for the bug.