From 12771b1d77aef71f9eceead9b46323292f3dd7e4 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Thu, 13 Feb 2025 20:19:56 -0800 Subject: Fortran: gfortran allows type(C_ptr) in I/O list Before this patch, gfortran was accepting invalid use of type(c_ptr) in I/O statements. The fix affects several existing test cases so no new test case needed. Existing tests were modified to pass by either using the transfer function to convert to an acceptable value or using an assignment to a like type (non-I/O). PR fortran/117430 gcc/fortran/ChangeLog: * resolve.cc (resolve_transfer): Change gfc_notify_std to gfc_error. gcc/testsuite/ChangeLog: * gfortran.dg/c_loc_test_17.f90: Use an assignment rather than PRINT. * gfortran.dg/c_ptr_tests_10.f03: Use a transfer function. * gfortran.dg/c_ptr_tests_16.f90: Use an assignment. * gfortran.dg/c_ptr_tests_9.f03: Use a transfer function. * gfortran.dg/init_flag_17.f90: Likewise. * gfortran.dg/pr32601_1.f03: Use an assignment. --- gcc/fortran/resolve.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 1a4799d..3d3f117 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -11824,8 +11824,8 @@ resolve_transfer (gfc_code *code) 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) -- cgit v1.1