Bug 41656 - [OOP] Unresolved GENERIC
Summary: [OOP] Unresolved GENERIC
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Paul Thomas
Depends on:
Reported: 2009-10-10 12:52 UTC by Salvatore Filippone
Modified: 2016-11-16 12:15 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:

test case (933 bytes, text/plain)
2009-10-10 12:53 UTC, Salvatore Filippone
Provisional fix for this PR (1.98 KB, patch)
2009-10-11 16:05 UTC, Paul Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Salvatore Filippone 2009-10-10 12:52:18 UTC
The attached code produces the following error message. 
[sfilippo@localhost bug5]$ gfortran -v 
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/gnu45 --enable-languages=c
,c++,fortran : (reconfigured) ../gcc/configure --prefix=/usr/local/gnu45 --enabl
Thread model: posix
gcc version 4.5.0 20091010 (experimental) (GCC) 
[sfilippo@localhost bug5]$ gfortran -c test-der5.f03

    call a%a%scal(d,info)
Error: Found no matching specific binding for the call to the GENERIC 'scal' at 

    call a%a%scal(d,info)
Error: Found no matching specific binding for the call to the GENERIC 'scal' at 

The code is cut from a larger application library in which the same symptoms show up multiple times. 
The library compiles and executes fine with NAG 5.2
Comment 1 Salvatore Filippone 2009-10-10 12:53:03 UTC
Created attachment 18772 [details]
test case
Comment 2 Paul Thomas 2009-10-11 16:05:51 UTC
Created attachment 18783 [details]
Provisional fix for this PR

Hi Salvatore,

You might like to exercise this patch.  It seems to work correctly but I would be interested to know how it works when used in anger.

I am unable to commit anything for the next few days and I wish to fix PR41648 at the same time, since it suffers the same problem.  Therefore, posting the patch, testcases and so on is a few days away.


Comment 3 Salvatore Filippone 2009-10-11 18:19:19 UTC
(In reply to comment #2)
Hi Paul,
Seems to work as advertised, in that it takes out the errors it's supposed to cure. 
On  my  full application I now get this:

      allocate(altmp, source=mold,stat=info) 
Error: Using SOURCE= with a class variable at (1) not supported yet
psb_s_mat_mod.f03: In function ‘s_sizeof’:
psb_s_mat_mod.f03:152:0: error: case labels not sorted: 
case 1: is greater than case 1: but comes before it.
psb_s_mat_mod.f03:152:0: internal compiler error: verify_flow_info failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The SOURCE= error is clear enough, but the other is interesting, because it happens in one of the cases that gave rise to PR 41648, line 152 is the end of this function
  function s_sizeof(a) result(res)
    implicit none 
    class(psb_s_sparse_mat), intent(in) :: a
    integer(psb_long_int_k_) :: res
    res = 0
    if (allocated(a%a)) then 
      res = a%a%sizeof()
    end if
  end function s_sizeof

Since you say you want to take them both.... 
do you need access to the full source code?


Comment 4 Salvatore Filippone 2009-10-12 13:44:44 UTC
(In reply to comment #3)
> (In reply to comment #2)
The latest patch from Janus cures the SOURCE= problem. 
Unfortunately a simple extension of test-der5.f03 does not show the ICE; back to the cutting board (to find a trimmed-down test case...)

Comment 5 Salvatore Filippone 2009-10-13 09:06:59 UTC
(In reply to comment #4)
The recent combined patch by Paul makes my compilation progress; however a little later I get an ICE here: 

#0  0x000000349887efa0 in strcmp () from /lib64/libc.so.6
#1  0x000000000050ffdd in gfc_find_symtree (st=0x128e7d0, name=0x0) at ../../gcc
#2  0x00000000004dd749 in load_derived_extensions () at ../../gcc/gcc/fortran/mo
#3  read_module () at ../../gcc/gcc/fortran/module.c:4450
#4  0x00000000004de834 in gfc_use_module () at ../../gcc/gcc/fortran/module.c:36
#5  0x00000000004e2ca5 in accept_statement (st=<value optimized out>) at ../../g
#6  0x00007fffffffd710 in ?? ()
#7  0x00000000004e572e in parse_spec (st=<value optimized out>) at ../../gcc/gcc
#8  0x00007fffffffd82c in ?? ()
#9  0x0000000000000000 in ?? ()

If this is related to this patch, it needs some more work. Otherwise, I'll cut the test case and open a new PR

Comment 6 Paul Thomas 2009-10-16 06:07:24 UTC
Subject: Bug 41656

Author: pault
Date: Fri Oct 16 06:07:09 2009
New Revision: 152890

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152890
2009-10-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41648
	PR fortran/41656
	* trans-expr.c (select_class_proc): Convert the expression for the
	vindex, carried on the first member of the esym list.
	* gfortran.h : Add the vindex field to the esym_list structure.
	and eliminate the class_object field.
	* resolve.c (check_class_members): Remove the setting of the
	class_object field.
	(vindex_expr): New function.
	(get_class_from_expr): New function.
	(resolve_class_compcall): Call the above to find the ultimate
	class or derived component.  If derived, do not generate the
	esym list.  Add and expression for the vindex to the esym list
	by calling the above.
	(resolve_class_typebound_call): The same.

2009-10-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41648
	* gfortran.dg/dynamic_dispatch_4.f03 : New test.

	PR fortran/41656
	* gfortran.dg/dynamic_dispatch_5.f03 : New test.


Comment 7 Paul Thomas 2009-10-16 06:09:42 UTC
Fixed on trunk.

Thanks for the patch.