https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81978

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Last reconfirmed|2017-09-16 00:00:00         |2022-10-17
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Several observations:

The dummy argument 'names' of match_word has no specified INTENT, so gfortran
treats it as INTENT(INOUT), does a copy-in/copy-out, and it might be that the
copy-out to non-writable pp causes the crash.  Adding INTENT(IN) solves (or
works around) the issue.

Making the actual argument a temporary also helps, e.g. replacing

  call match_word(pp%name)

by

  call match_word((pp%name))

or

  call match_word([pp%name])

If one actually declares 'names' with INTENT(INOUT), an error is reported
(correctly).

As a lot of legacy code does not specify INTENT in similar cases, and NAG
and Intel do generate a temporary here, we should do this, too.

Reply via email to