[Bug fortran/60302] [4.9 Regression] ICE with c_f_pointer and android cross compiler
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 21 20:09:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60302
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |burnus at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> The function 'gfc_check_c_f_pointer' was added in r197053
... and I think that's indeed the culprit. This patch fixes it:
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 207988)
+++ gcc/fortran/check.c (working copy)
@@ -3944,16 +3944,17 @@ gfc_check_c_f_pointer (gfc_expr *cptr, gfc_expr *f
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)
We should not free 'size' unless gfc_array_size is successful!
More information about the Gcc-bugs
mailing list