This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/84523] [8 Regression] Runtime crash deallocating allocatable array within derived type


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84523

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
The if statement is generating the code:

                struct array01_t_spot D.3815;

                if ((real(kind=4)[0:] * restrict) ((struct t_spot *)
(rc->spots.data + (sizetype) ((rc->spots.offset + SAVE_EXPR <(integer(kind=8))
k> * rc->spots.dim[0].stride) * D.3815.span)))->vm.data != 0B)

You will see that D.3815's span is being used but is never set.

This temporary is being generated at trans-array.c:3664. It should produce an
assignment of the array descriptor to the temporary, as well as the
declaration.

Somewhere, the se->pre is not being retained so that the assignment disappears.

I am onto it.

Paul

PS
Index: gcc/fortran/trans.c
===================================================================
*** gcc/fortran/trans.c (revision 257937)
--- gcc/fortran/trans.c (working copy)
*************** get_array_span (tree type, tree decl)
*** 358,364 ****
        {
          if (TREE_CODE (decl) == PARM_DECL)
            decl = build_fold_indirect_ref_loc (input_location, decl);
!         span = gfc_conv_descriptor_span_get (decl);
        }
        else
        span = NULL_TREE;
--- 358,365 ----
        {
          if (TREE_CODE (decl) == PARM_DECL)
            decl = build_fold_indirect_ref_loc (input_location, decl);
!         span = TYPE_SIZE_UNIT (gfc_get_element_type (TREE_TYPE (decl)));
!         span = fold_convert (gfc_array_index_type, span);
        }
        else
        span = NULL_TREE;

fixes this bug but produces a number of regressions.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]