the component to be printed to help debugging. */
if (ts->u.derived->ts.f90_type == BT_VOID)
{
- if (!gfc_notify_std (GFC_STD_GNU, "Data transfer element at %L "
- "cannot have PRIVATE components", &code->loc))
+ gfc_error ("Data transfer element at %L "
+ "cannot have PRIVATE components", &code->loc);
return;
}
else if (derived_inaccessible (ts->u.derived) && dtio_sub == NULL)
! { dg-do compile }
-! { dg-options "" }
!
! PR fortran/56378
! PR fortran/52426
end module
use iso_c_binding
-print *, c_loc([1]) ! { dg-error "Argument X at .1. to C_LOC shall have either the POINTER or the TARGET attribute" }
+type(c_ptr) :: i
+i = c_loc([1]) ! { dg-error "Argument X at .1. to C_LOC shall have either the POINTER or the TARGET attribute" }
end
! { dg-do run }
-! { dg-options "-std=gnu" }
! This test case exists because gfortran had an error in converting the
! expressions for the derived types from iso_c_binding in some cases.
module c_ptr_tests_10
- use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr
+ use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_intptr_t
contains
subroutine sub0() bind(c)
- print *, 'c_null_ptr is: ', c_null_ptr
+ print *, 'c_null_ptr is: ', transfer (cptr, 0_C_INTPTR_T)
end subroutine sub0
end module c_ptr_tests_10
subroutine bug1
use ISO_C_BINDING
implicit none
- type(c_ptr) :: m
+ type(c_ptr) :: m, i
type mytype
integer a, b, c
end type mytype
type(mytype) x
print *, transfer(32512, x) ! Works.
- print *, transfer(32512, m) ! Caused ICE.
+ i = transfer(32512, m) ! Caused ICE.
end subroutine bug1
subroutine bug6
! done to c_ptr and c_funptr (translating them to void *) works in the case
! where a component of a type is of type c_ptr or c_funptr.
module c_ptr_tests_9
- use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr
+ use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_intptr_t
type myF90Derived
type(c_ptr) :: my_c_ptr
type(myF90Derived), pointer :: my_f90_type_ptr
my_f90_type%my_c_ptr = c_null_ptr
- print *, 'my_f90_type is: ', my_f90_type%my_c_ptr
+ print *, 'my_f90_type is: ', transfer(my_f90_type%my_c_ptr, 0_C_INTPTR_T)
my_f90_type_ptr => my_f90_type
- print *, 'my_f90_type_ptr is: ', my_f90_type_ptr%my_c_ptr
+ print *, 'my_f90_type_ptr is: ', transfer(my_f90_type_ptr%my_c_ptr, 0_C_INTPTR_T)
end subroutine sub0
end module c_ptr_tests_9
type(ty) :: t
- print *, t%ptr
- print *, t%fptr
-
+ print *, transfer(t%ptr, 0_C_INTPTR_T)
+ print *, transfer(t%fptr, 0_C_INTPTR_T)
end program
! { dg-final { scan-tree-dump "\.ptr=0" "original" } }
! PR fortran/32601
use, intrinsic :: iso_c_binding, only: c_loc, c_ptr
implicit none
-
+type(c_ptr) :: i
! This was causing an ICE, but is an error because the argument to C_LOC
! needs to be a variable.
-print *, c_loc(4) ! { dg-error "shall have either the POINTER or the TARGET attribute" }
+i = c_loc(4) ! { dg-error "shall have either the POINTER or the TARGET attribute" }
end