Bug 45746 - [OOP] ICE in fold_convert_loc: pointer to allocatable array with select type
Summary: [OOP] ICE in fold_convert_loc: pointer to allocatable array with select type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-22 08:20 UTC by Hans-Werner Boschmann
Modified: 2016-11-16 13:39 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Werner Boschmann 2010-09-22 08:20:08 UTC
MODULE BUG_MODULE

  TYPE::A_TYPE
  END TYPE A_TYPE

  TYPE,EXTENDS(A_TYPE)::B_TYPE
     TYPE(A_TYPE),DIMENSION(:),ALLOCATABLE::A_LIST
  END TYPE B_TYPE

  TYPE::C_TYPE
     TYPE(B_TYPE),DIMENSION(:),ALLOCATABLE::B_LIST
   CONTAINS
     PROCEDURE::DO_SOMETHING
  END TYPE C_TYPE

CONTAINS

  SUBROUTINE DO_SOMETHING(DTV)
    CLASS(C_TYPE) :: DTV
    CLASS(A_TYPE),POINTER::A_POINTER
    SELECT TYPE(A_POINTER)
    TYPE IS (B_TYPE)
       DTV%B_LIST(1)=A_POINTER
    END SELECT
  END SUBROUTINE DO_SOMETHING

END MODULE BUG_MODULE

GNU Fortran (GCC) 4.6.0 20100921 (experimental)
gfortran -c BUG_MODULE.f03
BUG_MODULE.f03: In Funktion »do_something«:
BUG_MODULE.f03:23:0: interner Compiler-Fehler: in fold_convert_loc, bei fold-const.c:2021
Comment 1 Tobias Burnus 2010-09-22 08:35:47 UTC
Fails in gfc_trans_scalar_assign for the line:

      gfc_add_modify (&block, lse->expr,
                           fold_convert (TREE_TYPE (lse->expr), rse->expr));

as   switch (TREE_CODE (type)) in fold_convert reaches gcc_unreachable.

Hereby,
(gdb) p lse->expr->common.type->base->code
$1 = RECORD_TYPE
(gdb) p rse->expr->common.type->base->code
$2 = RECORD_TYPE

And both types are different, cf.
(gdb) p rse->expr->common.type
$4 = (tree) 0x2aaaad533e70
(gdb) p lse->expr->common.type
$5 = (tree) 0x2aaaad538000
Comment 2 Dominique d'Humieres 2010-09-22 08:41:37 UTC
Confirmed as a regression: no ICE for branch fortran-exp revision 158215, ICE for branch fortran-dev revision 163718.
Comment 3 janus 2010-09-30 21:01:13 UTC
I do not see the error on x86_64-unknown-linux-gnu at r164767. Can anyone confirm that?
Comment 4 Tobias Burnus 2010-10-01 05:37:29 UTC
(In reply to comment #3)
> I do not see the error on x86_64-unknown-linux-gnu at r164767. Can anyone
> confirm that?

Ditto for my 4.6.0 20100930 built also on x86_64-unknown-linux-gnu; I tried it using valgrind.
Comment 5 janus 2010-10-02 14:44:33 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > I do not see the error on x86_64-unknown-linux-gnu at r164767. Can anyone
> > confirm that?
> 
> Ditto for my 4.6.0 20100930 built also on x86_64-unknown-linux-gnu; I tried it
> using valgrind.

Ok, so I guess we can close this one (supposedly it was fixed by some middle-end patch). Hans, if you encounter the issue after all, please feel free to re-open.