re PR fortran/60302 (ICE with c_f_pointer and android cross compiler)

2014-02-21  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/60302
	* check.c (gfc_check_c_f_pointer): Only clear 'size' if 'gfc_array_size'
	is successful.


2014-02-21  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/60302
	* gfortran.dg/c_f_pointer_shape_tests_6.f90: New.

From-SVN: r208033
This commit is contained in:
Janus Weil 2014-02-21 23:54:50 +01:00
parent d723358d01
commit f1ed9e151e
4 changed files with 33 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2014-02-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/60302
* check.c (gfc_check_c_f_pointer): Only clear 'size' if 'gfc_array_size'
is successful.
2014-02-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/60234

View File

@ -3944,16 +3944,17 @@ gfc_check_c_f_pointer (gfc_expr *cptr, gfc_expr *fptr, gfc_expr *shape)
if (shape)
{
mpz_t size;
if (gfc_array_size (shape, &size)
&& mpz_cmp_ui (size, fptr->rank) != 0)
if (gfc_array_size (shape, &size))
{
if (mpz_cmp_ui (size, fptr->rank) != 0)
{
mpz_clear (size);
gfc_error ("SHAPE argument at %L to C_F_POINTER must have the same "
"size as the RANK of FPTR", &shape->where);
return false;
}
mpz_clear (size);
gfc_error ("SHAPE argument at %L to C_F_POINTER must have the same "
"size as the RANK of FPTR", &shape->where);
return false;
}
mpz_clear (size);
}
if (fptr->ts.type == BT_CLASS)

View File

@ -1,3 +1,8 @@
2014-02-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/60302
* gfortran.dg/c_f_pointer_shape_tests_6.f90: New.
2014-02-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gcc.dg/vmx/vsums.c: Check entire result vector.

View File

@ -0,0 +1,14 @@
! { dg-do compile }
!
! PR 60302: [4.9 Regression] ICE with c_f_pointer and android cross compiler
!
! Contributed by Valery Weber <valeryweber@hotmail.com>
subroutine reshape_inplace_c2_c2 (new_shape)
use, intrinsic :: iso_c_binding
implicit none
integer :: new_shape(:)
complex, pointer :: ptr_x(:)
type(c_ptr) :: loc_x
call c_f_pointer (loc_x, ptr_x, new_shape)
end subroutine