Dear Andre, Sorry, Mikael's patch for pr65792!
Also, your patch for PR59678 had better be applied to 5.1 and to 4.9, since bug generates such grossly wrong code. Cheers Paul On 25 April 2015 at 16:42, Paul Richard Thomas <paul.richard.tho...@gmail.com> wrote: > Dear Andre, > > The patch is OK with three changes: > (i) Put the PR line in the testsuite ChangeLog; > (ii) Put the dg-do header information in the testcase, together with > lines to say which PR it fixes and who the contributor is; and > (iii) Add the testcase for PR65841 since your patch for pr65792 breaks > this side-effect fix. > > I will turn my attention to your patch for pr65792 next and try to > figure out why (iii) is necessary. > > Thanks for the patch > > Paul > > > > On 18 April 2015 at 12:55, Andre Vehreschild <ve...@gmx.de> wrote: >> Hi all, >> >> this patch fixes a deep copy issue, when allocatable components of an entity >> were not allocated. Before the patch the deep copy was run without >> checking if the component is actually allocated and the program crashed >> because >> a null pointer was dereferenced. Furthermore, was the code to copy a >> structure >> component not checking the correct ref to determine whether a component was >> allocated, when allocatable components were nested. Example: >> >> type InnerT >> integer, allocatable :: inner_I >> end type >> type T >> type(InnerT), allocatable :: in >> end type >> >> The pseudo pseudo code generated for this was something like: >> >> subroutine copy(src,dst) >> dst = src >> if (allocated (src.in.inner_I)) // crash >> allocate (dst.in) >> end if >> >> dst.in.inner_I = src.in.inner_I // crash >> end subroutine >> >> The patch fixes this by generating: >> >> subroutine copy(src,dst) >> dst = src >> if (allocated (src.in)) >> allocate (dst.in) >> dst.in= src.in >> if (allocated (src.in.inner_I)) >> allocate (dst.in.inner_I) >> dst.in.inner_I = src.in.inner_I >> end >> end >> end subroutine >> >> Of course is this pseudo pseudo code shortened dramatically to show just the >> necessary bits. >> >> Bootstraps and regtests ok on x86_64-linux-gnu/F21. >> >> Ok, for trunk? >> >> Thanks to Dominique for identifying the pr addressed by this patch. >> >> Regards, >> Andre >> -- >> Andre Vehreschild * Email: vehre ad gmx dot de > > > > -- > Outside of a dog, a book is a man's best friend. Inside of a dog it's > too dark to read. > > Groucho Marx -- Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. Groucho Marx