https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69423
--- Comment #6 from vehre at gcc dot gnu.org --- What I have learnt so far: When the gimple optimisation algorithm 'remove_unused_locals ()' in gcc/tree-ssa-live.c is done, it has removed the temporary for the _gfortran_transfer_character_write's string length. In the previous analysis step this (ssa-)temporary has the uid 3471 in my current fortran. That var occurs in two basicblocks (bb), once in <bb 5> of ssa, where it is only used to check whether a preallocated incoming string has the correct length. That whole bb can be eliminated, because it is unreachable which can be deduced from the propagated attributes. But in the <bb 11> it must not be eliminated as well. Because in both bbs the uid of the temporary is the same, I tried several ways to prevent this association (adding a further temporary using gfc_evaluate_now (), copying the tree using copy_node ()), but to no avail yet. Having said this my assumption is, that at both occurrences of .__result_4 the exactly same tree is used (and not a separate copy in each place). Maybe this is the issue, but I am still investigating. Just thought to let you know whether anything of this rings a bell.