This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] |
:ADDPATCH fortran: At present, use associated or imported kind parameters that are referenced in a function declaration cause an error because they outrage gfc_match_init_expr. Similarly, derived types are absorbed, without error, whether valid or not. The proposed patch fixes this by looking for the above situations in decl.c, setting KIND to -1, as a flag, and bailing out. The locus at the characteristic specification is stored. This is tested after each IMPORT and USE statement and the characteristic expression matched over again. The moment that the parameter or type is either imported or use associated, the match will succeed and a viable kind value will be added to the function typespec. If the kind remains = -1 at the end of the specification block, an error is called. The first testcase encloses those of the contributors. The second detects the error condition when there is no match. Regtested on Cygwin_NT/amd64 - OK for trunk? Paul 2007-09-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/31154 PR fortran/31229 PR fortran/33334 * decl.c : Declare gfc_function_kind_locs and gfc_function_type_locus. (gfc_match_kind_spec): Add second argument kind_expr_only. Store locus before trying to match the expression. If the current state corresponds to a function declaration and there is no match to the expression, read to the parenthesis, return kind = -1, dump the expression and return. (gfc_match_type_spec): Renamed from match_type_spec and all references changed. If an interface or an external function, store the locus, set kind = -1 and return. Otherwise, if kind is already = -1, use gfc_find_symbol to try to find a use associated or imported type. match.h : Prototype for gfc_match_type_spec. * parse.c (match_deferred_characteristics): New function. (parse_spec): If in a function, statement is USE or IMPORT and the function kind=-1, call match_deferred_characteristics. If kind=-1 at the end of the specification expressions, this is an error. * parse.h : Declare external gfc_function_kind_locs and gfc_function_type_locus. 2007-09-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/31154 PR fortran/31229 PR fortran/33334 * gfortran.dg/function_kinds_1.f90: New test. * gfortran.dg/function_kinds_2.f90: New test. -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy
Attachment:
submit.diff
Description: Binary data
Attachment:
Change.Logs
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |