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

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #8)
> diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
> index fece3ab..0b96de1 100644
> --- a/gcc/fortran/trans-array.c
> +++ b/gcc/fortran/trans-array.c
> @@ -7079,7 +7077,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
>           {
>             tmp = gfc_conv_array_lbound (desc, n);
>             tmp = fold_build2_loc (input_location, MINUS_EXPR,
> -                                  TREE_TYPE (base), tmp, loop.from[dim]);
> +                                  TREE_TYPE (base), tmp, from);
>             tmp = fold_build2_loc (input_location, MULT_EXPR,
>                                    TREE_TYPE (base), tmp,
>                                    gfc_conv_array_stride (desc, n));

Unfortunately, this does not appear to fix the bug (at least not completely).
I still get an invalid free.

Reply via email to