This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, Fortran] PR fortran/77584 Re: Unclassifiable statement error with procedure pointer using template named "structure_"


On Wed, Sep 14, 2016 at 10:37:15AM -0400, Fritz Reese wrote:
> 
> The attached patch fixes PR 77584. The match code in
> gfc_match_decl_typespec for STRUCTURE/RECORD was a bit greedy and
> ambiguous.
> 
> For RECORD, the matcher was too broad in its matching and would catch
> anything starting with 'record'. I made the code more robust here so
> that it looks for 'record /' specifically, and keeps the helpful
> warnings for bad record declarations if -fdec-structure is enabled.
> 
> For STRUCTURE, the matchers were equally too broad and captured
> anything starting with 'structure'. Unfortunately we can't easily
> disambiguate it by capturing 'structure /%n/' because a structure
> declaration-type-spec might be an anonymous nested structure
> declaration, and these have no name ('/%n/'). However a
> declaration-type-spec is only valid for structures within other
> structures anyway (nested and anonymous structures) - otherwise we
> would be in gfc_match_structure_decl directly through decode_statement
> in parse.c. So instead of returning MATCH_ERROR when we see
> 'structure' and are not nested inside a structure, we make sure we are
> nested in a structure first and pass silently if not.
> 
> Patched compiler passes tests on x86_64-redhat-linux. With no
> complaints I will commit to trunk in the coming days.
> 
> ---
> Fritz Reese
> 
> 2016-09-14  Fritz Reese  <fritzoreese@gmail.com>
> 
>         PR fortran/77584
> 
>         * gcc/fortran/decl.c (match_record_decl, gfc_match_decl_type_spec):
>         Fixes to handling of structure/record from declaration-type-spec.
>         * gcc/testsuite/gfortran.dg/dec_structure_15.f90: New testcase.

Patch looks ok to me.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]