https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66528
--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Much better with a test case, of course.
program main
read (*,*) n
if (n<0) then
print *,foo
end
print *,bar
end program main
