This patch cleans up a few places where I noticed the code was still
using int instead gfc_charlen_type for string lengths. Regtested on
x86_64-pc-linux-gnu, committed as obvious.
libgfortran/ChangeLog:
2018-10-06 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.c (compare_file_filename): Use gfc_charlen_type instead
of int for string length.
(inquire_sequential): Likewise.
(inquire_direct): Likewise.
(inquire_formatted): Likewise.
(inquire_unformatted): Likewise.
(inquire_access): Likewise.
(inquire_read): Likewise.
(inquire_write): Likewise.
(inquire_readwrite): Likewise.
* io/unix.h (compare_file_filename): Likewise.
(inquire_sequential): Likewise.
(inquire_direct): Likewise.
(inquire_formatted): Likewise.
(inquire_unformatted): Likewise.
(inquire_read): Likewise.
(inquire_write): Likewise.
(inquire_readwrite): Likewise.
From-SVN: r264901
When producing error and warning messages, libgfortran writes a
message by using many system calls. By using vectored writes (the
POSIX writev function) when available and feasible to use without
major surgery, we reduce the chance that output gets intermingled with
other output to stderr.
In practice, this is done by introducing a new function estr_writev in
addition to the existing estr_write. In order to use this, the old
st_vprintf is removed, replaced by direct calls of vsnprintf, allowing
more message batching.
Regtested on x86_64-pc-linux-gnu.
libgfortran/ChangeLog:
2018-09-21 Janne Blomqvist <jb@gcc.gnu.org>
* config.h.in: Regenerated.
* configure: Regenerated.
* configure.ac: Check for writev and sys/uio.h.
* libgfortran.h: Include sys/uio.h.
(st_vprintf): Remove prototype.
(struct iovec): Define if not available.
(estr_writev): New prototype.
* runtime/backtrace.c (error_callback): Use estr_writev.
* runtime/error.c (ST_VPRINTF_SIZE): Remove.
(estr_writev): New function.
(st_vprintf): Remove.
(gf_vsnprintf): New function.
(ST_ERRBUF_SIZE): New macro.
(st_printf): Use vsnprintf.
(os_error): Use estr_writev.
(runtime_error): Use vsnprintf and estr_writev.
(runtime_error_at): Likewise.
(runtime_warning_at): Likewise.
(internal_error): Use estr_writev.
(generate_error_common): Likewise.
(generate_warning): Likewise.
(notify_std): Likewise.
* runtime/pause.c (pause_string): Likewise.
* runtime/stop.c (report_exception): Likewise.
(stop_string): Likewise.
(error_stop_string): Likewise.
From-SVN: r264487
I've been tracking down a bug in a Fortran program on a newlib target and it boils down to fallback_access doing something bad.
The unconditional calls to close cause havoc when open doesn't get called due to the short-circuiting in the if-statement above
because the fd is uninitialised. In my environment GCC ends up calling close on file descriptor 0, thus trying to close stdin.
This patch tightens up the calling so that close is called only when the corresponding open call succeeded.
With this my runtime failure disappears.
Bootstrapped and tested on aarch64-none-linux-gnu.
Though that doesn't exercise this call I hope it's an obviously correct change.
* io/unix.c (fallback_access): Avoid calling close on
uninitialized file descriptor.
From-SVN: r264305
Fortran STOP and ERROR STOP use a different function to print the "STOP" string
and the message string. On GCN this results in out-of-order output, such as
"<msg>ERROR STOP ".
This patch fixes the problem by making estr_write use the proper Fortran write,
not C printf, so both parts are now output the same way. This also ensures
that both parts are output to STDERR (not that that means anything on GCN).
2018-09-12 Kwok Cheung Yeung <kcy@codesourcery.com>
libgfortran/
* runtime/minimal.c (estr_write): Define in terms of write.
From-SVN: r264239
The minimal libgfortran setup was created for NVPTX, but will also be used by
AMD GCN.
This patch simply removes an assumption that NVPTX is the only user.
Specifically, NVPTX exit is broken, but AMD GCN exit works just fine.
2018-09-12 Andrew Stubbs <ams@codesourcery.com>
libgfortran/
* runtime/minimal.c (exit): Only work around nvptx bugs on nvptx.
From-SVN: r264238
As pointed out by Bernhard Reutner-Fischer, this function is unused
since the fix for PR 53796 in November 2017.
2018-09-07 Janne Blomqvist <jb@gcc.gnu.org>
* runtime/environ.c (init_unsigned_integer): Remove.
From-SVN: r264163
2018-09-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* io/io.h: Change declaration of vlist type to
gfc_full_array_i4 to eliminate warning for mismatched type.
* io/format.c ((parse_format_list): Use gfc_full_array_i4.
* io/io.h: Use gfc_full_array_i4.
From-SVN: r264043
2018-08-22 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.texi: Mention that asynchronous I/O does
not work on systems which lack condition variables, such
as AIX.
2018-08-22 Thomas Koenig <tkoenig@gcc.gnu.org>
* async.h: Set ASYNC_IO to zero if _AIX is defined.
(struct adv_cond): If ASYNC_IO is zero, the struct has no members.
(async_unit): If ASYNC_IO is zero, remove unneeded members.
From-SVN: r263788
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.texi: Add description of asynchronous I/O.
* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
as volatile.
* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
st_wait_async and change argument spec from ".X" to ".w".
(gfc_trans_wait): Pass ID argument via reference.
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.dg/f2003_inquire_1.f03: Add write statement.
* gfortran.dg/f2003_io_1.f03: Add wait statement.
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* Makefile.am: Add async.c to gfor_io_src.
Add async.h to gfor_io_headers.
* Makefile.in: Regenerated.
* gfortran.map: Add _gfortran_st_wait_async.
* io/async.c: New file.
* io/async.h: New file.
* io/close.c: Include async.h.
(st_close): Call async_wait for an asynchronous unit.
* io/file_pos.c (st_backspace): Likewise.
(st_endfile): Likewise.
(st_rewind): Likewise.
(st_flush): Likewise.
* io/inquire.c: Add handling for asynchronous PENDING
and ID arguments.
* io/io.h (st_parameter_dt): Add async bit.
(st_parameter_wait): Correct.
(gfc_unit): Add au pointer.
(st_wait_async): Add prototype.
(transfer_array_inner): Likewise.
(st_write_done_worker): Likewise.
* io/open.c: Include async.h.
(new_unit): Initialize asynchronous unit.
* io/transfer.c (async_opt): New struct.
(wrap_scalar_transfer): New function.
(transfer_integer): Call wrap_scalar_transfer to do the work.
(transfer_real): Likewise.
(transfer_real_write): Likewise.
(transfer_character): Likewise.
(transfer_character_wide): Likewise.
(transfer_complex): Likewise.
(transfer_array_inner): New function.
(transfer_array): Call transfer_array_inner.
(transfer_derived): Call wrap_scalar_transfer.
(data_transfer_init): Check for asynchronous I/O.
Perform a wait operation on any pending asynchronous I/O
if the data transfer is synchronous. Copy PDT and enqueue
thread for data transfer.
(st_read_done_worker): New function.
(st_read_done): Enqueue transfer or call st_read_done_worker.
(st_write_done_worker): New function.
(st_write_done): Enqueue transfer or call st_read_done_worker.
(st_wait): Document as no-op for compatibility reasons.
(st_wait_async): New function.
* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
add NOTE where necessary.
(get_gfc_unit): Likewise.
(init_units): Likewise.
(close_unit_1): Likewise. Call async_close if asynchronous.
(close_unit): Use macros LOCK and UNLOCK.
(finish_last_advance_record): Likewise.
(newunit_alloc): Likewise.
* io/unix.c (find_file): Likewise.
(flush_all_units_1): Likewise.
(flush_all_units): Likewise.
* libgfortran.h (generate_error_common): Add prototype.
* runtime/error.c: Include io.h and async.h.
(generate_error_common): New function.
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* testsuite/libgomp.fortran/async_io_1.f90: New test.
* testsuite/libgomp.fortran/async_io_2.f90: New test.
* testsuite/libgomp.fortran/async_io_3.f90: New test.
* testsuite/libgomp.fortran/async_io_4.f90: New test.
* testsuite/libgomp.fortran/async_io_5.f90: New test.
* testsuite/libgomp.fortran/async_io_6.f90: New test.
* testsuite/libgomp.fortran/async_io_7.f90: New test.
Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>
From-SVN: r263750
The getentropy function, found on Linux, OpenBSD, and recently also
FreeBSD, can be used to get random bytes to initialize the PRNG. It
is similar to the traditional way of reading from /dev/urandom, but
being a system call rather than a special file, it doesn't suffer from
problems like running out of file descriptors, or failure when running
in a container where /dev/urandom may not be available.
Regtested on x86_64-pc-linux-gnu, Ok for trunk?
2018-08-13 Janne Blomqvist <jb@gcc.gnu.org>
* configure.ac: Check for getentropy.
* intrinsics/random.c (getosrandom): Use getentropy if available.
* config.h.in: Regenerated.
* configure: Regenerated.
From-SVN: r263522
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
Revert 'AsyncI/O patch committed'
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.texi: Add description of asynchronous I/O.
* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
as volatile.
* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
st_wait_async and change argument spec from ".X" to ".w".
(gfc_trans_wait): Pass ID argument via reference.
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
Revert 'AsyncI/O patch committed'
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.dg/f2003_inquire_1.f03: Add write statement.
* gfortran.dg/f2003_io_1.f03: Add wait statement.
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
Revert 'AsyncI/O patch committed'
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* Makefile.am: Add async.c to gfor_io_src.
Add async.h to gfor_io_headers.
* Makefile.in: Regenerated.
* gfortran.map: Add _gfortran_st_wait_async.
* io/async.c: New file.
* io/async.h: New file.
* io/close.c: Include async.h.
(st_close): Call async_wait for an asynchronous unit.
* io/file_pos.c (st_backspace): Likewise.
(st_endfile): Likewise.
(st_rewind): Likewise.
(st_flush): Likewise.
* io/inquire.c: Add handling for asynchronous PENDING
and ID arguments.
* io/io.h (st_parameter_dt): Add async bit.
(st_parameter_wait): Correct.
(gfc_unit): Add au pointer.
(st_wait_async): Add prototype.
(transfer_array_inner): Likewise.
(st_write_done_worker): Likewise.
* io/open.c: Include async.h.
(new_unit): Initialize asynchronous unit.
* io/transfer.c (async_opt): New struct.
(wrap_scalar_transfer): New function.
(transfer_integer): Call wrap_scalar_transfer to do the work.
(transfer_real): Likewise.
(transfer_real_write): Likewise.
(transfer_character): Likewise.
(transfer_character_wide): Likewise.
(transfer_complex): Likewise.
(transfer_array_inner): New function.
(transfer_array): Call transfer_array_inner.
(transfer_derived): Call wrap_scalar_transfer.
(data_transfer_init): Check for asynchronous I/O.
Perform a wait operation on any pending asynchronous I/O
if the data transfer is synchronous. Copy PDT and enqueue
thread for data transfer.
(st_read_done_worker): New function.
(st_read_done): Enqueue transfer or call st_read_done_worker.
(st_write_done_worker): New function.
(st_write_done): Enqueue transfer or call st_read_done_worker.
(st_wait): Document as no-op for compatibility reasons.
(st_wait_async): New function.
* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
add NOTE where necessary.
(get_gfc_unit): Likewise.
(init_units): Likewise.
(close_unit_1): Likewise. Call async_close if asynchronous.
(close_unit): Use macros LOCK and UNLOCK.
(finish_last_advance_record): Likewise.
(newunit_alloc): Likewise.
* io/unix.c (find_file): Likewise.
(flush_all_units_1): Likewise.
(flush_all_units): Likewise.
* libgfortran.h (generate_error_common): Add prototype.
* runtime/error.c: Include io.h and async.h.
(generate_error_common): New function.
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
Revert 'AsyncI/O patch committed'.
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* testsuite/libgomp.fortran/async_io_1.f90: New test.
* testsuite/libgomp.fortran/async_io_2.f90: New test.
* testsuite/libgomp.fortran/async_io_3.f90: New test.
* testsuite/libgomp.fortran/async_io_4.f90: New test.
* testsuite/libgomp.fortran/async_io_5.f90: New test.
* testsuite/libgomp.fortran/async_io_6.f90: New test.
* testsuite/libgomp.fortran/async_io_7.f90: New test.
From-SVN: r263082
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.texi: Add description of asynchronous I/O.
* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
as volatile.
* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
st_wait_async and change argument spec from ".X" to ".w".
(gfc_trans_wait): Pass ID argument via reference.
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.dg/f2003_inquire_1.f03: Add write statement.
* gfortran.dg/f2003_io_1.f03: Add wait statement.
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* Makefile.am: Add async.c to gfor_io_src.
Add async.h to gfor_io_headers.
* Makefile.in: Regenerated.
* gfortran.map: Add _gfortran_st_wait_async.
* io/async.c: New file.
* io/async.h: New file.
* io/close.c: Include async.h.
(st_close): Call async_wait for an asynchronous unit.
* io/file_pos.c (st_backspace): Likewise.
(st_endfile): Likewise.
(st_rewind): Likewise.
(st_flush): Likewise.
* io/inquire.c: Add handling for asynchronous PENDING
and ID arguments.
* io/io.h (st_parameter_dt): Add async bit.
(st_parameter_wait): Correct.
(gfc_unit): Add au pointer.
(st_wait_async): Add prototype.
(transfer_array_inner): Likewise.
(st_write_done_worker): Likewise.
* io/open.c: Include async.h.
(new_unit): Initialize asynchronous unit.
* io/transfer.c (async_opt): New struct.
(wrap_scalar_transfer): New function.
(transfer_integer): Call wrap_scalar_transfer to do the work.
(transfer_real): Likewise.
(transfer_real_write): Likewise.
(transfer_character): Likewise.
(transfer_character_wide): Likewise.
(transfer_complex): Likewise.
(transfer_array_inner): New function.
(transfer_array): Call transfer_array_inner.
(transfer_derived): Call wrap_scalar_transfer.
(data_transfer_init): Check for asynchronous I/O.
Perform a wait operation on any pending asynchronous I/O
if the data transfer is synchronous. Copy PDT and enqueue
thread for data transfer.
(st_read_done_worker): New function.
(st_read_done): Enqueue transfer or call st_read_done_worker.
(st_write_done_worker): New function.
(st_write_done): Enqueue transfer or call st_read_done_worker.
(st_wait): Document as no-op for compatibility reasons.
(st_wait_async): New function.
* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
add NOTE where necessary.
(get_gfc_unit): Likewise.
(init_units): Likewise.
(close_unit_1): Likewise. Call async_close if asynchronous.
(close_unit): Use macros LOCK and UNLOCK.
(finish_last_advance_record): Likewise.
(newunit_alloc): Likewise.
* io/unix.c (find_file): Likewise.
(flush_all_units_1): Likewise.
(flush_all_units): Likewise.
* libgfortran.h (generate_error_common): Add prototype.
* runtime/error.c: Include io.h and async.h.
(generate_error_common): New function.
2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* testsuite/libgomp.fortran/async_io_1.f90: New test.
* testsuite/libgomp.fortran/async_io_2.f90: New test.
* testsuite/libgomp.fortran/async_io_3.f90: New test.
* testsuite/libgomp.fortran/async_io_4.f90: New test.
* testsuite/libgomp.fortran/async_io_5.f90: New test.
* testsuite/libgomp.fortran/async_io_6.f90: New test.
* testsuite/libgomp.fortran/async_io_7.f90: New test.
Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>
From-SVN: r262978
2018-06-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/63570
* check.c (gfc_check_random_init): New function. Check arguments of
RANDOM_INIT.
* gfortran.h (GFC_ISYM_RANDOM_INIT): New enum token.
* intrinsic.c (add_subroutines): Add RANDOM_INIT to list of
subroutines.
(gfc_check_intrinsic_standard): Introduce Fortran 2018 check.
* intrinsic.h: Add prototypes for gfc_check_random_init and
gfc_resolve_random_init
* intrinsic.texi: Document new intrinsic subprogram.
* iresolve.c (gfc_resolve_random_init): Resolve routine name.
* trans-decl.c: Declare gfor_fndecl_random_init
* trans-intrinsic.c (conv_intrinsic_random_init): New function.
Translate call to RANDOM_INIT.
(gfc_conv_intrinsic_subroutine): Call it.
* trans.h: Declare gfor_fndecl_random_init
2018-06-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/63570
* gfortran.dg/random_init_1.f90: New test.
* gfortran.dg/random_init_2.f90: New test.
* gfortran.dg/random_init_3.f90: New test.
* gfortran.dg/random_init_4.f90: New test.
* gfortran.dg/random_init_5.f90: New test.
* gfortran.dg/random_init_6.f90: New test.
2018-06-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/63570
* libgfortran/Makefile.am: Add random_init.f90 to build.
* libgfortran/Makefile.in: Regenerated.
* libgfortran/gfortran.map: Expose symbol for _gfortran_random_init.
* libgfortran/intrinsics/random_init.f90: Implementation.
From-SVN: r261075
2018-05-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/85840
* io/write.c (write_real, write_real_g0, write_complex): Use
separate local variables for the float string length.
From-SVN: r260851
2018-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/89506
* io/write.c (write_integer): Initialise the fnode format to
FMT_NONE, used for list directed write.
(BUF_STACK_SZ): Bump default buffer size up to avoid allocs on
small stuff.
From-SVN: r260795
2018-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/85840
* io/write.c (write_float_0): Use separate local variable for
the float string length.
From-SVN: r260793
* config/cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace
--enable-cet=default with --enable-cet=auto.
* doc/install.texi: Document --disable-cet being the default and
--enable-cet=auto.
* configure: Regenerated.
From-SVN: r259487
PR jit/85384
* acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression.
* configure.ac (gcc-driver-name.h): Honor --with-gcc-major-version
by using gcc_base_ver to generate a gcc_driver_version, and use
it when generating GCC_DRIVER_NAME.
* configure: Regenerate.
* configure: Regenerate.
From-SVN: r259462
2018-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/85166
* runtime/minimal.c (stop_numeric): Add new function in order to
implement numeric stop on minimal targets.
From-SVN: r259072
Fortran 2018 adds a new QUIET specifier for the STOP and ERROR STOP
statements, in order to suppress the printing of signaling FP
exceptions and the stop code. This patch adds the necessary library
changes, but for now the new specifier is not parsed and the frontend
unconditionally adds a false value for the new argument.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2018-02-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/84519
* trans-decl.c (gfc_build_builtin_function_decls): Add bool
argument to stop and error stop decls.
* trans-stmt.c (gfc_trans_stop): Add false value to argument
lists.
libgfortran/ChangeLog:
2018-02-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/84519
* caf/libcaf.h (_gfortran_caf_stop_numeric): Add bool argument.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
* caf/mpi.c (_gfortran_caf_error_stop_str): Handle new argument.
(_gfortran_caf_error_stop): Likewise.
* caf/single.c (_gfortran_caf_stop_numeric): Likewise.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
* libgfortran.h (stop_string): Add bool argument.
* runtime/pause.c (do_pause): Add false argument.
* runtime/stop.c (stop_numeric): Handle new argument.
(stop_string): Likewise.
(error_stop_string): Likewise.
(error_stop_numeric): Likewise.
From-SVN: r257928
This patch changes the libgfortran API for the PAUSE statement. By
passing a GFC_INTEGER_8 it handles -fdefault-integer-8, and for the
character version passing the length as a size_t.
Regtested on x86_64-pc-linux-gnu, committed as obvious.
gcc/fortran/ChangeLog:
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
PR 78534
PR 84509
* trans-decl.c (gfc_build_builtin_function_decls): Pass
gfc_int8_type node to pause_numeric, size_type_node to
pause_string.
* trans-stmt.c (gfc_trans_pause): Likewise.
libgfortran/ChangeLog:
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
PR 78534
PR 84509
* runtime/pause.c (pause_numeric): Modify to take GFC_INTEGER_8
argument.
(pause_string): Modify to take size_t character length argument.
From-SVN: r257903
Following the change to use size_t for Fortran character lengths (PR
78534), this patch modifies the Coarray ABI in a similar way. The
single-image implementation that is included in libgfortran is
updated, but this needs corresponding work in the OpenCoarray library
as well for multi-image support. I also fixed the types for the STOP
and ERROR STOP implementation in libgfortran, as the calling of them
is somewhat intertwined with the calling of the corresponding CAF
functions. I'll send the OpenCoarray changes as a separate pull
request to the OpenCoarrays repository.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.texi: Update Coarray API description.
* trans-decl.c (gfc_build_builtin_function_decls): Use size_t for
character lengths, int for exit codes.
(generate_coarray_sym_init): Use size_t for character length.
* trans-intrinsic.c (conv_co_collective): Likewise.
* trans-stmt.c (gfc_trans_lock_unlock): Likewise.
(gfc_trans_event_post_wait): Likewise.
(gfc_trans_sync): Likewise.
(gfc_trans_stop): Use size_t for character lengths, int for exit
codes.
libgfortran/ChangeLog:
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
* libgfortran.h (stop_string): Use size_t for character length.
* runtime/stop.c (stop_string): Likewise.
(error_stop_string): Likewise.
(stop_numeric): Use int for exit code.
(error_stop_numeric): Likewise.
* caf/libcaf.h: Remove stdint.h include.
(_gfortran_caf_register): Use size_t for character length.
(_gfortran_caf_deregister): Likewise.
(_gfortran_caf_sync_all): Likewise.
(_gfortran_caf_sync_memory): Likewise.
(_gfortran_caf_sync_images): Likewise.
(_gfortran_caf_stop_numeric): Use int for exit code.
(_gfortran_caf_stop_str): Use size_t for character length.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Use int for exit code.
(_gfortran_caf_co_broadcast): Use size_t for character length.
(_gfortran_caf_co_sum): Likewise.
(_gfortran_caf_co_min): Likewise.
(_gfortran_caf_co_max): Likewise.
(_gfortran_caf_co_reduce): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
(_gfortran_caf_event_post): Likewise.
(_gfortran_caf_event_wait): Likewise.
* caf/mpi.c (_gfortran_caf_register): Update implementation to
match prototype.
(_gfortran_caf_deregister): Likewise.
(_gfortran_caf_sync_all): Likewise.
(_gfortran_caf_sync_images): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
* caf/single.c (caf_internal_error): Likewise.
(_gfortran_caf_register): Likewise.
(_gfortran_caf_deregister): Likewise.
(_gfortran_caf_sync_all): Likewise.
(_gfortran_caf_sync_memory): Likewise.
(_gfortran_caf_sync_images): Likewise.
(_gfortran_caf_stop_numeric): Likewise.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
(_gfortran_caf_co_broadcast): Likewise.
(_gfortran_caf_co_sum): Likewise.
(_gfortran_caf_co_min): Likewise.
(_gfortran_caf_co_max): Likewise.
(_gfortran_caf_co_reduce): Likewise.
(_gfortran_caf_event_post): Likewise.
(_gfortran_caf_event_wait): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
From-SVN: r257894
gcc/fortran/ChangeLog:
2018-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.texi: Document additional src/dst_type. Fix some typos.
* trans-decl.c (gfc_build_builtin_function_decls): Declare the new
argument of _caf_*_by_ref () with * e { get, send, sendget }.
* trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Add the type of the
data referenced when generating a call to caf_get_by_ref ().
(conv_caf_send): Same but for caf_send_by_ref () and
caf_sendget_by_ref ().
gcc/testsuite/ChangeLog:
2018-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray_alloc_comp_6.f08: New test.
* gfortran.dg/coarray_alloc_comp_7.f08: New test.
* gfortran.dg/coarray_alloc_comp_8.f08: New test.
libgfortran/ChangeLog:
2018-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
* caf/libcaf.h: Add type parameters to the caf_*_by_ref prototypes.
* caf/single.c (get_for_ref): Simplifications and now respecting
the type argument.
(_gfortran_caf_get_by_ref): Added source type handing to get_for_ref().
(send_by_ref): Simplifications and respecting the dst_type now.
(_gfortran_caf_send_by_ref): Added destination type hand over to
send_by_ref().
(_gfortran_caf_sendget_by_ref): Added general support and fixed stack
corruption. The function is now really usable.
From-SVN: r257813
ENDBR32 and RDSSPD are multi-byte NOPs on x86-64 processors and
newer x86 processors, starting Pentium Pro. They are UD on older
32-bit processors. Detect this at configure time and adjust the
default value for enable_cet. GCC will enable CET in 32-bit run-time
libraries in any case if --enable-cet is used to configure GCC.
PR target/84148
* config/cet.m4: Check if target support multi-byte NOPS (SSE).
* libatomic/configure: Regenerate.
* libbacktrace/configure: Likewise.
* libgcc/configure: Likewise.
* libgfortran/configure: Likewise.
* libgomp/configure: Likewise.
* libitm/configure: Likewise.
* libmpx/configure: Likewise.
* libobjc/configure: Likewise.
* libquadmath/configure: Likewise.
* libsanitizer/configure: Likewise.
* libssp/configure: Likewise.
* libstdc++-v3/configure: Likewise.
* libvtv/configure: Likewise.
From-SVN: r257809
2018-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/84412
* io/transfer.c (finalize_transfer): After completng an internal unit
I/O operation, clear internal_unit_kind.
From-SVN: r257791
2018-25-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37577
* array.c (gfc_match_array_ref): If standard earlier than F2008
it is an error if the reference dimension is greater than 7.
libgfortran.h : Increase GFC_MAX_DIMENSIONS to 15. Change the
dtype masks and shifts accordingly.
* trans-array.c (gfc_conv_descriptor_dtype): Use the dtype
type node to check the field.
(gfc_conv_descriptor_dtype): Access the rank field of dtype.
(duplicate_allocatable_coarray): Access the rank field of the
dtype descriptor rather than the dtype itself.
* trans-expr.c (get_scalar_to_descriptor_type): Store the type
of 'scalar' on entry and use its TREE_TYPE if it is ARRAY_TYPE
(ie. a character).
(gfc_conv_procedure_call): Pass TREE_OPERAND (tmp,0) to
get_scalar_to_descriptor_type if the actual expression is a
constant.
(gfc_trans_structure_assign): Assign the rank directly to the
dtype rank field.
* trans-intrinsic.c (gfc_conv_intrinsic_rank): Cast the result
to default integer kind.
(gfc_conv_intrinsic_sizeof): Obtain the element size from the
'elem_len' field of the dtype.
* trans-io.c (gfc_build_io_library_fndecls): Replace
gfc_int4_type_node with dtype_type_node where necessary.
(transfer_namelist_element): Use gfc_get_dtype_rank_type for
scalars.
* trans-types.c : Provide 'get_dtype_type_node' to acces the
dtype_type_node and, if necessary, build it.
The maximum size of an array element is now determined by the
maximum value of size_t.
Update the description of the array descriptor, including the
type def for the dtype_type.
(gfc_get_dtype_rank_type): Build a constructor for the dtype.
Distinguish RECORD_TYPEs that are BT_DERIVED or BT_CLASS.
(gfc_get_array_descriptor_base): Change the type of the dtype
field to dtype_type_node.
(gfc_get_array_descr_info): Get the offset to the rank field of
the dtype.
* trans-types.h : Add a prototype for 'get_dtype_type_node ()'.
* trans.h : Define the indices of the dtype fields.
2018-25-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37577
* gfortran.dg/coarray_18.f90: Allow dimension 15 for F2008.
* gfortran.dg/coarray_lib_this_image_2.f90: Change 'array1' to
'array01' in the tree dump comparison.
* gfortran.dg/coarray_lib_token_4.f90: Likewise.
* gfortran.dg/inline_sum_1.f90: Similar - allow two digits.
* gfortran.dg/rank_1.f90: Allow dimension 15 for F2008.
2018-25-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37577
* caf/single.c (_gfortran_caf_failed_images): Access the 'type'
and 'elem_len' fields of the dtype instead of the shifts.
(_gfortran_caf_stopped_images): Likewise.
* intrinsics/associated.c (associated): Compare the 'type' and
'elem_len' fields instead of the dtype.
* caf/date_and_time.c : Access the dtype fields rather using
shifts and masks.
* io/transfer.c (transfer_array ): Comment on item count.
(set_nml_var,st_set_nml_var): Change dtype type and use fields.
(st_set_nml_dtio_var): Likewise.
* libgfortran.h : Change definition of GFC_ARRAY_DESCRIPTOR and
add a typedef for the dtype_type. Change the GFC_DTYPE_* macros
to access the dtype fields.
From-SVN: r257065