This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/64921] [4.9/5/6 Regression] FAIL: gfortran.dg/class_allocate_18.f90
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Jul 2015 18:45:41 +0000
- Subject: [Bug fortran/64921] [4.9/5/6 Regression] FAIL: gfortran.dg/class_allocate_18.f90
- Auto-submitted: auto-generated
- References: <bug-64921-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64921
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #20 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #19)
> So the question is whether the frontend emits the correct test against zero:
>
> offset = offset * byte_stride;
> D.3466 = (void *) array->data;
> D.3467 = D.3466;
> D.3465 = 8;
> D.3469 = 8;
> __builtin_memcpy ((void *) &transfer.4, (void *)
> &D.3467, (unsigned long) MAX_EXPR <MIN_EXPR <D.3469, D.3465>, 0>);
> ptr2 = (struct t4 *) (transfer.4 + offset);
> if (ptr2 != 0B)
> {
> {
> integer(kind=4) stat.5;
>
> if (ptr2->k == 0B)
>
> to me it looks like if we really want to test transfer.4 (array->data)
> against
> zero.
transfer.4 + offset calculates the address of an element of an array.
I believe that if that code is executed, array.data is non-zero, and of course
array.data + offset as well.
I think the the test should check for ptr2%j's nullness before deallocating
ptr2%j, instead of testing ptr2.
With a patch like this:
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 218973d..1ff7437 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -967,7 +967,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived,
gfc_component *comp,
cond->block->expr1->ts.kind = gfc_default_logical_kind;
cond->block->expr1->value.function.isym = gfc_intrinsic_function_by_id
(GFC_ISYM_ASSOCIATED);
cond->block->expr1->value.function.actual = gfc_get_actual_arglist ();
- cond->block->expr1->value.function.actual->expr = gfc_copy_expr (expr);
+ cond->block->expr1->value.function.actual->expr = gfc_copy_expr (e);
cond->block->expr1->value.function.actual->next = gfc_get_actual_arglist
();
cond->block->next = dealloc;
Unfortunately, it doesn't seem to fix the problem.