* [Patch, Fortran, OOP] PR 47601: Internal Error: mio_component_ref(): Component not found
@ 2011-05-29 16:52 Janus Weil
2011-05-29 18:42 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Janus Weil @ 2011-05-29 16:52 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
Hi all,
here is a fix for a problem, where the module loading could not handle
components of extended types. Regtested on x86_64-unknown-linux-gnu.
Ok for trunk?
Cheers,
Janus
2011-05-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/47601
* module.c (mio_component_ref): Handle components of extended types.
* symbol.c (gfc_find_component): Return is sym is NULL.
2011-05-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/47601
* gfortran.dg/extends_13.f03: New.
[-- Attachment #2: pr47601.diff --]
[-- Type: text/x-diff, Size: 1161 bytes --]
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (revision 174380)
+++ gcc/fortran/module.c (working copy)
@@ -2356,14 +2356,10 @@ mio_component_ref (gfc_component **cp, gfc_symbol
if (sym->components != NULL && p->u.pointer == NULL)
{
/* Symbol already loaded, so search by name. */
- for (q = sym->components; q; q = q->next)
- if (strcmp (q->name, name) == 0)
- break;
+ q = gfc_find_component (sym, name, true, true);
- if (q == NULL)
- gfc_internal_error ("mio_component_ref(): Component not found");
-
- associate_integer_pointer (p, q);
+ if (q)
+ associate_integer_pointer (p, q);
}
/* Make sure this symbol will eventually be loaded. */
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 174380)
+++ gcc/fortran/symbol.c (working copy)
@@ -1996,7 +1996,7 @@ gfc_find_component (gfc_symbol *sym, const char *n
{
gfc_component *p;
- if (name == NULL)
+ if (name == NULL || sym == NULL)
return NULL;
sym = gfc_use_derived (sym);
[-- Attachment #3: extends_13.f03 --]
[-- Type: application/octet-stream, Size: 697 bytes --]
! { dg-do compile }
!
! PR 47601: [OOP] Internal Error: mio_component_ref(): Component not found
!
! Contributed by Rich Townsend <townsend@astro.wisc.edu>
module type_definitions
implicit none
type :: matching
integer :: n = -999
end type
type, extends(matching) :: ellipse
end type
end module type_definitions
module elliptical_elements
implicit none
contains
function line(e) result(a2n)
use type_definitions
type(ellipse), intent(in) :: e
complex, dimension(e%N) :: a2n ! <- change "e%N" to "10"
end function line
end module
use type_definitions
use elliptical_elements
end
! { dg-final { cleanup-modules "type_definitions elliptical_elements" } }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, Fortran, OOP] PR 47601: Internal Error: mio_component_ref(): Component not found
2011-05-29 16:52 [Patch, Fortran, OOP] PR 47601: Internal Error: mio_component_ref(): Component not found Janus Weil
@ 2011-05-29 18:42 ` Steve Kargl
2011-05-30 7:16 ` Janus Weil
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2011-05-29 18:42 UTC (permalink / raw)
To: Janus Weil; +Cc: gfortran, gcc-patches
On Sun, May 29, 2011 at 03:08:48PM +0200, Janus Weil wrote:
>
> here is a fix for a problem, where the module loading could not handle
> components of extended types. Regtested on x86_64-unknown-linux-gnu.
> Ok for trunk?
>
> 2011-05-29 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/47601
> * module.c (mio_component_ref): Handle components of extended types.
> * symbol.c (gfc_find_component): Return is sym is NULL.
>
> 2011-05-29 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/47601
> * gfortran.dg/extends_13.f03: New.
OK.
--
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, Fortran, OOP] PR 47601: Internal Error: mio_component_ref(): Component not found
2011-05-29 18:42 ` Steve Kargl
@ 2011-05-30 7:16 ` Janus Weil
0 siblings, 0 replies; 3+ messages in thread
From: Janus Weil @ 2011-05-30 7:16 UTC (permalink / raw)
To: Steve Kargl; +Cc: gfortran, gcc-patches
>> Ok for trunk?
>>
>> 2011-05-29 Janus Weil <janus@gcc.gnu.org>
>>
>> PR fortran/47601
>> * module.c (mio_component_ref): Handle components of extended types.
>> * symbol.c (gfc_find_component): Return is sym is NULL.
>>
>> 2011-05-29 Janus Weil <janus@gcc.gnu.org>
>>
>> PR fortran/47601
>> * gfortran.dg/extends_13.f03: New.
>
> OK.
Thanks, Steve. Committed as r174416.
Cheers,
Janus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-29 20:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-29 16:52 [Patch, Fortran, OOP] PR 47601: Internal Error: mio_component_ref(): Component not found Janus Weil
2011-05-29 18:42 ` Steve Kargl
2011-05-30 7:16 ` Janus Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).