Re: [Patch, fortran] Clean up of error recovery in DTIO procedures
Dear Rainer and Dominique, Committed as obvious in revision 240493. Thanks for doing the testing. Cheers Paul 2016-09-26 Paul ThomasPR fortran/48298 * interface.c (gfc_find_specific_dtio_proc) : Return NULL if the derived type is broken, as indicated by a flavor other than FL_DERIVED. On 26 September 2016 at 10:26, Paul Richard Thomas wrote: > Dear Rainer, > > Thanks to you and Dominique for the confirmation that the patch works. I > will commit it sometime today. > > Regards > > Paul > > > On 26 Sep 2016 10:23 a.m., "Rainer Orth" > wrote: > > Hi Paul, > >> Dominique has informed me that the earlier patch did not fix this problem. > > indeed, it just shifted the SEGV to a different place. > >> Although I still cannot reproduce the problem on FC21, I think that I >> can see what the problem is. The declared type of 'chairman' is >> thoroughly broken when it arrives at >> interface.c(gfc_find_specific_dtio_proc). It doesn't even have the >> right name! The key signature is that its flavor is FL_UNKNOWN. The >> attached prevents the code coming anywhere near the call that causes >> the segfault and regtests OK. > > I've now managed to run a sparc-sun-solaris2.10 bootstrap with the patch > included and the failures are gone indeed. > > Thanks. > Rainer > > -- > - > Rainer Orth, Center for Biotechnology, Bielefeld University > > -- The difference between genius and stupidity is; genius has its limits. Albert Einstein
Re: [Patch, fortran] Clean up of error recovery in DTIO procedures
Dear Rainer, Thanks for the report. I'll have a stab at finding the problem tomorrow. In the interim, could you try applying: Index: /svn/trunk/gcc/fortran/interface.c === *** /svn/trunk/gcc/fortran/interface.c(revision 240349) --- /svn/trunk/gcc/fortran/interface.c(working copy) *** gfc_find_specific_dtio_proc (gfc_symbol *** 4793,4798 --- 4793,4801 gfc_typebound_proc *tb_io_proc, *specific_proc; bool t = false; + if (derived == NULL) + return NULL; + /* Try to find a typebound DTIO binding. */ if (formatted == true) { Cheers Paul On 23 September 2016 at 14:08, Rainer Orthwrote: > Hi Paul, > >> Dear All, >> >> Please find attached a patch to clean up the various issues with >> errors in DTIO procedures. The tests were all provided by Gerhard >> Steinmetz for which thanks are due. >> >> I intend to commit this patch as 'obvious' tomorrow morning unless >> there are any objections in the meantime. >> >> Bootstrapped and regtested on x86_64/FC21 - OK for trunk? >> >> Paul >> >> 2016-09-21 Paul Thomas >> >> * interface.c (check_dtio_interface1): Introduce errors for >> alternate returns and incorrect numbers of arguments. >> (gfc_find_specific_dtio_proc): Return cleanly if the derived >> type either doesn't exist or has no namespace. >> >> 2016-09-21 Paul Thomas >> >> * gfortran.dg/dtio_13.f90: New test. > > This test ICEs on Solaris (both sparc and x86, 32 and 64-bit): > > FAIL: gfortran.dg/dtio_13.f90 -O (test for errors, line 141) > FAIL: gfortran.dg/dtio_13.f90 -O (internal compiler error) > FAIL: gfortran.dg/dtio_13.f90 -O (test for excess errors) > > Excess errors: > f951: internal compiler error: Segmentation Fault > 0x8e165ec crash_signal > /vol/gcc/src/hg/trunk/local/gcc/toplev.c:337 > 0x89357b8 gfc_find_symtree(gfc_symtree*, char const*) > /vol/gcc/src/hg/trunk/local/gcc/fortran/symbol.c:2737 > 0x8895b77 find_typebound_proc_uop > /vol/gcc/src/hg/trunk/local/gcc/fortran/class.c:2753 > 0x88c2a60 gfc_find_specific_dtio_proc(gfc_symbol*, bool, bool) > /vol/gcc/src/hg/trunk/local/gcc/fortran/interface.c:4825 > 0x89166cb resolve_transfer > /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:8738 > 0x89166cb gfc_resolve_code(gfc_code*, gfc_namespace*) > /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:10874 > 0x8914e9c gfc_resolve_blocks(gfc_code*, gfc_namespace*) > /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:9616 > 0x89152e8 gfc_resolve_code(gfc_code*, gfc_namespace*) > /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:10557 > 0x89178d1 resolve_codes > /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:15721 > 0x89179b1 gfc_resolve(gfc_namespace*) > 0x89179b1 gfc_resolve(gfc_namespace*) > /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:15756 > 0x8902909 resolve_all_program_units > /vol/gcc/src/hg/trunk/local/gcc/fortran/parse.c:5875 > 0x8902909 gfc_parse_file() > /vol/gcc/src/hg/trunk/local/gcc/fortran/parse.c:6127 > 0x8944d30 gfc_be_parse_file > /vol/gcc/src/hg/trunk/local/gcc/fortran/f95-lang.c:198 > > The failure can be reproduced with > > $ f951 gfortran.dg/dtio_13.f90 -quiet -o dtio_13.s > > In gdb, I find > > Thread 2 received signal SIGSEGV, Segmentation fault. > [Switching to Thread 1 (LWP 1)] > 0x089357b8 in gfc_find_symtree (st=0x1, > name=0x83726a6 "_dtio_unformatted_read") > at /vol/gcc/src/hg/trunk/local/gcc/fortran/symbol.c:2737 > 2737 c = strcmp (name, st->name); > (gdb) p name > $1 = 0x83726a6 "_dtio_unformatted_read" > (gdb) p st->name > Cannot access memory at address 0xd > > Rainer > > -- > - > Rainer Orth, Center for Biotechnology, Bielefeld University -- The difference between genius and stupidity is; genius has its limits. Albert Einstein
Re: [Patch, fortran] Clean up of error recovery in DTIO procedures
Hi Paul, > Dear All, > > Please find attached a patch to clean up the various issues with > errors in DTIO procedures. The tests were all provided by Gerhard > Steinmetz for which thanks are due. > > I intend to commit this patch as 'obvious' tomorrow morning unless > there are any objections in the meantime. > > Bootstrapped and regtested on x86_64/FC21 - OK for trunk? > > Paul > > 2016-09-21 Paul Thomas> > * interface.c (check_dtio_interface1): Introduce errors for > alternate returns and incorrect numbers of arguments. > (gfc_find_specific_dtio_proc): Return cleanly if the derived > type either doesn't exist or has no namespace. > > 2016-09-21 Paul Thomas > > * gfortran.dg/dtio_13.f90: New test. This test ICEs on Solaris (both sparc and x86, 32 and 64-bit): FAIL: gfortran.dg/dtio_13.f90 -O (test for errors, line 141) FAIL: gfortran.dg/dtio_13.f90 -O (internal compiler error) FAIL: gfortran.dg/dtio_13.f90 -O (test for excess errors) Excess errors: f951: internal compiler error: Segmentation Fault 0x8e165ec crash_signal /vol/gcc/src/hg/trunk/local/gcc/toplev.c:337 0x89357b8 gfc_find_symtree(gfc_symtree*, char const*) /vol/gcc/src/hg/trunk/local/gcc/fortran/symbol.c:2737 0x8895b77 find_typebound_proc_uop /vol/gcc/src/hg/trunk/local/gcc/fortran/class.c:2753 0x88c2a60 gfc_find_specific_dtio_proc(gfc_symbol*, bool, bool) /vol/gcc/src/hg/trunk/local/gcc/fortran/interface.c:4825 0x89166cb resolve_transfer /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:8738 0x89166cb gfc_resolve_code(gfc_code*, gfc_namespace*) /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:10874 0x8914e9c gfc_resolve_blocks(gfc_code*, gfc_namespace*) /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:9616 0x89152e8 gfc_resolve_code(gfc_code*, gfc_namespace*) /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:10557 0x89178d1 resolve_codes /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:15721 0x89179b1 gfc_resolve(gfc_namespace*) 0x89179b1 gfc_resolve(gfc_namespace*) /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:15756 0x8902909 resolve_all_program_units /vol/gcc/src/hg/trunk/local/gcc/fortran/parse.c:5875 0x8902909 gfc_parse_file() /vol/gcc/src/hg/trunk/local/gcc/fortran/parse.c:6127 0x8944d30 gfc_be_parse_file /vol/gcc/src/hg/trunk/local/gcc/fortran/f95-lang.c:198 The failure can be reproduced with $ f951 gfortran.dg/dtio_13.f90 -quiet -o dtio_13.s In gdb, I find Thread 2 received signal SIGSEGV, Segmentation fault. [Switching to Thread 1 (LWP 1)] 0x089357b8 in gfc_find_symtree (st=0x1, name=0x83726a6 "_dtio_unformatted_read") at /vol/gcc/src/hg/trunk/local/gcc/fortran/symbol.c:2737 2737 c = strcmp (name, st->name); (gdb) p name $1 = 0x83726a6 "_dtio_unformatted_read" (gdb) p st->name Cannot access memory at address 0xd Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [Patch, fortran] Clean up of error recovery in DTIO procedures
Committed as revision 240342. Paul On 21 September 2016 at 12:18, Paul Richard Thomaswrote: > Dear All, > > Please find attached a patch to clean up the various issues with > errors in DTIO procedures. The tests were all provided by Gerhard > Steinmetz for which thanks are due. > > I intend to commit this patch as 'obvious' tomorrow morning unless > there are any objections in the meantime. > > Bootstrapped and regtested on x86_64/FC21 - OK for trunk? > > Paul > > 2016-09-21 Paul Thomas > > * interface.c (check_dtio_interface1): Introduce errors for > alternate returns and incorrect numbers of arguments. > (gfc_find_specific_dtio_proc): Return cleanly if the derived > type either doesn't exist or has no namespace. > > 2016-09-21 Paul Thomas > > * gfortran.dg/dtio_13.f90: New test. -- The difference between genius and stupidity is; genius has its limits. Albert Einstein