Bug 41258 - [4.4/4.5 Regression] internal compiler error: in find_typebound_proc_uop, at fortran/symbol.c:4575
Summary: [4.4/4.5 Regression] internal compiler error: in find_typebound_proc_uop, at ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P5 normal
Target Milestone: 4.4.2
Assignee: Paul Thomas
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2009-09-04 10:41 UTC by Joost VandeVondele
Modified: 2009-09-06 16:16 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.4
Known to fail: 4.4.2 4.5.0
Last reconfirmed:


Attachments
Fix for the PR (549 bytes, patch)
2009-09-05 11:36 UTC, Paul Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2009-09-04 10:41:35 UTC
Fun testcase:

gfortran -c bug.f90
f951: internal compiler error: in find_typebound_proc_uop, at fortran/symbol.c:4575
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

> cat bug.f90
TYPE qs_scf_env_type
   TYPE(preconditioner_p_type), DIMENSION(:), POINTER :: ot_preconditioner
END TYPE qs_scf_env_type
    TYPE(qs_scf_env_type), POINTER           :: scf_env
              CALL destroy_preconditioner(scf_env%ot_preconditioner(i)%preconditioner,error=error)
Comment 1 Joost VandeVondele 2009-09-04 13:11:48 UTC
'reduced' testcase

> cat test.f90
TYPE a
  TYPE(b), DIMENSION(:), POINTER :: c
END TYPE
TYPE(a), POINTER :: d
CALL X(d%c%e)
Comment 2 Tobias Burnus 2009-09-04 14:30:34 UTC
That's a regression with regards to 4.3. There one get's the following error message. (I think the error messages would be clearer if they were reversed.)

ahjf.f90:5.12:

CALL X(d%c%e)
            1
Error: Derived type 'b' at (1) is being used before it is defined
ahjf.f90:2.37:

  TYPE(b), DIMENSION(:), POINTER :: c
                                     1
Error: The pointer component 'c' of 'a' at (1) is a type that has not been declared
Comment 3 Paul Thomas 2009-09-05 11:36:22 UTC
Created attachment 18504 [details]
Fix for the PR

As soon as it has finished regtesting, I will commit as 'obvious'.

Paul
Comment 4 Paul Thomas 2009-09-05 14:21:11 UTC
Subject: Bug 41258

Author: pault
Date: Sat Sep  5 14:20:51 2009
New Revision: 151451

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151451
Log:
2009-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41258
	* primary.c (gfc_match_varspec): Do not look for typebound
	procedures unless the derived type has a f2k_derived namespace.

2009-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41258
	* gfortran.dg/typebound_proc_12.f90 : New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_proc_12.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/primary.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Paul Thomas 2009-09-05 14:25:57 UTC
Subject: Bug 41258

Author: pault
Date: Sat Sep  5 14:25:39 2009
New Revision: 151452

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151452
Log:
2009-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41258
	* primary.c (gfc_match_varspec): Do not look for typebound
	procedures unless the derived type has a f2k_derived namespace.

2009-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/41258
	* gfortran.dg/typebound_proc_12.f90 : New test.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/typebound_proc_12.f90
Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/primary.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 6 Paul Thomas 2009-09-05 14:31:48 UTC
Fixed on trunk and 4.4.

Joost, many thanks for the report.

Paul
Comment 7 Daniel Kraft 2009-09-06 16:16:41 UTC
Thanks for fixing this, I guess this was my fault (without looking further)...  I was away over the weekend, but should be able to do some hacking again now ;)