Bug 101652 - Audit uses of general purpose matching routine gfc_match with code %v
Summary: Audit uses of general purpose matching routine gfc_match with code %v
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-27 21:07 UTC by anlauf
Modified: 2021-07-27 21:07 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description anlauf 2021-07-27 21:07:42 UTC
The purpose of this PR is a reminder of the discussion during the review
of patches for pr101564, see

https://gcc.gnu.org/pipermail/fortran/2021-July/056273.html

and related mails.


E.g. Fortran 2018 has:

9.2 Variable

R902 variable  is designator
               or function-reference

C901 (R902) designator shall not be a constant or a subobject of a constant.
C902 (R902) function-reference shall have a data pointer result.

A variable is either the data object denoted by designator or the target of the pointer resulting from the evaluation of function-reference; this pointer shall
be associated.
...


The current implementation of gfc_match invokes gfc_match_variable when it
encounters the code %v, which does not handle function-references.

One possible solution is to audit the code and to replace uses of %v by %e
and subsequently check using gfc_check_vardef_context.