User account creation filtered due to spam.

Bug 42684 - [4.5 Regression] ICE when interface operator(xx) available through host and use assoc in module procedure
Summary: [4.5 Regression] ICE when interface operator(xx) available through host and u...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P4 normal
Target Milestone: 4.5.0
Assignee: Jerry DeLisle
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2010-01-10 23:19 UTC by Ian Harvey
Modified: 2010-01-15 02:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-01-14 03:07:06


Attachments
Example source that causes the ICE (294 bytes, text/plain)
2010-01-10 23:21 UTC, Ian Harvey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Harvey 2010-01-10 23:19:19 UTC
An internal compiler error (seg fault in gfc_get_default_type (symbol.c:226) - due argument 'name' being passed in as a null ptr) occurs when two different specific procedures for an operator (ie defining the same operator, but on different derived types) are available, when one is available through host association and the other though use association, in a module procedure (where the USE is at the module procedure level, and not in the specification part of the module

This is from compiling the trunk with svn rev 155795.
Comment 1 Ian Harvey 2010-01-10 23:21:46 UTC
Created attachment 19532 [details]
Example source that causes the ICE
Comment 2 Ian Harvey 2010-01-11 01:56:29 UTC
Some primitive debugging: As directed by parse_contained, parsing and subsequent processing of the use statement in other_proc (parse_progunit) occurs prior to parsing of the add_b function and hence determination of the characteristics of the add_b symbol.  This use statement processing includes ambiguous interface checking (gfc_compare_interfaces), which doesn't deal with the case when the symbol associated with argument s2 is of unknown type (BT_UNKNOWN) and no name is provided for type resolution.

A source code workaround is to move the USE statement to the specification part of the module or to reorder the module procedures such that add_b occurs before other_proc.

The internal error is also generated if the module procedure name given in the INTERFACE OPERATOR block doesn't exist as a module procedure.
Comment 3 Jerry DeLisle 2010-01-11 02:54:36 UTC
This patch appears to avoid the problem. I have not looked farther up the call chain yet to see where passing the NULL in name2 should be avoided completely for the test case.

Index: interface.c
===================================================================
--- interface.c	(revision 155799)
+++ interface.c	(working copy)
@@ -955,6 +955,9 @@
 {
   gfc_formal_arglist *f1, *f2;
 
+  if (name2 == NULL)
+    return 0;
+
   if (s1->attr.function && (s2->attr.subroutine
       || (!s2->attr.function && s2->ts.type == BT_UNKNOWN
 	  && gfc_get_default_type (name2, s2->ns)->type == BT_UNKNOWN)))
Comment 4 Dominique d'Humieres 2010-01-11 08:50:17 UTC
Looks similar to pr42677. The patch in comment#3 fixes these PRs, but misses also really(?) ambiguous interfaces, see:

gcc/testsuite/gfortran.dg/defined_operators_1.f90
gcc/testsuite/gfortran.dg/generic_7.f90
gcc/testsuite/gfortran.dg/interface_5.f90
gcc/testsuite/gfortran.dg/interface_6.f90
gcc/testsuite/gfortran.dg/interface_7.f90
gcc/testsuite/gfortran.dg/operator_5.f90
gcc/testsuite/gfortran.dg/proc_ptr_comp_20.f90
Comment 5 Jerry DeLisle 2010-01-13 03:13:52 UTC
The problem is here.  Wrong argument passed to gfc_compare_interfaces.

It can't be NULL.  I am testing this patch.

Index: interface.c
===================================================================
--- interface.c	(revision 155799)
+++ interface.c	(working copy)
@@ -1126,7 +1126,7 @@
 	if (p->sym->name == q->sym->name && p->sym->module == q->sym->module)
 	  continue;
 
-	if (gfc_compare_interfaces (p->sym, q->sym, NULL, generic_flag, 0,
+	if (gfc_compare_interfaces (p->sym, q->sym, q->sym->name, generic_flag, 0,
 				    NULL, 0))
 	  {
 	    if (referenced)
Comment 6 Jerry DeLisle 2010-01-13 04:23:32 UTC
Regression testing with the following patch passes.  I used p->sym->name instead of q->sym->name in place of NULL, but I do not think it matters.

Index: interface.c
===================================================================
--- interface.c	(revision 155799)
+++ interface.c	(working copy)
@@ -1126,7 +1126,7 @@
 	if (p->sym->name == q->sym->name && p->sym->module == q->sym->module)
 	  continue;
 
-	if (gfc_compare_interfaces (p->sym, q->sym, NULL, generic_flag, 0,
+	if (gfc_compare_interfaces (p->sym, q->sym, p->sym->name, generic_flag, 0,
 				    NULL, 0))
 	  {
 	    if (referenced)

and allows operator.f90 to compile as well as the test case in PR42680.

I think this does it.  I will submit to list for approval.
Comment 7 Jerry DeLisle 2010-01-13 04:24:19 UTC
*** Bug 42680 has been marked as a duplicate of this bug. ***
Comment 8 Jerry DeLisle 2010-01-14 03:07:06 UTC
Patch submitted for approval.
Comment 9 Jerry DeLisle 2010-01-15 01:47:57 UTC
Subject: Bug 42684

Author: jvdelisle
Date: Fri Jan 15 01:47:43 2010
New Revision: 155930

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155930
Log:
2010-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/42684
	* interface.c (check_interface1): Pass symbol name rather than NULL to
	gfc_compare_interfaces.	(gfc_compare_interfaces): Add assert to
	trap MULL.
	* resolve.c (check_generic_tbp_ambiguity): Pass symbol name rather
	than NULL to gfc_compare_interfaces.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/resolve.c

Comment 10 Jerry DeLisle 2010-01-15 02:06:39 UTC
Subject: Bug 42684

Author: jvdelisle
Date: Fri Jan 15 02:06:23 2010
New Revision: 155931

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155931
Log:
2010-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/42684
	* gfortran.dg/interface_31.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/interface_31.f90
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 11 Jerry DeLisle 2010-01-15 02:07:05 UTC
Fixed.
Comment 12 hjl@gcc.gnu.org 2010-02-07 04:44:31 UTC
Subject: Bug 42684

Author: hjl
Date: Sun Feb  7 04:41:22 2010
New Revision: 156562

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156562
Log:
Backport testcases from mainline to 4.4.

2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2010-02-05  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42915
	* g++.dg/other/crash-9.C: New test.

	2010-02-03  Jason Merrill  <jason@redhat.com>

	PR c++/40138
	* g++.dg/ext/builtin11.C: New.

	2010-02-03  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42944
	* gcc.dg/errno-1.c: New testcase.

	2010-02-03  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42927
	* gcc.c-torture/compile/pr42927.c: New testcase.

	2010-01-29  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42758
	PR c++/42634
	PR c++/42336
	PR c++/42797
	PR c++/42880
	* g++.dg/other/crash-5.C: New test.
	* g++.dg/other/crash-7.C: New test.
	* g++.dg/other/crash-8.C: New test.

	2010-01-28  Uros Bizjak  <ubizjak@gmail.com>

	PR target/42891
	* gcc.target/i386/pr42891.c: New test.

	2010-01-28  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42883
	* g++.dg/torture/pr42883.C: New testcase.

	2010-01-28  Michael Matz  <matz@suse.de>

	* gcc.target/i386/pr42881.c: New test.

	2010-01-28  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42713
	PR c++/42820
	* g++.dg/template/typedef27.C: New test case.
	* g++.dg/template/typedef28.C: New test case.

	2010-01-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/42874
	* gcc.dg/vla-22.c: New test.

	2010-01-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42250
	* gcc.dg/pr42250.c: New testcase.

	2010-01-25  Tobias Burnus  <burnus@net-b.de>

	PR fortran/42858
	* gfortran.dg/generic_21.f90: New test.

	2010-01-21  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42585
	* gcc.dg/tree-ssa/pr42585.c: New test.

	2010-01-20  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/42715
	* gcc.dg/pr42715.c: New.

	2010-01-20  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42717
	* gcc.c-torture/compile/pr42717.c: New testcase.

	2010-01-19  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/42783
	* gfortran.dg/bounds_check_15.f90 : New test.

	2010-01-18  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42766
	* g++.dg/conversion/op6.C: New test.

	2010-01-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42781
	* gfortran.fortran-torture/compile/pr42781.f90: New testcase.

	2010-01-17  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42248
	* gcc.c-torture/execute/pr42248.c: New testcase.

	2010-01-17  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42677
	* gfortran.dg/interface_assignment_5.f90: New test.

	2010-01-15  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42739
	* g++.dg/torture/pr42739.C: New testcase.

	2010-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/42684
	* gfortran.dg/interface_31.f90: New test.

	2010-01-14  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42706
	* gcc.dg/ipa/pr42706.c: New testcase.

	2010-01-14  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42714
	* g++.dg/torture/pr42714.C: New test.

	2010-01-14  Alexander Monakov  <amonakov@ispras.ru>

	PR rtl-optimization/42388
	* gcc.dg/pr42388.c: New.

	2010-01-14  Alexander Monakov <amonakov@ispras.ru>

	PR rtl-optimization/42294
	* gfortran.dg/pr42294.f: New.

	2010-01-14  Ira Rosen  <irar@il.ibm.com>

	PR tree-optimization/42709
	* gcc.dg/vect/pr42709.c: New test.

	2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42730
	* gcc.c-torture/compile/pr42730.c: New testcase.

	2010-01-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42704
	* g++.dg/torture/pr42704.C: New test.

	2010-01-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42703
	* gcc.c-torture/compile/pr42703.c: New test.

	2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42705
	* gcc.c-torture/compile/pr42705.c: New testcase.

	2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42716
	* gcc.c-torture/compile/pr42716.c: New testcase.

	2010-01-12  Joseph Myers  <joseph@codesourcery.com>

	PR c/42708
	* gcc.c-torture/compile/pr42708-1.c: New test.

	2010-01-09  Alexandre Oliva  <aoliva@redhat.com>

	PR middle-end/42363
	* gcc.dg/torture/pr42363.c: New.

	2010-01-09  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/42604
	PR debug/42395
	* gcc.dg/vect/pr42604.c: New.
	* gcc.dg/vect/pr42395.c: New.

	2010-01-09  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42512
	* gcc.c-torture/execute/pr42512.c: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/conversion/op6.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/conversion/op6.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/builtin11.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/ext/builtin11.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-5.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-5.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-7.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-7.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-8.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-8.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-9.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-9.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef27.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/template/typedef27.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef28.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/template/typedef28.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42704.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42704.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42714.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42714.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42739.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42739.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42883.C
      - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42883.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42703.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42703.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42705.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42705.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42716.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42716.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42717.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42717.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42730.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42730.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42927.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42927.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42248.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/execute/pr42248.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42512.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/execute/pr42512.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/errno-1.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/errno-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/ipa/pr42706.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/ipa/pr42706.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42250.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42250.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42388.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42388.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42715.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42715.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr42363.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/torture/pr42363.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42395.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42395.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42604.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42604.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42709.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42709.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vla-22.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vla-22.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42881.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.target/i386/pr42881.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42891.c
      - copied unchanged from r156561, trunk/gcc/testsuite/gcc.target/i386/pr42891.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/bounds_check_15.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/bounds_check_15.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/generic_21.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/generic_21.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/interface_31.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/interface_31.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr42294.f
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/pr42294.f
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr42781.f90
      - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.fortran-torture/compile/pr42781.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog