[Bug fortran/87142] Aliasing issue with overloaded assignment and allocatable components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87142 Bug 87142 depends on bug 110618, which changed state. Bug 110618 Summary: Dependency between arguments when one is allocatable array whose dummy is intent(out) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110618 What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED
[Bug fortran/87142] Aliasing issue with overloaded assignment and allocatable components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87142 --- Comment #4 from martin --- With yesterdays master branch, I still see an invalid read with valgrind and an "AddressSanitizer: heap-use-after-free"-error with -fsanitize=address. So looks like this has not been fixed by the patch for PR 92178.
[Bug fortran/87142] Aliasing issue with overloaded assignment and allocatable components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87142 kargl at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P4 CC||kargl at gcc dot gnu.org Depends on||92178 --- Comment #3 from kargl at gcc dot gnu.org --- Seems that this is fixed by the patch for PR 92178 Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92178 [Bug 92178] Segmentation fault after passing allocatable array as intent(out) and its element as value into the same subroutine
[Bug fortran/87142] Aliasing issue with overloaded assignment and allocatable components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87142 janus at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-09-05 CC||janus at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from janus at gcc dot gnu.org --- (In reply to martin from comment #1) > The important part is the "enclosed in parentheses". ... which means that the rhs is an expression that needs to be evaluated before entering the assignment function. So, this bug should probably be fixed by using a temporary for the rhs.
[Bug fortran/87142] Aliasing issue with overloaded assignment and allocatable components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87142 --- Comment #1 from martin --- The relevant passage from the standard is: F2008, 12.4.3.4.3 (Defined assignments) says: "A defined assignment is treated as a reference to the subroutine, with the left-hand side as the first argument and the right-hand side enclosed in parentheses as the second argument." The important part is the "enclosed in parentheses". Please note that in most circumstances, the problem can only be seen in valgrind. I have not been able to write a testcase, which consistently fails in a simply visible manner. It all depends on the inner workings of the malloc routines, whether the code works or segfaults or produces wrong results (usually with control characters in the result).