1! { dg-do run }
2!
3! PR fortran/35983
4! C_LOC expanded to a NULL_PTR expr if called from a structure constructor
5!
6! Contributed by François-Xavier Coudert
7
8program main
9   use ISO_C_BINDING
10   implicit none
11   type, bind(C) :: descr
12      type(C_PTR) :: address
13   end type descr
14   type(descr) :: DD
15   double precision, target :: buf(1)
16   integer (C_INTPTR_T) :: i, j
17
18   buf = (/ 0 /)
19   DD = descr(c_loc(buf))
20   i = transfer (DD%address, 0_c_intptr_t)
21   j = transfer (c_loc(buf), 0_c_intptr_t)
22   if (any((/ i,j /) == 0_c_intptr_t)) call abort
23   if (i /= j) call abort
24end program main
25