Finding a reproducer was a bit of work. (@mathomp4 submitted it to flang). Fortunately the workaround is simple.