This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran, F03] PR 41106: Procedure Pointers with CHARACTER results
On 08/20/2009 08:42 PM, Janus Weil wrote:
> Regtest is running. Ok if successful?
The patch looks OK, I think it could be checked in before fixing the
item below.
When reading the patch, I was wondering about:
/* Check character lengths if character expression. The test is only
really added if -fbounds-check is enabled. */
- if (expr1->ts.type == BT_CHARACTER && expr2->expr_type != EXPR_NULL)
+ if (expr1->ts.type == BT_CHARACTER && expr2->expr_type != EXPR_NULL
+ && !expr1->symtree->n.sym->attr.proc_pointer
+ && !gfc_is_proc_ptr_comp (expr1, NULL))
I therefore created the following test case, which should print a
run-time error message, but all I got is an ICE:
aa.f90:23:0: internal compiler error: in gfc_trans_pointer_assignment,
at fortran/trans-expr.c:4243
Assuming I have applied your patch correctly, the same error (but in
line 4244) appears also with the trunk, i.e. it is no regression.
! { dg-do run }
! { dg-options "-fcheck=all" }
implicit none
character(len=3), pointer :: ptr
procedure(f),pointer :: pptr
! Invalid & detected
!ptr => f(2)
! Fortran runtime error: Unequal character lengths (3/2)
! in pointer assignment
pptr => f ! Gives an ICE
! Invalid:
ptr => pptr(2)
! Should give same RT error
contains
function f(i)
integer,intent(in) :: i
character(len=i), pointer :: f
allocate(f)
end function f
end
Tobias