* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
@ 2011-11-09 13:23 ` burnus at gcc dot gnu.org
2011-11-09 13:52 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-09 13:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51052
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
CC| |burnus at gcc dot gnu.org,
| |janus at gcc dot gnu.org
Summary|Internal compiler error in |[OOP] Internal compiler
|gfc_conv_component |error in gfc_conv_component
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-09 13:03:56 UTC ---
I can confirm the ICE - I get the same with 4.6 and 4.7.
Note, however, that with GCC 4.7 one has to fix the following coding problem
before one can enjoy the internal error:
particles.f90:102.17:
procedure, pass(particle) &
1
Error: Argument mismatch for the overriding procedure 'new_position' at (1):
INTENT mismatch in argument 'particle'
The issue seems to occur for:
position = position + deltt * velocity + &
random_displacement
in subroutine position_oil_particle if particles.f90.
The ICE is in gfc_conv_component_ref for:
if (DECL_FIELD_CONTEXT (field) != TREE_TYPE (decl))
{
tree f2 = c->norestrict_decl;
if (!f2 || DECL_FIELD_CONTEXT (f2) != TREE_TYPE (decl))
for (f2 = TYPE_FIELDS (TREE_TYPE (decl)); f2; f2 = DECL_CHAIN (f2))
and fails for "TYPE_FIELDS (TREE_TYPE (decl))" with: "internal compiler error:
tree check: expected record_type or union_type or qual_union_type, have
function_type in gfc_conv_component_ref, at fortran/trans-expr.c:556"
This is called by gfc_conv_variable, which is called by get_proc_ptr_comp. The
expression looks as follow
"position%__class_points2d3d_Point2d_p%__vtype_points2d3d_Point2d%__class_points2d3d_Point2d_a%__vtype_points2d3d_Point2d"
At least that's what I get when printing expr->symtree->n.sym->name and
expr->ref{,->next,->next->next,...}->u.c.sym->name.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
2011-11-09 13:23 ` [Bug fortran/51052] [OOP] " burnus at gcc dot gnu.org
@ 2011-11-09 13:52 ` janus at gcc dot gnu.org
2011-11-09 14:08 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-09 13:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51052
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-11-09
Ever Confirmed|0 |1
--- Comment #2 from janus at gcc dot gnu.org 2011-11-09 13:45:12 UTC ---
Here is an very much reduced (and corrected) test case. This is another case of
"non-trivial polymorphic operands", cf. PR46262 and PR46328.
Arjen, why do you need those workarounds for 4.6?
module points2d3d
implicit none
type point2d
real :: x, y
contains
procedure :: add_vector_2d
procedure :: assign_2d
generic :: operator(+) => add_vector_2d
generic :: assignment(=) => assign_2d
end type
contains
subroutine assign_2d( point1, point2 )
class(point2d), intent(inout) :: point1
class(point2d), intent(in) :: point2
point1%x = point2%x
point1%y = point2%y
end subroutine
function add_vector_2d( point, vector )
class(point2d), intent(in) :: point, vector
class(point2d), allocatable :: add_vector_2d
! Workaround for gfortran 4.6
if ( allocated( add_vector_2d ) ) then
deallocate( add_vector_2d )
endif
allocate( add_vector_2d )
add_vector_2d%x = point%x + vector%x
add_vector_2d%y = point%y + vector%y
end function
end module points2d3d
use points2d3d
implicit none
contains
subroutine position_oil_particle()
class(point2d), pointer :: position
type(point2d) :: p1, p2
position = position + p1 + p2
end subroutine
end
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
2011-11-09 13:23 ` [Bug fortran/51052] [OOP] " burnus at gcc dot gnu.org
2011-11-09 13:52 ` janus at gcc dot gnu.org
@ 2011-11-09 14:08 ` janus at gcc dot gnu.org
2011-11-09 15:34 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-09 14:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51052
--- Comment #5 from janus at gcc dot gnu.org 2011-11-09 13:56:39 UTC ---
(In reply to comment #3)
> that may be from an older version of 4.6 (I now have 4.6.2,
> previously 4.6.1). When running a program that used that
> module, I got error messages about trying to allocate and
> already allocated array.
ah, I guess that was PR50225 (which was fixed only in 4.7, so 4.6.2 probably
does not help here).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
` (2 preceding siblings ...)
2011-11-09 14:08 ` janus at gcc dot gnu.org
@ 2011-11-09 15:34 ` janus at gcc dot gnu.org
2012-01-02 12:49 ` pault at gcc dot gnu.org
2012-01-02 13:00 ` pault at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-09 15:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51052
--- Comment #7 from janus at gcc dot gnu.org 2011-11-09 15:20:55 UTC ---
(In reply to comment #6)
> yes, that is the one :). I am really examining the borders of
> gfortran at the moment.
Right. Thanks for your continued bug reporting. That sort of user feedback
helps us a lot.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
` (3 preceding siblings ...)
2011-11-09 15:34 ` janus at gcc dot gnu.org
@ 2012-01-02 12:49 ` pault at gcc dot gnu.org
2012-01-02 13:00 ` pault at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu.org @ 2012-01-02 12:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51052
--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> 2012-01-02 12:46:16 UTC ---
Author: pault
Date: Mon Jan 2 12:46:08 2012
New Revision: 182796
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182796
Log:
2012-01-02 Paul Thomas <pault@gcc.gnu.org>
PR fortran/51529
* trans-array.c (gfc_array_allocate): Null allocated memory of
newly allocted class arrays.
PR fortran/46262
PR fortran/46328
PR fortran/51052
* interface.c(build_compcall_for_operator): Add a type to the
expression.
* trans-expr.c (conv_base_obj_fcn_val): New function.
(gfc_conv_procedure_call): Use base_expr to detect non-variable
base objects and, ensuring that there is a temporary variable,
build up the typebound call using conv_base_obj_fcn_val.
(gfc_trans_class_assign): Pick out class procedure pointer
assignments and do the assignment with no further prcessing.
(gfc_trans_class_array_init_assign, gfc_trans_class_init_assign
gfc_trans_class_assign): Move to top of file.
* gfortran.h : Add 'base_expr' field to gfc_expr.
* resolve.c (get_declared_from_expr): Add 'types' argument to
switch checking of derived types on or off.
(resolve_typebound_generic_call): Set the new argument.
(resolve_typebound_function, resolve_typebound_subroutine):
Set 'types' argument for get_declared_from_expr appropriately.
Identify base expression, if not a variable, in the argument
list of class valued calls. Assign it to the 'base_expr' field
of the final expression. Strip away all references after the
last class reference.
2012-01-02 Paul Thomas <pault@gcc.gnu.org>
PR fortran/46262
PR fortran/46328
PR fortran/51052
* gfortran.dg/typebound_operator_7.f03: New.
* gfortran.dg/typebound_operator_8.f03: New.
Added:
trunk/gcc/testsuite/gfortran.dg/typebound_operator_7.f03
trunk/gcc/testsuite/gfortran.dg/typebound_operator_8.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/dump-parse-tree.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
` (4 preceding siblings ...)
2012-01-02 12:49 ` pault at gcc dot gnu.org
@ 2012-01-02 13:00 ` pault at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu.org @ 2012-01-02 13:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51052
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |pault at gcc dot gnu.org
Resolution| |FIXED
--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> 2012-01-02 13:00:36 UTC ---
Fixed on trunk.
Thanks for the report
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread