[Patch, fortran] PR43945 - [OOP] Derived type with GENERIC: resolved to the wrong specific TBP

Tobias Burnus burnus@net-b.de
Mon May 17 21:32:00 GMT 2010


Paul Richard Thomas wrote:
>> I don't see that. [...]
>>     
> I just reloaded the patch on a clean tree with the same result.  It
> looks like it ought to be a simple problem but I am blowed if I can
> see what it is.  I'll have another peek tomorrow.
>   

I can reproduce both: Regtesting does not show anything but using
valgrind I see the following - which regards

  if (class_ref)
    {
      gfc_free_ref_list (class_ref->next);  // <<< this is line 5484

Using a recent trunk build without the patch works, i.e. valgrind shows
no such error. The crucial line seems to be:
    call a%a%scal(d,info)
and it even shows the valgrind error when one has commented out the TBP
block of "type :: s_sparse_mat".

It is interesting if one follows "class_ref" in
resolve_typebound_subroutine. Before
  resolve_typebound_call (code, &name);
it is still "type = REF_COMPONENT" but afterwards it is type = 2893287512.

==16987== Invalid read of size 8
==16987==    at 0x5298FA: resolve_code (resolve.c:5484)
==16987==    by 0x52B3F2: resolve_codes (resolve.c:12792)
==16987==    by 0x52B2FF: resolve_codes (resolve.c:12778)
==16987==    by 0x51EBF4: gfc_resolve (resolve.c:12819)
==16987==    by 0x5135D7: gfc_parse_file (parse.c:4292)
==16987==    by 0x548D97: gfc_be_parse_file (f95-lang.c:239)
==16987==    by 0x835996: toplev_main (toplev.c:1049)
==16987==    by 0x6560B7C: (below main) (in /lib64/libc-2.11.1.so)
==16987==  Address 0x7220d60 is 368 bytes inside a block of size 376 free'd
==16987==    at 0x4C25F7B: free (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16987==    by 0x4D5C5E: gfc_free_ref_list (expr.c:582)
==16987==    by 0x522C97: resolve_typebound_static (resolve.c:5118)
==16987==    by 0x5262DF: resolve_typebound_call (resolve.c:5287)
==16987==    by 0x5298CA: resolve_code (resolve.c:5475)
==16987==    by 0x52B3F2: resolve_codes (resolve.c:12792)
==16987==    by 0x52B2FF: resolve_codes (resolve.c:12778)
==16987==    by 0x51EBF4: gfc_resolve (resolve.c:12819)
==16987==    by 0x5135D7: gfc_parse_file (parse.c:4292)
==16987==    by 0x548D97: gfc_be_parse_file (f95-lang.c:239)
==16987==    by 0x835996: toplev_main (toplev.c:1049)
==16987==    by 0x6560B7C: (below main) (in /lib64/libc-2.11.1.so)

Tobias



More information about the Fortran mailing list