This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ICE on return of derived type with allocatable-length character component


On Sun, Apr 17, 2011 at 05:05:18PM +0000, Rouson, Damian wrote:
> gfortran 4.6 give an ICE on the code below.  Should I submit a bug report
> or is this a known issue?
> 
> Damian 
> 
> 
> $ cat message.F90
> module message_module
>   type message
>     character(:) ,allocatable :: string
>   end type
> contains
>   type(message) function new_message()
>   end function
> end module
> 
> $ gfortran -c message.F90
> message.F90:6:0: internal compiler error: in gfc_get_derived_type, at
> fortran/trans-types.c:2298
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> 
> $ gfortran --version
> GNU Fortran (GCC) 4.6.0 20110312 (experimental)
> Copyright (C) 2011 Free Software Foundation, Inc.
> 
> 
> I'm in the process of updating my gcc via macports, which will hopefully
> give me the release version of gcc 4.6.  I'll repeat the test then before
> submitting a bug report. If 4.7 is available via macports, I'll test that
> version too.

It's present in both 4.6 and 4.7. Can you open a PR?
This patch to trans-type.c allows your code to compile

@@ -2323,7 +2372,7 @@ gfc_get_derived_type (gfc_symbol * deriv
         field_type = c->ts.u.derived->backend_decl;
       else
        {
-         if (c->ts.type == BT_CHARACTER)
+         if (c->ts.type == BT_CHARACTER && !c->ts.deferred)
            {
              /* Evaluate the string length.  */

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]