Commit 9995ce07 by Tobias Burnus Committed by Tobias Burnus

Fortran] PR 92872 – Fix get_CFI_desc

        PR fortran/92872
        * trans-array.c (get_CFI_desc): Fix cond whether saved desc exists.

        PR fortran/92872
        * gfortran.dg/bind_c_optional-1.f90: New.

From-SVN: r279160
parent c175aa77
2019-12-10 Tobias Burnus <tobias@codesourcery.com>
PR fortran/92872
* trans-array.c (get_CFI_desc): Fix cond whether saved desc exists.
2019-12-09 David Malcolm <dmalcolm@redhat.com> 2019-12-09 David Malcolm <dmalcolm@redhat.com>
* error.c (gfc_diagnostic_starter): Add pp_newline call before * error.c (gfc_diagnostic_starter): Add pp_newline call before
......
...@@ -882,7 +882,7 @@ get_CFI_desc (gfc_symbol *sym, gfc_expr *expr, ...@@ -882,7 +882,7 @@ get_CFI_desc (gfc_symbol *sym, gfc_expr *expr,
else else
tmp = sym->backend_decl; tmp = sym->backend_decl;
if (tmp && DECL_LANG_SPECIFIC (tmp)) if (tmp && DECL_LANG_SPECIFIC (tmp) && GFC_DECL_SAVED_DESCRIPTOR (tmp))
tmp = GFC_DECL_SAVED_DESCRIPTOR (tmp); tmp = GFC_DECL_SAVED_DESCRIPTOR (tmp);
*desc = tmp; *desc = tmp;
......
2019-12-10 Tobias Burnus <tobias@codesourcery.com>
PR fortran/92872
* gfortran.dg/bind_c_optional-1.f90: New.
2019-12-10 Richard Sandiford <richard.sandiford@arm.com> 2019-12-10 Richard Sandiford <richard.sandiford@arm.com>
* gcc.dg/lto/tag-1_0.c, gcc.dg/lto/tag-1_1.c: New test. * gcc.dg/lto/tag-1_0.c, gcc.dg/lto/tag-1_1.c: New test.
......
! { dg-do run }
!
! PR fortran/92872
!
! Contributed by G. Steinmetz
!
module m
contains
subroutine s(x) bind(c)
integer, allocatable, optional :: x(:)
x = [1, 2, 3]
end
end
use m
integer, allocatable :: y(:)
! NOTE: starting at 0, otherwise it will fail due to PR 92189
allocate(y(0:2))
y = [9, 8, 7]
call s(y)
if (any (y /= [1, 2, 3])) stop 1
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment