http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47425

           Summary: Array constructor with type-spec: Fails with more
                    complicated length type expr
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/397b3520a4dd1a9f#

James Van Buskirk found an example for an Array constructor with type-spec,
which fails at gimpling. Full example: See c.l.f. Short example:

subroutine sub1(L,s,e)
   implicit none
   character(*) L
   integer s,e
   if(any(L(s:e+1) == [character(len(L(s:e))+1)::'that','those'])) then
   end if
end subroutine sub1

Gives:

test.f90:5:0: error: size of variable 'A.1' is too large

Looking at the dump, one sees that the character length is strangely optimized
away into two uninitialized variables. The dump has:


sub1 (character(kind=1)[1:_l] & restrict l, integer(kind=4) & restrict s,
integer(kind=4) & restrict e, integer(kind=4) _l)
{
  bit_size_type D.1546;
  <unnamed-unsigned:64> D.1547;

  D.1546 = (bit_size_type) ((<unnamed-unsigned:64>) _l * 8);
  D.1547 = (<unnamed-unsigned:64>) (_l + -1) + 1;
  {
    static character(kind=1) A.1[2][1:MAX_EXPR <(D.1541 - D.1540) + 1, 0> + 1]
= {"that", "those"};

and only much later:

    D.1540 = *s;
    D.1541 = *e;

Reply via email to