Bug 52143 - [OOP] ICE with polymorphic function result in gfc_class_vptr_get
Summary: [OOP] ICE with polymorphic function result in gfc_class_vptr_get
Status: RESOLVED DUPLICATE of bug 57535
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
Depends on:
Reported: 2012-02-06 21:34 UTC by Tobias Burnus
Modified: 2016-11-16 15:33 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2012-10-12 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2012-02-06 21:34:07 UTC
Found when creating a test case for PR 51514.

The following code causes an

test.f90:8:0: internal compiler error: tree check: expected record_type or union_type or qual_union_type, have function_type in gfc_class_vptr_get, at fortran/trans-expr.c:78

which is at

  vptr = gfc_advance_chain (TYPE_FIELDS (TREE_TYPE (decl)),


#0  gfc_class_vptr_get (decl=0x2aaaacce2600)
    at trans-expr.c:78
#1  0x00000000005d3f0d in gfc_vtable_field_get (decl=<optimized out>, field=1)
    at trans-expr.c:91
#2  0x00000000005b1fa5 in build_class_array_ref (index=0x2aaaacbc3c90,
                              base=0x2aaaacced2a8, se=<optimized out>)
    at trans-array.c:2984
#3  gfc_conv_scalarized_array_ref (se=0x7fffffffce20, ar=<optimized out>)
    at trans-array.c:3037
#4  0x00000000005b2852 in gfc_conv_array_ref (se=0x7fffffffce20, ar=0x174a888,
                              sym=<optimized out>, where=<optimized out>)
    at trans-array.c:3112
#5  0x00000000005db098 in gfc_conv_variable (se=0x7fffffffce20, expr=0x174a620)
    at trans-expr.c:1333
#6  0x00000000005da874 in gfc_conv_expr_reference (se=0x7fffffffce20,
                                                   expr=<optimized out>)
    at trans-expr.c:5610
#7  0x00000000005de0b0 in gfc_conv_procedure_call (se=0x7fffffffcff0,
          sym=0x173e1f0, args=0x1746b50, expr=0x174aa10, append_args=0x0)
    at trans-expr.c:3540
#8  0x00000000006020c5 in gfc_trans_call (code=0x174af90,
         dependency_check=<optimized out>, mask=0x0, count1=0x0, invert=false)
    at trans-stmt.c:468

module mod_subpr
  type :: foo
    integer :: i = 2
  end type
  function g ()
    class(foo), allocatable :: g(:)
    allocate (g(3)) 
  end function g
end module
Comment 1 janus 2012-10-12 11:40:49 UTC
Note: It works when making g a scalar.
Comment 2 Dominique d'Humieres 2013-06-11 15:36:54 UTC
It looks like a duplicate of pr57535.
Comment 3 Dominique d'Humieres 2013-06-11 17:42:13 UTC
The test compiles at revision 199960. Marking as duplicate of pr57535.

*** This bug has been marked as a duplicate of bug 57535 ***