Bug 36167 - ICE in gfc_conv_descriptor_dimension, at fortran/trans-array.c:242
Summary: ICE in gfc_conv_descriptor_dimension, at fortran/trans-array.c:242
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Daniel Kraft
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2008-05-07 09:30 UTC by Frank Muldoon
Modified: 2008-09-08 13:54 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.1.2 4.2.1 4.3.0 4.4.0
Last reconfirmed: 2008-09-08 08:28:09


Attachments
Very small code example (857 bytes, text/plain)
2008-05-07 09:32 UTC, Frank Muldoon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Muldoon 2008-05-07 09:30:52 UTC
![root@localhost temp]# gfortran -c  -O0 gfortran-error-1.f90
!gfortran-error-1.f90: In function \u2018write_out_particles\u2019:
!gfortran-error-1.f90:21: internal compiler error: in gfc_conv_descriptor_dimension, at fortran/trans-array.c:242
!Please submit a full bug report,
!with preprocessed source if appropriate.
!See <http://gcc.gnu.org/bugs.html> for instructions.
![root@localhost temp]# gfortran --version
!GNU Fortran (GCC) 4.4.0 20080302 (experimental) [trunk revision 132813]
!Copyright (C) 2007 Free Software Foundation, Inc.

!GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
!You may redistribute copies of GNU Fortran
!under the terms of the GNU General Public License.
!For more information about these matters, see the file named COPYING

![root@localhost temp]# uname -a
!Linux localhost.localdomain 2.6.23.12-52.fc7 #1 SMP Tue Dec 18 21:18:02 EST 2007 i686 i686 i386 GNU/Linux
![root@localhost temp]# rpm -q glibc
!glibc-2.6-4
Comment 1 Frank Muldoon 2008-05-07 09:32:13 UTC
Created attachment 15589 [details]
Very small code example
Comment 2 Paul Thomas 2008-05-17 16:20:19 UTC
(In reply to comment #1)
> Created an attachment (id=15589) [edit]
> Very small code example
> 
Frank,

The problem arises because of the declaration of 'u' in 'overlap_1. gfortran declares automatic arrays to be array types in TREE-SSA.  For some reason, the interface code in the function code is barfing when it tries to set the dimensions of the result.  The interface is assuming that there is a descriptor available for 'u' and this generates the ICE.  I will investigate because it is legal code.  In the mean time, a workaround is to declare 'u' as assumed shape, thusly:

real, intent(in), dimension(:,:,:) :: u

This forces the array to be represented as descriptor type and does not lose anything from your code.  It also is a bit easier on the eye:)

Thanks for the report.

Paul
Comment 3 Paul Thomas 2008-05-18 21:02:07 UTC
Frank,

I am downgrading this to 'normal' severity - 'major' is reserved for fairly cataclysmic bugs for the whole of gcc.  'ice-on-valid-code' will catch the attention of gfortran developers.

I'll try to come back to it when I have sorted the allocatable component memory leaks.

Thanks

Paul
Comment 4 Frank Muldoon 2008-05-20 20:40:11 UTC
Subject: Re:  ICE in gfc_conv_descriptor_dimension, at
	fortran/trans-array.c:242

Hi Paul,

Thanks for the work-around.  I now have got my code built using
gfortran.

Frank



On Sat, 2008-05-17 at 16:20 +0000, pault at gcc dot gnu dot org wrote:
> 
> ------- Comment #2 from pault at gcc dot gnu dot org  2008-05-17 16:20 -------
> (In reply to comment #1)
> > Created an attachment (id=15589)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15589&action=view) [edit]
> > Very small code example
> > 
> Frank,
> 
> The problem arises because of the declaration of 'u' in 'overlap_1. gfortran
> declares automatic arrays to be array types in TREE-SSA.  For some reason, the
> interface code in the function code is barfing when it tries to set the
> dimensions of the result.  The interface is assuming that there is a descriptor
> available for 'u' and this generates the ICE.  I will investigate because it is
> legal code.  In the mean time, a workaround is to declare 'u' as assumed shape,
> thusly:
> 
> real, intent(in), dimension(:,:,:) :: u
> 
> This forces the array to be represented as descriptor type and does not lose
> anything from your code.  It also is a bit easier on the eye:)
> 
> Thanks for the report.
> 
> Paul
> 
> 
Comment 5 Daniel Kraft 2008-09-08 08:28:09 UTC
Dominique reported that my pending patch for PR 37199 fixes this problem, too, and a test confirms this for me.  Reading the commets, it seems quite plausible to me that the ICE here is caused because of the missing array spec after interface mapping.

After checking in my patch, I will try to fully understand what the problem here is and if it is really fixed with my patch.
Comment 6 Daniel Kraft 2008-09-08 13:52:49 UTC
Subject: Bug 36167

Author: domob
Date: Mon Sep  8 13:51:26 2008
New Revision: 140107

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140107
Log:
2008-09-08  Daniel Kraft  <d@domob.eu>

        PR fortran/36167
        * gfortran.dg/array_function_3.f90: New test.
        * gfortran.dg/save_3.f90: Added cleanup-modules directive.
        * gfortran.dg/string_compare_1.f90: Ditto.

Added:
    trunk/gcc/testsuite/gfortran.dg/array_function_3.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/save_3.f90
    trunk/gcc/testsuite/gfortran.dg/string_compare_2.f90

Comment 7 Daniel Kraft 2008-09-08 13:54:57 UTC
This was apparently really fixed by my patch for PR 37199, I committed the test-case attached to trunk.  Marking fixed.