As part of the continuing crusade to get tonto compiled:

character(10), dimension (2) :: inp
inp = "abcdefghij"
inp = join_1(inp)
print *, inp
contains
function join_1(self) result(res)
character(len=*), dimension(:) :: self
character(len=len(self)), dimension(:), pointer :: res
allocate (res(2))
res = self
end function
end

produces

test2.f90: In function ‘join_1’:
test2.f90:1: internal compiler error: in gfc_trans_deferred_array, at
fortran/trans-array.c:4394

If I override the ICE by returning and finishing the block, I get the most
peculiar code:

join_1 (__result, .__result, self, _self)
{
int4 ..__result;
int4 ubound.0;
int4 stride.1;
int4 offset.2;
int4 size.3;
char[0:D.939][1:_self] * self.0;
bit_size_type D.934;
<unnamed type> D.935;
bit_size_type D.937;
<unnamed type> D.938;
int4 D.939;
bit_size_type D.940;
<unnamed type> D.941;

{
int4 D.936;

D.936 = self->dim[0].stride;
stride.1 = D.936 == 0 ? 1 : D.936;
self.0 = (char[0:D.939][1:_self] *) (char[0:][1:_self] *) self->data;
ubound.0 = self->dim[0].ubound - self->dim[0].lbound + 1;
size.3 = stride.1 * NON_LVALUE_EXPR <ubound.0>;
offset.2 = -stride.1;
D.937 = (bit_size_type) (<unnamed type>) _self * 8;
D.938 = (<unnamed type>) _self;
D.939 = size.3 - 1;
D.940 = (bit_size_type) (<unnamed type>) _self * (bit_size_type) (<unnamed
type>) size.3 * 8;
D.941 = (<unnamed type>) _self * (<unnamed type>) size.3;
}
..__result = _self;
D.934 = (bit_size_type) (<unnamed type>) ..__result * 8;
D.935 = (<unnamed type>) ..__result;
}

Paul


-- 
           Summary: Automatic charlen pointer array result produces and ICE
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pault at gcc dot gnu dot org


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

Reply via email to