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] |
Could somebody review this please? Thanks Paul ---------- Forwarded message ---------- From: Paul Richard Thomas <paul.richard.thomas@gmail.com> Date: 6 September 2015 at 18:40 Subject: Re: [Patch, fortran] PR40054 and PR63921 - Implement pointer function assignment - redux To: Dominique Dhumieres <dominiq@lps.ens.fr>, "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org> It helps to attach the patch :-) Paul On 6 September 2015 at 13:42, Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote: > Dear All, > > The attached patch more or less implements the assignment of > expressions to the result of a pointer function. To wit: > > my_ptr_fcn (arg1, arg2...) = expr > > arg1 would usually be the target, pointed to by the function. The > patch parses these statements and resolves them into: > > temp_ptr => my_ptr_fcn (arg1, arg2...) > temp_ptr = expr > > I say more or less implemented because I have ducked one of the > headaches here. At the end of the specification block, there is an > ambiguity between statement functions and pointer function > assignments. I do not even try to resolve this ambiguity and require > that there be at least one other type of executable statement before > these beasts. This can undoubtedly be fixed but the effort seems to me > to be unwarranted at the present time. > > This version of the patch extends the coverage of allowed rvalues to > any legal expression. Also, all the problems with error.c have been > dealt with by Manuel's patch. > > I am grateful to Dominique for reminding me of PR40054 and pointing > out PR63921. After a remark of his on #gfortran, I fixed the checking > of the standard to pick up all the offending lines with F2003 and > earlier. > > > Bootstraps and regtests on FC21/x86_64 - OK for trunk? > > Cheers > > Paul > > 2015-09-06 Paul Thomas <pault@gcc.gnu.org> > > PR fortran/40054 > PR fortran/63921 > * decl.c (get_proc_name): Return if statement function is > found. > * match.c (gfc_match_ptr_fcn_assign): New function. > * match.h : Add prototype for gfc_match_ptr_fcn_assign. > * parse.c : Add static flag 'in_specification_block'. > (decode_statement): If in specification block match a statement > function, otherwise if standard embraces F2008 try to match a > pointer function assignment. > (parse_interface): Set 'in_specification_block' on exiting from > parse_spec. > (parse_spec): Set and then reset 'in_specification_block'. > (gfc_parse_file): Set 'in_specification_block'. > * resolve.c (get_temp_from_expr): Extend to include other > expressions than variables and constants as rvalues. > (resolve_ptr_fcn_assign): New function. > (gfc_resolve_code): Call resolve_ptr_fcn_assign. > * symbol.c (gfc_add_procedure): Add a sentence to the error to > flag up the ambiguity between a statement function and pointer > function assignment at the end of the specification block. > > 2015-09-06 Paul Thomas <pault@gcc.gnu.org> > > PR fortran/40054 > PR fortran/63921 > * gfortran.dg/fmt_tab_1.f90: Change from run to compile and set > standard as legacy. > * gfortran.dg/ptr_func_assign_1.f08: New test. > * gfortran.dg/ptr_func_assign_2.f08: New test. -- Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. Groucho Marx -- Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. Groucho Marx
Attachment:
submit_2.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |