https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79430
--- Comment #27 from Jürgen Reuter <juergen.reuter at desy dot de> --- Well, the valgrind output actually exactly that the comparison is optimized away. I actually would have to regenerate all the debug output, but the point is that for the first appearance in the random seed chain, the code must not run into the second part of the if clause: else if (prt%child1%is_quark ()) then !!! 1: q->qg prt%type = prt%child1%type prt%child2%type = GLUON prt%child2%t = abs(prt%t) call integral_over_z_part_isr & (shower, prt,otherprt, shat, minz, maxz, integral, final) if (integral > final) then return else !!! 2: g->qqbar prt%type = GLUON prt%child2%type = -prt%child1%type prt%child2%t = abs(prt%t) call integral_over_z_part_isr & (shower, prt,otherprt, shat, minz, maxz, integral, final) end if end if so the return should be executed. We checked explicitly that the condition integral > final was fulfilled, for the value of final as calculated inside the routine integral_over_z_part_isr, but then the if clause did not correctly execute the return, and the reason seemed to be that the value of integral was not available anymore.