User account creation filtered due to spam.

Bug 21881 - ICE instead of error for large arrays in derived types
Summary: ICE instead of error for large arrays in derived types
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on: 37577
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-02 15:43 UTC by Thomas Koenig
Modified: 2011-11-09 06:57 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-12-16 19:38:41


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2005-06-02 15:43:36 UTC
Currently, there are 26 bits for encoding the size
of an object in the array descriptor for 32-bit
targets, because the size is encoded together with
the type, which takes up 6 bits, and dtype is an
index_type (which has 32 bits on a 32-bit target).

It would be nice to have a separate size field.
Comment 1 Tobias Schlüter 2005-06-05 09:59:44 UTC
So an array of the derived type couldn't have more than 2**(32-26) = 64 entries
before overflowing memory with our current scheme, and if this was enlarged the
allowed arrays would be even smaller, but it is certainly true that the sizes of
derived type array elements are limited.
Comment 2 Francois-Xavier Coudert 2006-10-21 17:39:26 UTC
Thomas, isn't the 4.3 branching a good time to work on this? Would you have time for that?
Comment 3 Francois-Xavier Coudert 2007-01-05 14:12:25 UTC
ping: Would you have either an example where this limit is encountered? Wouldn't 4.3 be ideal for that work?
Comment 4 Francois-Xavier Coudert 2007-09-14 11:31:14 UTC
I think this is related to the check in trans-types.c:

  if (size && INTEGER_CST_P (size))
    {
      if (tree_int_cst_lt (gfc_max_array_element_size, size))
        internal_error ("Array element size too big");

      i += TREE_INT_CST_LOW (size) << GFC_DTYPE_SIZE_SHIFT;
    }
  dtype = build_int_cst (gfc_array_index_type, i);

which is triggered by code such as:

  type t
    integer i001(268435456)
  end type t

  type(t), allocatable :: x(:)

  allocate(x(1))
  print *, size(x)
  print *, shape(x)
  end
Comment 5 Francois-Xavier Coudert 2007-09-21 19:56:35 UTC
For now, we should simply change the ICE into a standard error.
Comment 6 Thomas Koenig 2007-12-16 19:38:41 UTC
I'll do this.
Comment 7 Thomas Koenig 2007-12-17 22:20:37 UTC
Changing this into a normal error leads to double
errors and assorted strangeness.

Unassigning myself for now.
Comment 8 Daniel Franke 2010-05-08 20:04:02 UTC
I expect, the array descriptor reform may make this fixable?!
Comment 9 Francois-Xavier Coudert 2011-11-09 06:57:15 UTC
Author: fxcoudert
Date: Wed Nov  9 06:57:10 2011
New Revision: 181192

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181192
Log:
	PR fortran/21881
	* trans-types.c (gfc_get_dtype): Issue a fatal error instead of
	an internal error.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-types.c
Comment 10 Francois-Xavier Coudert 2011-11-09 06:57:55 UTC
Fixed on trunk.