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] Clean up of error recovery in DTIO procedures


Dear Rainer,

Dominique has informed me that the earlier patch did not fix this problem.

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.

Cheers

Paul

On 23 September 2016 at 19:58, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
> 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 Orth <ro@cebitec.uni-bielefeld.de> wrote:
>> 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  <pault@gcc.gnu.org>
>>>
>>>     * 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  <pault@gcc.gnu.org>
>>>
>>>     * 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



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein

Attachment: dtio_13.diff
Description: Text document


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