devel/mold-lto-plugin
204 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Jakub Jelinek
|
7adcbafe45 | Update copyright years. | ||
Francois-Xavier Coudert
|
4ae906e46c |
Fortran: simplify library code for integer-to-decimal conversion
libgfortran/ChangeLog: PR libfortran/81986 PR libfortran/99191 * libgfortran.h: Remove gfc_xtoa(), adjust gfc_itoa() and GFC_ITOA_BUF_SIZE. * io/write.c (write_decimal): conversion parameter is always gfc_itoa(), so remove it. Protect from overflow. (xtoa): Move gfc_xtoa and update its name. (xtoa_big): Renamed from ztoa_big for consistency. (write_z): Adjust to new function names. (write_i, write_integer): Remove last arg of write_decimal. * runtime/backtrace.c (error_callback): Comment on the use of gfc_itoa(). * runtime/error.c (gfc_xtoa): Move to io/write.c. * runtime/string.c (gfc_itoa): Take an unsigned argument, remove the handling of negative values. |
||
François-Xavier Coudert
|
21423a1dfa |
Fortran: Cast arguments of <ctype.h> functions to unsigned char
Functions from <ctype.h> should only be called on values that can be represented by unsigned char. On targets where char is a signed type, some of libgfortran calls have undefined behaviour. The solution is to cast the argument to unsigned char type. I’ve defined macros in libgfortran.h to do so, to retain legibility of the library code. PR libfortran/95177 libgfortran/ChangeLog * libgfortran.h: include ctype.h, provide safe macros. * io/format.c: use safe macros. * io/list_read.c: use safe macros. * io/read.c: use safe macros. * io/write.c: use safe macros. * runtime/environ.c: use safe macros. |
||
José Rui Faustino de Sousa
|
d514626ee2 |
Fortran: Fix some issues with pointers to character.
gcc/fortran/ChangeLog: PR fortran/100120 PR fortran/100816 PR fortran/100818 PR fortran/100819 PR fortran/100821 * trans-array.c (gfc_get_array_span): rework the way character array "span" was calculated. (gfc_conv_expr_descriptor): improve handling of character sections and unlimited polymorphic objects. * trans-expr.c (gfc_get_character_len): new function to calculate character string length. (gfc_get_character_len_in_bytes): new function to calculate character string length in bytes. (gfc_conv_scalar_to_descriptor): add call to set the "span". (gfc_trans_pointer_assignment): set "_len" and antecipate the initialization of the deferred character length hidden argument. * trans-intrinsic.c (gfc_conv_associated): set "force_no_tmp" to avoid the creation of a temporary. * trans-types.c (gfc_get_dtype_rank_type): rework type detection so that unlimited polymorphic objects get proper type infomation, also important for bind(c). (gfc_get_dtype): add argument to pass the rank if necessary. (gfc_get_array_type_bounds): cosmetic change to have character arrays called character instead of unknown. * trans-types.h (gfc_get_dtype): modify prototype. * trans.c (get_array_span): rework the way character array "span" was calculated. * trans.h (gfc_get_character_len): new prototype. (gfc_get_character_len_in_bytes): new prototype. Add "unlimited_polymorphic" flag to "gfc_se" type to signal when expression carries an unlimited polymorphic object. libgfortran/ChangeLog: PR fortran/100120 * intrinsics/associated.c (associated): have associated verify if the "span" matches insted of the "elem_len". * libgfortran.h (GFC_DESCRIPTOR_SPAN): add macro to retrive the descriptor "span". gcc/testsuite/ChangeLog: PR fortran/100120 * gfortran.dg/PR100120.f90: New test. PR fortran/100816 PR fortran/100818 PR fortran/100819 PR fortran/100821 * gfortran.dg/character_workout_1.f90: New test. * gfortran.dg/character_workout_4.f90: New test. |
||
Jakub Jelinek
|
99dee82307 | Update copyright years. | ||
Maciej W. Rozycki
|
c87cce5a33 |
libgfortran: Correct FP feature macro checks
The *_HAS_* floating-point feature macros are defined as 0/1 rather than #undef/#define settings by gcc/c-family/c-cppbuiltin.c. Consequently we choose to use infinity and NaN features even with non-IEEE-754 targets such as `vax-netbsdelf' that lack them, causing build warnings and failures like: In file included from .../libgfortran/generated/maxval_r4.c:26: .../libgfortran/generated/maxval_r4.c: In function 'maxval_r4': .../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity 292 | # define GFC_REAL_4_INFINITY __builtin_inff () | ^~~~~~~~~~~~~~ .../libgfortran/generated/maxval_r4.c:149:19: note: in expansion of macro 'GFC_REAL_4_INFINITY' 149 | result = -GFC_REAL_4_INFINITY; | ^~~~~~~~~~~~~~~~~~~ .../libgfortran/generated/maxval_r4.c: In function 'mmaxval_r4': .../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity 292 | # define GFC_REAL_4_INFINITY __builtin_inff () | ^~~~~~~~~~~~~~ .../libgfortran/generated/maxval_r4.c:363:19: note: in expansion of macro 'GFC_REAL_4_INFINITY' 363 | result = -GFC_REAL_4_INFINITY; | ^~~~~~~~~~~~~~~~~~~ {standard input}: Assembler messages: {standard input}:204: Fatal error: Can't relocate expression make[3]: *** [Makefile:3358: maxval_r4.lo] Error 1 Correct the checks then for __FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__, __LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__, __DBL_HAS_QUIET_NAN__, and __LDBL_HAS_QUIET_NAN__ to match semantics and remove build issues coming from the misinterpretation of these macros. libgfortran/ * libgfortran.h: Use #if rather than #ifdef with __FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__, __LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__, __DBL_HAS_QUIET_NAN__, and __LDBL_HAS_QUIET_NAN__. |
||
Jakub Jelinek
|
8d9254fc8a |
Update copyright years.
From-SVN: r279813 |
||
Janne Blomqvist
|
d74a8b0579 |
PR fortran/68401 Improve allocation error message
Improve the error message that is printed when a memory allocation fails, by including the location, and the size of the allocation that failed. Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2019-08-17 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/68401 * trans-decl.c (gfc_build_builtin_function_decls): Replace os_error with os_error_at decl. * trans.c (trans_runtime_error_vararg): Modify so the error function decl is passed directly. (gfc_trans_runtime_error): Pass correct error function decl. (gfc_trans_runtime_check): Likewise. (trans_os_error_at): New function. (gfc_call_malloc): Use trans_os_error_at. (gfc_allocate_using_malloc): Likewise. (gfc_call_realloc): Likewise. * trans.h (gfor_fndecl_os_error): Replace with gfor_fndecl_os_error_at. libgfortran/ChangeLog: 2019-08-17 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/68401 * gfortran.map: Add GFORTRAN_10 node, add _gfortran_os_error_at symbol. * libgfortran.h (os_error_at): New prototype. * runtime/error.c (os_error_at): New function. From-SVN: r274599 |
||
Thomas Koenig
|
c37b0163fe |
re PR libfortran/91030 (Poor performance of I/O -fconvert=big-endian)
2019-07-21 Thomas König <tkoenig@gcc.gnu.org> PR libfortran/91030 * gfortran.texi (GFORTRAN_FORMATTED_BUFFER_SIZE): Document (GFORTRAN_UNFORMATTED_BUFFER_SIZE): Likewise. 2019-07-21 Thomas König <tkoenig@gcc.gnu.org> PR libfortran/91030 * io/unix.c (BUFFER_SIZE): Delete. (BUFFER_FORMATTED_SIZE_DEFAULT): New variable. (BUFFER_UNFORMATTED_SIZE_DEFAULT): New variable. (unix_stream): Add buffer_size. (buf_read): Use s->buffer_size instead of BUFFER_SIZE. (buf_write): Likewise. (buf_init): Add argument unformatted. Handle block sizes for unformatted vs. formatted, using defaults if provided. (fd_to_stream): Add argument unformatted in call to buf_init. * libgfortran.h (options_t): Add buffer_size_formatted and buffer_size_unformatted. * runtime/environ.c (variable_table): Add GFORTRAN_UNFORMATTED_BUFFER_SIZE and GFORTRAN_FORMATTED_BUFFER_SIZE. From-SVN: r273643 |
||
Thomas Koenig
|
419af57c13 |
re PR fortran/45424 ([F08] Add IS_CONTIGUOUS intrinsic)
2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/45424 * check.c (gfc_check_is_contiguous): New function. * expr.c (gfc_is_not_contiguous): New function. * gfortran.h (gfc_isym_id): Add GFC_ISYM_IS_CONTIGUOUS. Add prototype for gfc_is_not_contiguous. * intrinsic.c (do_ts29113_check): Add GFC_ISYM_IS_CONTIGUOUS. (add_function): Add is_contiguous. * intrinsic.h: Add prototypes for gfc_check_is_contiguous, gfc_simplify_is_contiguous and gfc_resolve_is_contiguous. * intrinsic.texi: Add IS_CONTIGUOUS. * iresolve.c (gfc_resolve_is_contiguous): New function. * simplify.c (gfc_simplify_is_contiguous): New function. * trans-decl.c (gfor_fncecl_is_contiguous0): New variable. (gfc_build_intrinsic_function_decl): Add it. * trans-intrinsic.c (gfc_conv_intrinsic_is_contiguous): New function. (gfc_conv_intrinsic_function): Handle GFC_ISYM_IS_CONTIGUOUS. 2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/45424 * Makefile.am: Add intrinsics/is_contiguous.c. * Makefile.in: Regenerated. * gfortran.map: Add _gfortran_is_contiguous0. * intrinsics/is_contiguous.c: New file. * libgfortran.h: Add prototype for is_contiguous0. 2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> Tobias Burnus <burnus@gcc.gnu.org> * gfortran.dg/is_contiguous_1.f90: New test. * gfortran.dg/is_contiguous_2.f90: New test. * gfortran.dg/is_contiguous_3.f90: New test. Co-Authored-By: Harald Anlauf <anlauf@gmx.de> Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r267657 |
||
Martin Sebor
|
29d2485270 |
PR c/88546 - Copy attribute unusable for weakrefs
gcc/c-family/ChangeLog: PR c/88546 * c-attribs.c (handle_copy_attribute): Avoid copying attribute leaf. Handle C++ empty throw specification and C11 _Noreturn. (has_attribute): Also handle C11 _Noreturn. gcc/ChangeLog: PR c/88546 * attribs.c (decls_mismatched_attributes): Avoid warning for attribute leaf. gcc/testsuite/ChangeLog: PR c/88546 * g++.dg/ext/attr-copy.C: New test. * gcc.dg/attr-copy-4.c: Disable macro expansion tracking. * gcc.dg/attr-copy-6.c: New test. * gcc.dg/attr-copy-7.c: New test. From-SVN: r267591 |
||
Jakub Jelinek
|
a554497024 |
Update copyright years.
From-SVN: r267494 |
||
Thomas Koenig
|
01ce9e31a0 |
re PR fortran/54613 ([F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=)
2017-10-28 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/54613 * gfortran.h (gfc_isym_id): Add GFC_ISYM_FINDLOC. (gfc_check_f): Add f6fl field. (gfc_simplify_f): Add f6 field. (gfc_resolve_f): Likewise. (gfc_type_letter): Add optional logical_equas_int flag. * check.c (intrinsic_type_check): New function. (gfc_check_findloc): New function. * intrinsics.c (gfc_type_letter): If logical_equals_int is set, act accordingly. (add_sym_5ml): Reformat comment. (add_sym_6fl): New function. (add_functions): Add findloc. (check_arglist): Add sixth argument, handle it. (resolve_intrinsic): Likewise. (check_specific): Handle findloc. * intrinsic.h (gfc_check_findloc): Add prototype. (gfc_simplify_findloc): Likewise. (gfc_resolve_findloc): Likewise. (MAX_INTRINSIC_ARGS): Adjust. * iresolve.c (gfc_resolve_findloc): New function. * simplify.c (gfc_simplify_minmaxloc): Make static. (simplify_findloc_to_scalar): New function. (simplify_findloc_nodim): New function. (simplify_findloc_to_array): New function. (gfc_simplify_findloc): New function. (gfc_conv_intrinsic_findloc): New function. (gfc_conv_intrinsic_function): Handle GFC_ISYM_FINDLOC. (gfc_is_intrinsic_libcall): Likewise. 2017-10-28 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/54613 * Makefile.am: Add files for findloc. * Makefile.in: Regenerated. * libgfortran.h (gfc_array_index_type): Add. (gfc_array_s1): Add using GFC_UINTEGER_1. (gfc_array_s4): Likewise. Replace unnecessary comment. (HAVE_GFC_UINTEGER_1): Define. (HAVE_GFC_UINTEGER_4): Define. * m4/findloc0.m4: New file. * m4/findloc0s.m4: New file. * m4/findloc1.m4: New file. * m4/findloc1s.m4: New file. * m4/findloc2s.m4: New file. * m4/ifindloc0.m4: New file. * m4/ifindloc1.m4: New file. * m4/ifindloc2.m4: New file. * m4/iparm.m4: Use unsigned integer for characters. * generated/findloc0_c16.c: New file. * generated/findloc0_c4.c: New file. * generated/findloc0_c8.c: New file. * generated/findloc0_i1.c: New file. * generated/findloc0_i16.c: New file. * generated/findloc0_i2.c: New file. * generated/findloc0_i4.c: New file. * generated/findloc0_i8.c: New file. * generated/findloc0_r16.c: New file. * generated/findloc0_r4.c: New file. * generated/findloc0_r8.c: New file. * generated/findloc0_s1.c: New file. * generated/findloc0_s4.c: New file. * generated/findloc1_c16.c: New file. * generated/findloc1_c4.c: New file. * generated/findloc1_c8.c: New file. * generated/findloc1_i1.c: New file. * generated/findloc1_i16.c: New file. * generated/findloc1_i2.c: New file. * generated/findloc1_i4.c: New file. * generated/findloc1_i8.c: New file. * generated/findloc1_r16.c: New file. * generated/findloc1_r4.c: New file. * generated/findloc1_r8.c: New file. * generated/findloc1_s1.c: New file. * generated/findloc1_s4.c: New file. * generated/findloc2_s1.c: New file. * generated/findloc2_s4.c: New file. * generated/maxloc0_16_s1.c: Regenerated. * generated/maxloc0_16_s4.c: Regenerated. * generated/maxloc0_4_s1.c: Regenerated. * generated/maxloc0_4_s4.c: Regenerated. * generated/maxloc0_8_s1.c: Regenerated. * generated/maxloc0_8_s4.c: Regenerated. * generated/maxloc1_16_s1.c: Regenerated. * generated/maxloc1_16_s4.c: Regenerated. * generated/maxloc1_4_s1.c: Regenerated. * generated/maxloc1_4_s4.c: Regenerated. * generated/maxloc1_8_s1.c: Regenerated. * generated/maxloc1_8_s4.c: Regenerated. * generated/maxloc2_16_s1.c: Regenerated. * generated/maxloc2_16_s4.c: Regenerated. * generated/maxloc2_4_s1.c: Regenerated. * generated/maxloc2_4_s4.c: Regenerated. * generated/maxloc2_8_s1.c: Regenerated. * generated/maxloc2_8_s4.c: Regenerated. * generated/maxval0_s1.c: Regenerated. * generated/maxval0_s4.c: Regenerated. * generated/maxval1_s1.c: Regenerated. * generated/maxval1_s4.c: Regenerated. * generated/minloc0_16_s1.c: Regenerated. * generated/minloc0_16_s4.c: Regenerated. * generated/minloc0_4_s1.c: Regenerated. * generated/minloc0_4_s4.c: Regenerated. * generated/minloc0_8_s1.c: Regenerated. * generated/minloc0_8_s4.c: Regenerated. * generated/minloc1_16_s1.c: Regenerated. * generated/minloc1_16_s4.c: Regenerated. * generated/minloc1_4_s1.c: Regenerated. * generated/minloc1_4_s4.c: Regenerated. * generated/minloc1_8_s1.c: Regenerated. * generated/minloc1_8_s4.c: Regenerated. * generated/minloc2_16_s1.c: Regenerated. * generated/minloc2_16_s4.c: Regenerated. * generated/minloc2_4_s1.c: Regenerated. * generated/minloc2_4_s4.c: Regenerated. * generated/minloc2_8_s1.c: Regenerated. * generated/minloc2_8_s4.c: Regenerated. * generated/minval0_s1.c: Regenerated. * generated/minval0_s4.c: Regenerated. * generated/minval1_s1.c: Regenerated. * generated/minval1_s4.c: Regenerated. 2017-10-28 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/54613 * gfortran.dg/findloc_1.f90: New test. * gfortran.dg/findloc_2.f90: New test. * gfortran.dg/findloc_3.f90: New test. * gfortran.dg/findloc_4.f90: New test. * gfortran.dg/findloc_5.f90: New test. * gfortran.dg/findloc_6.f90: New test. From-SVN: r265570 |
||
Janne Blomqvist
|
edaaef601d |
Use vectored writes when reporting errors and warnings.
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 |
||
Nicolas Koenig
|
2b4c906561 |
re PR fortran/25829 ([F03] Asynchronous IO support)
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 |
||
Andre Vieira
|
1d4a51cf50 |
Reverting 'AsyncI/O patch committed' as it is breaking bare-metal builds.
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 |
||
Nicolas Koenig
|
b1f45884f6 |
re PR fortran/25829 ([F03] Asynchronous IO support)
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 |
||
Steven G. Kargl
|
ca708a2b55 |
re PR fortran/85816 (nested spread fails with "Integer overflow in xmallocarray")
2018-06-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85816 PR fortran/85975 * libgfortran.h: Remove the GFC_DTYPE_COPY_SETRANK macro. * intrinsics/reshape_generic.c: Directly assign rank. * intrinsics/spread_generic.c: Ditto. * m4/iforeach-s.m4: Ditto. * m4/iforeach.m4: Ditto. * m4/ifunction-s.m4: Ditto. * m4/ifunction-s2.m4: Ditto. * m4/ifunction.m4: Ditto. * m4/ifunction_logical.m4: Ditto. * m4/reshape.m4: Ditto. * m4/spread.m4: Ditto. * generated/all_l1.c: Regenerated from m4 files. * generated/all_l16.c: Ditto. * generated/all_l2.c: Ditto. * generated/all_l4.c: Ditto. * generated/all_l8.c: Ditto. * generated/any_l1.c: Ditto. * generated/any_l16.c: Ditto. * generated/any_l2.c: Ditto. * generated/any_l4.c: Ditto. * generated/any_l8.c: Ditto. * generated/count_16_l.c: Ditto. * generated/count_1_l.c: Ditto. * generated/count_2_l.c: Ditto. * generated/count_4_l.c: Ditto. * generated/count_8_l.c: Ditto. * generated/iall_i1.c: Ditto. * generated/iall_i16.c: Ditto. * generated/iall_i2.c: Ditto. * generated/iall_i4.c: Ditto. * generated/iall_i8.c: Ditto. * generated/iany_i1.c: Ditto. * generated/iany_i16.c: Ditto. * generated/iany_i2.c: Ditto. * generated/iany_i4.c: Ditto. * generated/iany_i8.c: Ditto. * generated/iparity_i1.c: Ditto. * generated/iparity_i16.c: Ditto. * generated/iparity_i2.c: Ditto. * generated/iparity_i4.c: Ditto. * generated/iparity_i8.c: Ditto. * generated/maxloc0_16_i1.c: Ditto. * generated/maxloc0_16_i16.c: Ditto. * generated/maxloc0_16_i2.c: Ditto. * generated/maxloc0_16_i4.c: Ditto. * generated/maxloc0_16_i8.c: Ditto. * generated/maxloc0_16_r10.c: Ditto. * generated/maxloc0_16_r16.c: Ditto. * generated/maxloc0_16_r4.c: Ditto. * generated/maxloc0_16_r8.c: Ditto. * generated/maxloc0_16_s1.c: Ditto. * generated/maxloc0_16_s4.c: Ditto. * generated/maxloc0_4_i1.c: Ditto. * generated/maxloc0_4_i16.c: Ditto. * generated/maxloc0_4_i2.c: Ditto. * generated/maxloc0_4_i4.c: Ditto. * generated/maxloc0_4_i8.c: Ditto. * generated/maxloc0_4_r10.c: Ditto. * generated/maxloc0_4_r16.c: Ditto. * generated/maxloc0_4_r4.c: Ditto. * generated/maxloc0_4_r8.c: Ditto. * generated/maxloc0_4_s1.c: Ditto. * generated/maxloc0_4_s4.c: Ditto. * generated/maxloc0_8_i1.c: Ditto. * generated/maxloc0_8_i16.c: Ditto. * generated/maxloc0_8_i2.c: Ditto. * generated/maxloc0_8_i4.c: Ditto. * generated/maxloc0_8_i8.c: Ditto. * generated/maxloc0_8_r10.c: Ditto. * generated/maxloc0_8_r16.c: Ditto. * generated/maxloc0_8_r4.c: Ditto. * generated/maxloc0_8_r8.c: Ditto. * generated/maxloc0_8_s1.c: Ditto. * generated/maxloc0_8_s4.c: Ditto. * generated/maxloc1_16_i1.c: Ditto. * generated/maxloc1_16_i16.c: Ditto. * generated/maxloc1_16_i2.c: Ditto. * generated/maxloc1_16_i4.c: Ditto. * generated/maxloc1_16_i8.c: Ditto. * generated/maxloc1_16_r10.c: Ditto. * generated/maxloc1_16_r16.c: Ditto. * generated/maxloc1_16_r4.c: Ditto. * generated/maxloc1_16_r8.c: Ditto. * generated/maxloc1_16_s1.c: Ditto. * generated/maxloc1_16_s4.c: Ditto. * generated/maxloc1_4_i1.c: Ditto. * generated/maxloc1_4_i16.c: Ditto. * generated/maxloc1_4_i2.c: Ditto. * generated/maxloc1_4_i4.c: Ditto. * generated/maxloc1_4_i8.c: Ditto. * generated/maxloc1_4_r10.c: Ditto. * generated/maxloc1_4_r16.c: Ditto. * generated/maxloc1_4_r4.c: Ditto. * generated/maxloc1_4_r8.c: Ditto. * generated/maxloc1_4_s1.c: Ditto. * generated/maxloc1_4_s4.c: Ditto. * generated/maxloc1_8_i1.c: Ditto. * generated/maxloc1_8_i16.c: Ditto. * generated/maxloc1_8_i2.c: Ditto. * generated/maxloc1_8_i4.c: Ditto. * generated/maxloc1_8_i8.c: Ditto. * generated/maxloc1_8_r10.c: Ditto. * generated/maxloc1_8_r16.c: Ditto. * generated/maxloc1_8_r4.c: Ditto. * generated/maxloc1_8_r8.c: Ditto. * generated/maxloc1_8_s1.c: Ditto. * generated/maxloc1_8_s4.c: Ditto. * generated/maxval1_s1.c: Ditto. * generated/maxval1_s4.c: Ditto. * generated/maxval_i1.c: Ditto. * generated/maxval_i16.c: Ditto. * generated/maxval_i2.c: Ditto. * generated/maxval_i4.c: Ditto. * generated/maxval_i8.c: Ditto. * generated/maxval_r10.c: Ditto. * generated/maxval_r16.c: Ditto. * generated/maxval_r4.c: Ditto. * generated/maxval_r8.c: Ditto. * generated/minloc0_16_i1.c: Ditto. * generated/minloc0_16_i16.c: Ditto. * generated/minloc0_16_i2.c: Ditto. * generated/minloc0_16_i4.c: Ditto. * generated/minloc0_16_i8.c: Ditto. * generated/minloc0_16_r10.c: Ditto. * generated/minloc0_16_r16.c: Ditto. * generated/minloc0_16_r4.c: Ditto. * generated/minloc0_16_r8.c: Ditto. * generated/minloc0_16_s1.c: Ditto. * generated/minloc0_16_s4.c: Ditto. * generated/minloc0_4_i1.c: Ditto. * generated/minloc0_4_i16.c: Ditto. * generated/minloc0_4_i2.c: Ditto. * generated/minloc0_4_i4.c: Ditto. * generated/minloc0_4_i8.c: Ditto. * generated/minloc0_4_r10.c: Ditto. * generated/minloc0_4_r16.c: Ditto. * generated/minloc0_4_r4.c: Ditto. * generated/minloc0_4_r8.c: Ditto. * generated/minloc0_4_s1.c: Ditto. * generated/minloc0_4_s4.c: Ditto. * generated/minloc0_8_i1.c: Ditto. * generated/minloc0_8_i16.c: Ditto. * generated/minloc0_8_i2.c: Ditto. * generated/minloc0_8_i4.c: Ditto. * generated/minloc0_8_i8.c: Ditto. * generated/minloc0_8_r10.c: Ditto. * generated/minloc0_8_r16.c: Ditto. * generated/minloc0_8_r4.c: Ditto. * generated/minloc0_8_r8.c: Ditto. * generated/minloc0_8_s1.c: Ditto. * generated/minloc0_8_s4.c: Ditto. * generated/minloc1_16_i1.c: Ditto. * generated/minloc1_16_i16.c: Ditto. * generated/minloc1_16_i2.c: Ditto. * generated/minloc1_16_i4.c: Ditto. * generated/minloc1_16_i8.c: Ditto. * generated/minloc1_16_r10.c: Ditto. * generated/minloc1_16_r16.c: Ditto. * generated/minloc1_16_r4.c: Ditto. * generated/minloc1_16_r8.c: Ditto. * generated/minloc1_16_s1.c: Ditto. * generated/minloc1_16_s4.c: Ditto. * generated/minloc1_4_i1.c: Ditto. * generated/minloc1_4_i16.c: Ditto. * generated/minloc1_4_i2.c: Ditto. * generated/minloc1_4_i4.c: Ditto. * generated/minloc1_4_i8.c: Ditto. * generated/minloc1_4_r10.c: Ditto. * generated/minloc1_4_r16.c: Ditto. * generated/minloc1_4_r4.c: Ditto. * generated/minloc1_4_r8.c: Ditto. * generated/minloc1_4_s1.c: Ditto. * generated/minloc1_4_s4.c: Ditto. * generated/minloc1_8_i1.c: Ditto. * generated/minloc1_8_i16.c: Ditto. * generated/minloc1_8_i2.c: Ditto. * generated/minloc1_8_i4.c: Ditto. * generated/minloc1_8_i8.c: Ditto. * generated/minloc1_8_r10.c: Ditto. * generated/minloc1_8_r16.c: Ditto. * generated/minloc1_8_r4.c: Ditto. * generated/minloc1_8_r8.c: Ditto. * generated/minloc1_8_s1.c: Ditto. * generated/minloc1_8_s4.c: Ditto. * generated/minval1_s1.c: Ditto. * generated/minval1_s4.c: Ditto. * generated/minval_i1.c: Ditto. * generated/minval_i16.c: Ditto. * generated/minval_i2.c: Ditto. * generated/minval_i4.c: Ditto. * generated/minval_i8.c: Ditto. * generated/minval_r10.c: Ditto. * generated/minval_r16.c: Ditto. * generated/minval_r4.c: Ditto. * generated/minval_r8.c: Ditto. * generated/norm2_r10.c: Ditto. * generated/norm2_r16.c: Ditto. * generated/norm2_r4.c: Ditto. * generated/norm2_r8.c: Ditto. * generated/parity_l1.c: Ditto. * generated/parity_l16.c: Ditto. * generated/parity_l2.c: Ditto. * generated/parity_l4.c: Ditto. * generated/parity_l8.c: Ditto. * generated/product_c10.c: Ditto. * generated/product_c16.c: Ditto. * generated/product_c4.c: Ditto. * generated/product_c8.c: Ditto. * generated/product_i1.c: Ditto. * generated/product_i16.c: Ditto. * generated/product_i2.c: Ditto. * generated/product_i4.c: Ditto. * generated/product_i8.c: Ditto. * generated/product_r10.c: Ditto. * generated/product_r16.c: Ditto. * generated/product_r4.c: Ditto. * generated/product_r8.c: Ditto. * generated/reshape_c10.c: Ditto. * generated/reshape_c16.c: Ditto. * generated/reshape_c4.c: Ditto. * generated/reshape_c8.c: Ditto. * generated/reshape_i16.c: Ditto. * generated/reshape_i4.c: Ditto. * generated/reshape_i8.c: Ditto. * generated/reshape_r10.c: Ditto. * generated/reshape_r16.c: Ditto. * generated/reshape_r4.c: Ditto. * generated/reshape_r8.c: Ditto. * generated/spread_c10.c: Ditto. * generated/spread_c16.c: Ditto. * generated/spread_c4.c: Ditto. * generated/spread_c8.c: Ditto. * generated/spread_i1.c: Ditto. * generated/spread_i16.c: Ditto. * generated/spread_i2.c: Ditto. * generated/spread_i4.c: Ditto. * generated/spread_i8.c: Ditto. * generated/spread_r10.c: Ditto. * generated/spread_r16.c: Ditto. * generated/spread_r4.c: Ditto. * generated/spread_r8.c: Ditto. * generated/sum_c10.c: Ditto. * generated/sum_c16.c: Ditto. * generated/sum_c4.c: Ditto. * generated/sum_c8.c: Ditto. * generated/sum_i1.c: Ditto. * generated/sum_i16.c: Ditto. * generated/sum_i2.c: Ditto. * generated/sum_i4.c: Ditto. * generated/sum_i8.c: Ditto. * generated/sum_r10.c: Ditto. * generated/sum_r16.c: Ditto. * generated/sum_r4.c: Ditto. * generated/sum_r8.c: Ditto. 2018-06-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85816 PR fortran/85975 * gfortran.dg/pr85816.f90: New test. * gfortran.dg/pr85975.f90: New test. From-SVN: r261081 |
||
Janne Blomqvist
|
dffb1e2279 |
PR 84519 Handle optional QUIET specifier for STOP and ERROR STOP
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 |
||
Janne Blomqvist
|
3f5fabc0ea |
Character length cleanup for Coarray Fortran library
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 |
||
Thomas Koenig
|
e9bfdf18cb |
libgfortran.h (GFC_ARRAY_DESCRIPTOR): Remove dimension of descriptor to use vaiable members for dim.
2018-02-12 Thomas Koenig <tkoenig@gcc.gnu.org> * libgfortran.h (GFC_ARRAY_DESCRIPTOR): Remove dimension of descriptor to use vaiable members for dim. Change usage of GFC_ARRAY_DESCRIPTOR accordingly. (GFC_FILL_ARRAY_DESCRIPTOR): New macro. (gfc_full_array_i4): New type. * intrinsics/date_and_time.c (secnds): Use sizeof (gfc_array_i4) + sizeof (descriptor_dimension) for memory allocation. * intrinsics/reshape_generic.c: Use GFC_FULL_ARRAY_DESCRIPTOR. * io/format.c: Use sizeof (gfc_array_i4) + sizeof (descriptor_dimension) for memoy allocation. * io/list_read.c (list_formatted_read_scalar): Use gfc_full_array_i4 for variable. (nml_read_obj): Likewise. * io/write.c (list_formatted_write_scalar): Likewise. (nml_write_obj): Likewise. * m4/reshape.m4: Use GFC_FULL_ARRAY_DESCRIPTOR. * generated/reshape_c10.c: Regenerated. * generated/reshape_c16.c: Regenerated. * generated/reshape_c4.c: Regenerated. * generated/reshape_c8.c: Regenerated. * generated/reshape_i16.c: Regenerated. * generated/reshape_i4.c: Regenerated. * generated/reshape_i8.c: Regenerated. * generated/reshape_r10.c: Regenerated. * generated/reshape_r16.c: Regenerated. * generated/reshape_r4.c: Regenerated. * generated/reshape_r8.c: Regenerated. From-SVN: r257601 |
||
Thomas Koenig
|
b6019ab18c |
re PR fortran/37577 ([meta-bug] change internal array descriptor format for better syntax, C interop TR, rank 15)
2018-01-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/37577 * libgfortran.h: Remove GFC_DTYPE_DERIVED_1, GFC_DTYPE_DERIVED_2, GFC_DTYPE_DERIVED_4, GFC_DTYPE_DERIVED_8 and GFC_DTYPE_DERIVED_16. * m4/cshift1.m4: Remove GFC_DTYPE_DERIVED_1. * generated/cshift1_16.c: Regenerated. * generated/cshift1_4.c: Regenerated. * generated/cshift1_8.c: Regenerated. * intrinsics/cshift0.c: Remove GFC_DTYPE_DERIVED_1. * intrinsics/pack_generic.c (pack): Move handling of other types into separate switch statement. * intrinsics/spread_generic.c (spread): Likewise. (spread_scalar): Likewise. * intrinsics/unpack_generic.c (unpack1): Likewise. (unpack0): Likewise. * runtime/in_pack_generic.c (internal_pack): Likewise. * runtime/in_unpack_generic.c (internal_unpack): Likewise. From-SVN: r257195 |
||
Paul Thomas
|
7fb43006b2 |
re PR fortran/37577 ([meta-bug] change internal array descriptor format for better syntax, C interop TR, rank 15)
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 |
||
Thomas Koenig
|
fa3c4d47b9 |
libgfortran.h (GFC_DTYPE_COPY): New macro.
2018-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> * libgfortran.h (GFC_DTYPE_COPY): New macro. (GFC_DTYPE_COPY_SETRANK): New macro. (GFC_DTYPE_IS_UNSET): New macro. * intrinsics/cshift0.c (cshift0): Use new macros. * intrinsics/eoshift0.c (eoshift0): Likewise. * intrinsics/eoshift2.c (eoshift2): Likewise. * intrinsics/move_alloc.c (move_alloc): Likewise. * intrinsics/reshape_generic.c (reshape_internal): Likewise. * intrinsics/spread_generic.c (spread_internal): Likewise. * intrinsics/spread_generic.c (spread_scalar): Likewise. * intrinsics/spread_generic.c (spread_char_scalar): Likewise. * intrinsics/spread_generic.c (spread_char4_scalar): Likewise. * intrinsics/unpack_generic.c (unpack0): Likewise. * intrinsics/unpack_generic.c (unpack0_char): Likewise. * intrinsics/unpack_generic.c (unpack0_char4): Likewise. * m4/cshift1.m4 (cshift1): Likewise. * m4/eoshift1.m4 (eoshift1): Likewise. * m4/eoshift3.m4 (eoshift3): Likewise. * m4/iforeach-s.m4: Likewise. * m4/iforeach.m4: Likewise. * m4/ifunction-s.m4: Likewise. * m4/ifunction-s2.m4: Likewise. * m4/ifunction.m4: Likewise. * m4/ifunction_logical.m4: Likewise. * m4/reshape.m4: Likewise. * m4/spread.m4: Likewise. * generated/all_l1.c : Regenerated. * generated/all_l16.c : Regenerated. * generated/all_l2.c : Regenerated. * generated/all_l4.c : Regenerated. * generated/all_l8.c : Regenerated. * generated/any_l1.c : Regenerated. * generated/any_l16.c : Regenerated. * generated/any_l2.c : Regenerated. * generated/any_l4.c : Regenerated. * generated/any_l8.c : Regenerated. * generated/count_16_l.c : Regenerated. * generated/count_1_l.c : Regenerated. * generated/count_2_l.c : Regenerated. * generated/count_4_l.c : Regenerated. * generated/count_8_l.c : Regenerated. * generated/cshift1_16.c : Regenerated. * generated/cshift1_4.c : Regenerated. * generated/cshift1_8.c : Regenerated. * generated/eoshift1_16.c : Regenerated. * generated/eoshift1_4.c : Regenerated. * generated/eoshift1_8.c : Regenerated. * generated/eoshift3_16.c : Regenerated. * generated/eoshift3_4.c : Regenerated. * generated/eoshift3_8.c : Regenerated. * generated/iall_i1.c : Regenerated. * generated/iall_i16.c : Regenerated. * generated/iall_i2.c : Regenerated. * generated/iall_i4.c : Regenerated. * generated/iall_i8.c : Regenerated. * generated/iany_i1.c : Regenerated. * generated/iany_i16.c : Regenerated. * generated/iany_i2.c : Regenerated. * generated/iany_i4.c : Regenerated. * generated/iany_i8.c : Regenerated. * generated/iparity_i1.c : Regenerated. * generated/iparity_i16.c : Regenerated. * generated/iparity_i2.c : Regenerated. * generated/iparity_i4.c : Regenerated. * generated/iparity_i8.c : Regenerated. * generated/maxloc0_16_i1.c : Regenerated. * generated/maxloc0_16_i16.c : Regenerated. * generated/maxloc0_16_i2.c : Regenerated. * generated/maxloc0_16_i4.c : Regenerated. * generated/maxloc0_16_i8.c : Regenerated. * generated/maxloc0_16_r10.c : Regenerated. * generated/maxloc0_16_r16.c : Regenerated. * generated/maxloc0_16_r4.c : Regenerated. * generated/maxloc0_16_r8.c : Regenerated. * generated/maxloc0_16_s1.c : Regenerated. * generated/maxloc0_16_s4.c : Regenerated. * generated/maxloc0_4_i1.c : Regenerated. * generated/maxloc0_4_i16.c : Regenerated. * generated/maxloc0_4_i2.c : Regenerated. * generated/maxloc0_4_i4.c : Regenerated. * generated/maxloc0_4_i8.c : Regenerated. * generated/maxloc0_4_r10.c : Regenerated. * generated/maxloc0_4_r16.c : Regenerated. * generated/maxloc0_4_r4.c : Regenerated. * generated/maxloc0_4_r8.c : Regenerated. * generated/maxloc0_4_s1.c : Regenerated. * generated/maxloc0_4_s4.c : Regenerated. * generated/maxloc0_8_i1.c : Regenerated. * generated/maxloc0_8_i16.c : Regenerated. * generated/maxloc0_8_i2.c : Regenerated. * generated/maxloc0_8_i4.c : Regenerated. * generated/maxloc0_8_i8.c : Regenerated. * generated/maxloc0_8_r10.c : Regenerated. * generated/maxloc0_8_r16.c : Regenerated. * generated/maxloc0_8_r4.c : Regenerated. * generated/maxloc0_8_r8.c : Regenerated. * generated/maxloc0_8_s1.c : Regenerated. * generated/maxloc0_8_s4.c : Regenerated. * generated/maxloc1_16_i1.c : Regenerated. * generated/maxloc1_16_i16.c : Regenerated. * generated/maxloc1_16_i2.c : Regenerated. * generated/maxloc1_16_i4.c : Regenerated. * generated/maxloc1_16_i8.c : Regenerated. * generated/maxloc1_16_r10.c : Regenerated. * generated/maxloc1_16_r16.c : Regenerated. * generated/maxloc1_16_r4.c : Regenerated. * generated/maxloc1_16_r8.c : Regenerated. * generated/maxloc1_16_s1.c : Regenerated. * generated/maxloc1_16_s4.c : Regenerated. * generated/maxloc1_4_i1.c : Regenerated. * generated/maxloc1_4_i16.c : Regenerated. * generated/maxloc1_4_i2.c : Regenerated. * generated/maxloc1_4_i4.c : Regenerated. * generated/maxloc1_4_i8.c : Regenerated. * generated/maxloc1_4_r10.c : Regenerated. * generated/maxloc1_4_r16.c : Regenerated. * generated/maxloc1_4_r4.c : Regenerated. * generated/maxloc1_4_r8.c : Regenerated. * generated/maxloc1_4_s1.c : Regenerated. * generated/maxloc1_4_s4.c : Regenerated. * generated/maxloc1_8_i1.c : Regenerated. * generated/maxloc1_8_i16.c : Regenerated. * generated/maxloc1_8_i2.c : Regenerated. * generated/maxloc1_8_i4.c : Regenerated. * generated/maxloc1_8_i8.c : Regenerated. * generated/maxloc1_8_r10.c : Regenerated. * generated/maxloc1_8_r16.c : Regenerated. * generated/maxloc1_8_r4.c : Regenerated. * generated/maxloc1_8_r8.c : Regenerated. * generated/maxloc1_8_s1.c : Regenerated. * generated/maxloc1_8_s4.c : Regenerated. * generated/maxval1_s1.c : Regenerated. * generated/maxval1_s4.c : Regenerated. * generated/maxval_i1.c : Regenerated. * generated/maxval_i16.c : Regenerated. * generated/maxval_i2.c : Regenerated. * generated/maxval_i4.c : Regenerated. * generated/maxval_i8.c : Regenerated. * generated/maxval_r10.c : Regenerated. * generated/maxval_r16.c : Regenerated. * generated/maxval_r4.c : Regenerated. * generated/maxval_r8.c : Regenerated. * generated/minloc0_16_i1.c : Regenerated. * generated/minloc0_16_i16.c : Regenerated. * generated/minloc0_16_i2.c : Regenerated. * generated/minloc0_16_i4.c : Regenerated. * generated/minloc0_16_i8.c : Regenerated. * generated/minloc0_16_r10.c : Regenerated. * generated/minloc0_16_r16.c : Regenerated. * generated/minloc0_16_r4.c : Regenerated. * generated/minloc0_16_r8.c : Regenerated. * generated/minloc0_16_s1.c : Regenerated. * generated/minloc0_16_s4.c : Regenerated. * generated/minloc0_4_i1.c : Regenerated. * generated/minloc0_4_i16.c : Regenerated. * generated/minloc0_4_i2.c : Regenerated. * generated/minloc0_4_i4.c : Regenerated. * generated/minloc0_4_i8.c : Regenerated. * generated/minloc0_4_r10.c : Regenerated. * generated/minloc0_4_r16.c : Regenerated. * generated/minloc0_4_r4.c : Regenerated. * generated/minloc0_4_r8.c : Regenerated. * generated/minloc0_4_s1.c : Regenerated. * generated/minloc0_4_s4.c : Regenerated. * generated/minloc0_8_i1.c : Regenerated. * generated/minloc0_8_i16.c : Regenerated. * generated/minloc0_8_i2.c : Regenerated. * generated/minloc0_8_i4.c : Regenerated. * generated/minloc0_8_i8.c : Regenerated. * generated/minloc0_8_r10.c : Regenerated. * generated/minloc0_8_r16.c : Regenerated. * generated/minloc0_8_r4.c : Regenerated. * generated/minloc0_8_r8.c : Regenerated. * generated/minloc0_8_s1.c : Regenerated. * generated/minloc0_8_s4.c : Regenerated. * generated/minloc1_16_i1.c : Regenerated. * generated/minloc1_16_i16.c : Regenerated. * generated/minloc1_16_i2.c : Regenerated. * generated/minloc1_16_i4.c : Regenerated. * generated/minloc1_16_i8.c : Regenerated. * generated/minloc1_16_r10.c : Regenerated. * generated/minloc1_16_r16.c : Regenerated. * generated/minloc1_16_r4.c : Regenerated. * generated/minloc1_16_r8.c : Regenerated. * generated/minloc1_16_s1.c : Regenerated. * generated/minloc1_16_s4.c : Regenerated. * generated/minloc1_4_i1.c : Regenerated. * generated/minloc1_4_i16.c : Regenerated. * generated/minloc1_4_i2.c : Regenerated. * generated/minloc1_4_i4.c : Regenerated. * generated/minloc1_4_i8.c : Regenerated. * generated/minloc1_4_r10.c : Regenerated. * generated/minloc1_4_r16.c : Regenerated. * generated/minloc1_4_r4.c : Regenerated. * generated/minloc1_4_r8.c : Regenerated. * generated/minloc1_4_s1.c : Regenerated. * generated/minloc1_4_s4.c : Regenerated. * generated/minloc1_8_i1.c : Regenerated. * generated/minloc1_8_i16.c : Regenerated. * generated/minloc1_8_i2.c : Regenerated. * generated/minloc1_8_i4.c : Regenerated. * generated/minloc1_8_i8.c : Regenerated. * generated/minloc1_8_r10.c : Regenerated. * generated/minloc1_8_r16.c : Regenerated. * generated/minloc1_8_r4.c : Regenerated. * generated/minloc1_8_r8.c : Regenerated. * generated/minloc1_8_s1.c : Regenerated. * generated/minloc1_8_s4.c : Regenerated. * generated/minval1_s1.c : Regenerated. * generated/minval1_s4.c : Regenerated. * generated/minval_i1.c : Regenerated. * generated/minval_i16.c : Regenerated. * generated/minval_i2.c : Regenerated. * generated/minval_i4.c : Regenerated. * generated/minval_i8.c : Regenerated. * generated/minval_r10.c : Regenerated. * generated/minval_r16.c : Regenerated. * generated/minval_r4.c : Regenerated. * generated/minval_r8.c : Regenerated. * generated/norm2_r10.c : Regenerated. * generated/norm2_r16.c : Regenerated. * generated/norm2_r4.c : Regenerated. * generated/norm2_r8.c : Regenerated. * generated/parity_l1.c : Regenerated. * generated/parity_l16.c : Regenerated. * generated/parity_l2.c : Regenerated. * generated/parity_l4.c : Regenerated. * generated/parity_l8.c : Regenerated. * generated/product_c10.c : Regenerated. * generated/product_c16.c : Regenerated. * generated/product_c4.c : Regenerated. * generated/product_c8.c : Regenerated. * generated/product_i1.c : Regenerated. * generated/product_i16.c : Regenerated. * generated/product_i2.c : Regenerated. * generated/product_i4.c : Regenerated. * generated/product_i8.c : Regenerated. * generated/product_r10.c : Regenerated. * generated/product_r16.c : Regenerated. * generated/product_r4.c : Regenerated. * generated/product_r8.c : Regenerated. * generated/reshape_c10.c : Regenerated. * generated/reshape_c16.c : Regenerated. * generated/reshape_c4.c : Regenerated. * generated/reshape_c8.c : Regenerated. * generated/reshape_i16.c : Regenerated. * generated/reshape_i4.c : Regenerated. * generated/reshape_i8.c : Regenerated. * generated/reshape_r10.c : Regenerated. * generated/reshape_r16.c : Regenerated. * generated/reshape_r4.c : Regenerated. * generated/reshape_r8.c : Regenerated. * generated/spread_c10.c : Regenerated. * generated/spread_c16.c : Regenerated. * generated/spread_c4.c : Regenerated. * generated/spread_c8.c : Regenerated. * generated/spread_i1.c : Regenerated. * generated/spread_i16.c : Regenerated. * generated/spread_i2.c : Regenerated. * generated/spread_i4.c : Regenerated. * generated/spread_i8.c : Regenerated. * generated/spread_r10.c : Regenerated. * generated/spread_r16.c : Regenerated. * generated/spread_r4.c : Regenerated. * generated/spread_r8.c : Regenerated. * generated/sum_c10.c : Regenerated. * generated/sum_c16.c : Regenerated. * generated/sum_c4.c : Regenerated. * generated/sum_c8.c : Regenerated. * generated/sum_i1.c : Regenerated. * generated/sum_i16.c : Regenerated. * generated/sum_i2.c : Regenerated. * generated/sum_i4.c : Regenerated. * generated/sum_i8.c : Regenerated. * generated/sum_r10.c : Regenerated. * generated/sum_r16.c : Regenerated. * generated/sum_r4.c : Regenerated. * generated/sum_r8.c : Regenerated. From-SVN: r256323 |
||
Janne Blomqvist
|
f622221ab4 |
PR 78534 Change character length from int to size_t
In order to handle large character lengths on (L)LP64 targets, switch the GFortran character length from an int to a size_t. This is an ABI change, as procedures with character arguments take hidden arguments with the character length. I also changed the _size member in vtables from int to size_t, as there were some cases where character lengths and sizes were apparently mixed up and caused regressions otherwise. Although I haven't tested, this might enable very large derived types as well. Also, as there are some places in the frontend were negative character lengths are used as special flag values, in the frontend the character length is handled as a signed variable of the same size as a size_t, although in the runtime library it really is size_t. I haven't changed the character length variables for the co-array intrinsics, as this is something that may need to be synchronized with OpenCoarrays. This is v5 of the patch. v4 was applied but caused breakage on big endian targets. These have been fixed and tested, thanks to access to the GCC compile farm. Overview of v4 of the patch: v3 was applied but had to reverted due to breaking bootstrap. The fix is in resolve.c:resolve_charlen, where it's necessary to check that an expression is constant before using mpz_sgn. Overview of v3 of the patch: All the issues pointed out by FX's review of v2 have been fixed. In particular, there are now new functions gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT instead of a long value. Similarly, gfc_get_int_expr now takes a HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by gfc_extract_hwi. Also, the preliminary work to handle gfc_charlen_type_node being unsigned has been removed. Regtested on x86_64-pc-linux-gnu, i686-pc-linux-gnu and powerpc64-unknown-linux-gnu. Also regtested all three targets by modifying gfortran-dg.exp to also test with "-g -flto", no new failures observed. frontend: 2018-01-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * array.c (got_charlen): Use gfc_charlen_int_kind. * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of hardcoded kind. (find_intrinsic_vtab): Likewise. * decl.c (match_char_length): Use gfc_charlen_int_kind. (add_init_expr_to_sym): Use gfc_charlen_t and gfc_charlen_int_kind. (gfc_match_implicit): Use gfc_charlen_int_kind. * dump-parse-tree.c (show_char_const): Use gfc_charlen_t and size_t. (show_expr): Use HOST_WIDE_INT_PRINT_DEC. * expr.c (gfc_get_character_expr): Length parameter of type gfc_charlen_t. (gfc_get_int_expr): Value argument of type HOST_WIDE_INT. (gfc_extract_hwi): New function. (simplify_const_ref): Make string_len of type gfc_charlen_t. (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs. * frontend-passes.c (optimize_trim): Use gfc_charlen_int_kind. * gfortran.h (gfc_mpz_get_hwi): New prototype. (gfc_mpz_set_hwi): Likewise. (gfc_charlen_t): New typedef. (gfc_expr): Use gfc_charlen_t for character lengths. (gfc_size_kind): New extern variable. (gfc_extract_hwi): New prototype. (gfc_get_character_expr): Use gfc_charlen_t for character length. (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument. * gfortran.texi: Update description of hidden string length argument. * iresolve.c (check_charlen_present): Use gfc_charlen_int_kind. (gfc_resolve_char_achar): Likewise. (gfc_resolve_repeat): Pass string length directly without temporary, use gfc_charlen_int_kind. (gfc_resolve_transfer): Use gfc_charlen_int_kind. * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen. * misc.c (gfc_mpz_get_hwi): New function. (gfc_mpz_set_hwi): New function. * module.c (atom_int): Change type from int to HOST_WIDE_INT. (parse_integer): Don't complain about large integers. (write_atom): Use HOST_WIDE_INT for integers. (mio_integer): Handle integer type mismatch. (mio_hwi): New function. (mio_intrinsic_op): Use HOST_WIDE_INT. (mio_array_ref): Likewise. (mio_expr): Likewise. * primary.c (match_substring): Use gfc_charlen_int_kind. * resolve.c (resolve_substring_charlen): Use gfc_charlen_int_kind. (resolve_character_operator): Likewise. (resolve_assoc_var): Likewise. (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf. (resolve_charlen): Use mpz_sgn to determine sign. * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t instead of long. * symbol.c (generate_isocbinding_symbol): Use gfc_charlen_int_kind. * target-memory.c (size_character): Length argument of type gfc_charlen_t. (gfc_encode_character): Likewise. (gfc_interpret_character): Use gfc_charlen_t. * target-memory.h (gfc_encode_character): Modify prototype. * trans-array.c (gfc_trans_array_ctor_element): Use existing type. (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type. (trans_array_constructor): Use existing type. (get_array_charlen): Likewise. * trans-const.c (gfc_conv_mpz_to_tree_type): New function. * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype. * trans-decl.c (gfc_trans_deferred_vars): Use existing type. (add_argument_checking): Likewise. * trans-expr.c (gfc_class_len_or_zero_get): Build const of type gfc_charlen_type_node. (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of 4, fold_convert to correct type. (gfc_conv_class_to_class): Build const of type size_type_node for size. (gfc_copy_class_to_class): Likewise. (gfc_conv_string_length): Use same type in expression. (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen. (gfc_conv_string_tmp): Make sure len is of the right type. (gfc_conv_concat_op): Use same type in expression. (gfc_conv_procedure_call): Likewise. (fill_with_spaces): Comment out memset() block due to spurious -Wstringop-overflow warnings. (gfc_trans_string_copy): Use gfc_charlen_type_node. (alloc_scalar_allocatable_for_subcomponent_assignment): fold_convert to right type. (gfc_trans_subcomponent_assign): Likewise. (trans_class_vptr_len_assignment): Build const of correct type. (gfc_trans_pointer_assignment): Likewise. (alloc_scalar_allocatable_for_assignment): fold_convert to right type in expr. (trans_class_assignment): Build const of correct type. * trans-intrinsic.c (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_repeat): Do calculation in sizetype. * trans-io.c (gfc_build_io_library_fndecls): Use gfc_charlen_type_node for character lengths. (set_string): Convert to right type in assignment. * trans-stmt.c (gfc_trans_label_assign): Build const of gfc_charlen_type_node. (trans_associate_var): Likewise. (gfc_trans_character_select): Likewise. (gfc_trans_allocate): Likewise, don't typecast strlen result. (gfc_trans_deallocate): Don't typecast strlen result. * trans-types.c (gfc_size_kind): New variable. (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind from size_type_node. * trans-types.h: Fix comment. testsuite: 2018-01-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * gfortran.dg/char_cast_1.f90: Update scan pattern. * gfortran.dg/dependency_49.f90: Likewise. * gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T. * gfortran.dg/repeat_7.f90: New test for PR 66310. * gfortran.dg/scan_2.f90: Handle potential cast in assignment. * gfortran.dg/string_1.f90: Limit to ilp32 targets. * gfortran.dg/string_1_lp64.f90: New test. * gfortran.dg/string_3.f90: Limit to ilp32 targets. * gfortran.dg/string_3_lp64.f90: New test. libgfortran: 2019-01-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 * intrinsics/args.c (getarg_i4): Use gfc_charlen_type. (get_command_argument_i4): Likewise. (get_command_i4): Likewise. * intrinsics/chmod.c (chmod_internal): Likewise. * intrinsics/env.c (get_environment_variable_i4): Likewise. * intrinsics/extends_type_of.c (struct vtype): Use size_t for size member. * intrinsics/gerror.c (gerror): Use gfc_charlen_type. * intrinsics/getlog.c (getlog): Likewise. * intrinsics/hostnm.c (hostnm_0): Likewise. * intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to work if gfc_charlen_type is unsigned. (string_scan): Likewise. * io/transfer.c (transfer_character): Modify prototype. (transfer_character_write): Likewise. (transfer_character_wide): Likewise. (transfer_character_wide_write): Likewise. (transfer_array): Typecast to avoid signed-unsigned comparison. * io/unit.c (is_trim_ok): Use gfc_charlen_type. * io/write.c (namelist_write): Likewise. * libgfortran.h (gfc_charlen_type): Change typedef to size_t. From-SVN: r256284 |
||
Jakub Jelinek
|
85ec4feb11 |
Update copyright years.
From-SVN: r256169 |
||
Janne Blomqvist
|
67c24a8bd6 |
PR 53796 Improve INQUIRE(RECL=...) handling
The current F2018 draft (N2137) specifies behavior of the RECL= specifier in the INQUIRE statement, where it previously was left as undefined. Namely: - If the unit is not connected, RECL= should be given the value -1. - If the unit is connected with stream access, RECL= should be given the value -2. Further, as PR 53796 describes, the handling of RECL= is poor in other ways as well. When the recl is set to the maximum possible (GFC_INTEGER_8_HUGE / LLONG_MAX), which it does by default except for preconnected units, and when INQUIRE(RECL=) is used with a 4 byte integer, the value is truncated and the 4 byte value is thus -1. Fixing this to generate an error is a lot of work, as currently the truncation is done by the frontend, the library sees only an 8 byte value with no indication that the frontend is going to copy it to a 4 byte one. Instead, this patch does a bit twiddling trick such that the truncated 4 byte value is GFC_INTEGER_4_HUGE while still being 0.99999999 * GFC_INTEGER_8_HUGE which is large enough for all practical purposes. Finally, the patch removes GFORTRAN_DEFAULT_RECL which was used only for preconnected units, and instead uses the same approach as describe above. Regtested on x86_64-pc-linux-gnu, Ok for trunk. gcc/fortran/ChangeLog: 2017-11-28 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * gfortran.texi: Remove mentions of GFORTRAN_DEFAULT_RECL. libgfortran/ChangeLog: 2017-11-28 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * io/inquire.c (inquire_via_unit): Set recl to -1 for unconnected units. * io/io.h (default_recl): New variable. * io/open.c (new_unit): Set recl to default_recl for sequential, -2 for stream access. * io/transfer.c (read_block_form): Test against default_recl instead of DEFAULT_RECL. (write_block): Likewise. * io/unit.c (init_units): Calculate max_offset, default_recl. * libgfortran.h (DEFAULT_RECL): Remove. * runtime/environ.c: Remove GFORTRAN_DEFAULT_RECL. gcc/testsuite/ChangeLog: 2017-11-28 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * gfortran.dg/inquire_recl_f2018.f90: New test. From-SVN: r255215 |
||
Janne Blomqvist
|
5675291ddb |
PR 83097 Use __BYTE_ORDER__ predefined macro instead of runtime check
By using the __BYTE_ORDER__ predefined macro we don't need the determine_endianness function anymore. Regtested on x86_64-pc-linux-gnu. libgfortran/ChangeLog: 2017-11-22 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/83097 * io/inquire.c (inquire_via_unit): Use __BYTE_ORDER__ predefined macro. * io/open.c (st_open): Likewise. * io/transfer.c (data_transfer_init): Likewise. * io/write.c (btoa_big): Likewise. (otoa_big): Likewise. (ztoa_big): Likewise. * libgfortran.h (big_endian): Remove variable. (GFOR_POINTER_TO_L1): Use __BYTE_ORDER__ macro. * runtime/main.c (determine_endianness): Remove function. (init): Remove call to determine_endianness. * runtime/minimal.c: Remove setting big_endian variable. From-SVN: r255072 |
||
Thomas Koenig
|
ddc9995b13 |
re PR fortran/36313 ([F03] {MIN,MAX}{LOC,VAL} should accept character arguments)
2017-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36313 * Makefile.am: Add i_maxloc0s_c, i_maxloc1s_c, i_maxloc2s_c, i_minloc0s_c, i_minloc1s_c and i_minloc2s_c. * Makefile.in: Regenerated. * generated/maxloc0_16_s1.c: New file. * generated/maxloc0_16_s4.c: New file. * generated/maxloc0_4_s1.c: New file. * generated/maxloc0_4_s4.c: New file. * generated/maxloc0_8_s1.c: New file. * generated/maxloc0_8_s4.c: New file. * generated/maxloc1_16_s1.c: New file. * generated/maxloc1_16_s4.c: New file. * generated/maxloc1_4_s1.c: New file. * generated/maxloc1_4_s4.c: New file. * generated/maxloc1_8_s1.c: New file. * generated/maxloc1_8_s4.c: New file. * generated/maxloc2_16_s1.c: New file. * generated/maxloc2_16_s4.c: New file. * generated/maxloc2_4_s1.c: New file. * generated/maxloc2_4_s4.c: New file. * generated/maxloc2_8_s1.c: New file. * generated/maxloc2_8_s4.c: New file. * generated/minloc0_16_s1.c: New file. * generated/minloc0_16_s4.c: New file. * generated/minloc0_4_s1.c: New file. * generated/minloc0_4_s4.c: New file. * generated/minloc0_8_s1.c: New file. * generated/minloc0_8_s4.c: New file. * generated/minloc1_16_s1.c: New file. * generated/minloc1_16_s4.c: New file. * generated/minloc1_4_s1.c: New file. * generated/minloc1_4_s4.c: New file. * generated/minloc1_8_s1.c: New file. * generated/minloc1_8_s4.c: New file. * generated/minloc2_16_s1.c: New file. * generated/minloc2_16_s4.c: New file. * generated/minloc2_4_s1.c: New file. * generated/minloc2_4_s4.c: New file. * generated/minloc2_8_s1.c: New file. * generated/minloc2_8_s4.c: New file. * m4/iforeach-s.m4: New file. * m4/ifunction-s.m4: New file. * m4/maxloc0s.m4: New file. * m4/maxloc1s.m4: New file. * m4/maxloc2s.m4: New file. * m4/minloc0s.m4: New file. * m4/minloc1s.m4: New file. * m4/minloc2s.m4: New file. * gfortran.map: Add new functions. * libgfortran.h: Add gfc_array_s1 and gfc_array_s4. 2017-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36313 * check.c (int_or_real_or_char_check_f2003): New function. * iresolve.c (gfc_resolve_maxloc): Add number "2" for character arguments and rank-zero return value. (gfc_resolve_minloc): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Handle case of character arguments and rank-zero return value by removing unneeded arguments and calling the library function. 2017-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36313 * gfortran.dg/maxloc_string_1.f90: New test. * gfortran.dg/minloc_string_1.f90: New test. From-SVN: r255070 |
||
Paul Thomas
|
ff3598bc73 |
re PR fortran/34640 (ICE when assigning item of a derived-component to a pointer)
2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 PR fortran/40737 PR fortran/55763 PR fortran/57019 PR fortran/57116 * expr.c (is_subref_array): Add class pointer array dummies to the list of expressions that return true. * trans-array.c: Add SPAN_FIELD and update indices for subsequent fields. (gfc_conv_descriptor_span, gfc_conv_descriptor_span_get, gfc_conv_descriptor_span_set, is_pointer_array, get_array_span): New functions. (gfc_get_descriptor_offsets_for_info): New function to preserve API for access to descriptor fields for trans-types.c. (gfc_conv_scalarized_array_ref): If the expression is a subref array, make sure that info->descriptor is a descriptor type. Otherwise, if info->descriptor is a pointer array, set 'decl' and fix it if it is a component reference. (build_array_ref): Simplify handling of class array refs by passing the vptr to gfc_build_array_ref rather than generating the pointer arithmetic in this function. (gfc_conv_array_ref): As in gfc_conv_scalarized_array_ref, set 'decl'. (gfc_array_allocate): Set the span field if this is a pointer array. Use the expr3 element size if it is available, so that the dynamic type element size is used. (gfc_conv_expr_descriptor): Set the span field for pointer assignments. * trans-array.h: Prototypes for gfc_conv_descriptor_span_get gfc_conv_descriptor_span_set and gfc_get_descriptor_offsets_for_info added. trans-decl.c (gfc_get_symbol_decl): If a non-class pointer array, mark the declaration as a GFC_DECL_PTR_ARRAY_P. Remove the setting of GFC_DECL_SPAN. (gfc_trans_deferred_vars): Set the span field to zero in thge originating scope. * trans-expr.c (gfc_conv_procedure_call): Do not use copy-in/ copy-out to pass subref expressions to a pointer dummy. (gfc_trans_pointer_assignment): Remove code for setting of GFC_DECL_SPAN. Set the 'span' field for non-class pointers to class function results. Likewise for rank remap. In the case that the target is not a whole array, use the target array ref for remap and, since the 'start' indices are missing, set the lbounds to one, as required by the standard. * trans-intrinsic.c (conv_expr_ref_to_caf_ref): Pick up the 'token' offset from the field decl in the descriptor. (conv_isocbinding_subroutine): Set the 'span' field. * trans-io.c (gfc_trans_transfer): Always scalarize pointer array io. * trans-stmt.c (trans_associate_var): Set the 'span' field. * trans-types.c (gfc_get_array_descriptor_base): Add the 'span' field to the array descriptor. (gfc_get_derived_type): Pointer array components are marked as GFC_DECL_PTR_ARRAY_P. (gfc_get_array_descr_info): Replaced API breaking code for descriptor offset calling gfc_get_descriptor_offsets_for_info. * trans.c (get_array_span): New function. (gfc_build_array_ref): Simplify by calling get_array_span and obtain 'span' if 'decl' or 'vptr' present. * trans.h : Rename DECL_LANG_FLAG_6, GFC_DECL_SUBREF_ARRAY_P, as GFC_DECL_PTR_ARRAY_P. 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 * gfortran.dg/associate_24.f90: New test. * gfortran.dg/assumed_type_2.f90: Adjust some of the tree dump checks. * gfortran.dg/no_arg_check_2.f90: Likewise. * gfortran.dg/pointer_array_1.f90: New test. * gfortran.dg/pointer_array_2.f90: New test. * gfortran.dg/pointer_array_7.f90: New test. * gfortran.dg/pointer_array_8.f90: New test. * gfortran.dg/pointer_array_component_1.f90: New test. * gfortran.dg/pointer_array_component_2.f90: New test. * gfortran.dg/goacc/kernels-alias-4.f95: Bump up both tree scan counts by 1. PR fortran/40737 * gfortran.dg/pointer_array_3.f90: New test. PR fortran/57116 * gfortran.dg/pointer_array_4.f90: New test. PR fortran/55763 * gfortran.dg/pointer_array_5.f90: New test. PR fortran/57019 * gfortran.dg/pointer_array_6.f90: New test. 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 * libgfortran/libgfortran.h: Add span field to descriptor. * libgfortran/libtool-version : Bump up version number to 5:0:0. From-SVN: r251949 |
||
Thomas Koenig
|
e56e3fda60 |
re PR fortran/52473 (CSHIFT slow - inline it?)
2017-06-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52473 * Makefile.am: Add i_cshift1a_c. Add rules to generate files from cshift1a.m4. * Makefile.in: Regenerated. * m4/cshift1a.m4: New file. * m4/cshift.m4 (cshift1): Split up inner loop by removing condition. Use memcpy where possible. Call helper functions based on dtype. * libgfortran.h: Add prototypes for cshift1_16_c10, cshift1_16_c16, cshift1_16_c4, cshift1_16_c8, cshift1_16_i1, cshift1_16_i16, cshift1_16_i2, cshift1_16_i4, cshift1_16_i8, cshift1_16_r10, cshift1_16_r16, cshift1_16_r4, cshift1_16_r8, cshift1_4_c10, cshift1_4_c16, cshift1_4_c4, cshift1_4_c8, cshift1_4_i1, cshift1_4_i16, cshift1_4_i2, cshift1_4_i4, cshift1_4_i8, cshift1_4_r10, cshift1_4_r16, cshift1_4_r4, cshift1_4_r8, cshift1_8_c10, cshift1_8_c16, cshift1_8_c4, cshift1_8_c8, cshift1_8_i1, cshift1_8_i16, cshift1_8_i2, cshift1_8_i4, cshift1_8_i8, cshift1_8_r10, cshift1_8_r16, cshift1_8_r4 and cshift1_8_r8. * generated/cshift1_16_c10.c: New file, generated from cshift1a.m4. * generated/cshift1_16_c16.c: New file, generated from cshift1a.m4. * generated/cshift1_16_c4.c: New file, generated from cshift1a.m4. * generated/cshift1_16_c8.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i1.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i16.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i2.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i4.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i8.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r10.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r16.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r4.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r8.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c10.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c16.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c4.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c8.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i1.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i16.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i2.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i4.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i8.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r10.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r16.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r4.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r8.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c10.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c16.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c4.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c8.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i1.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i16.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i2.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i4.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i8.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r10.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r16.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r4.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r8.c: New file, generated from cshift1a.m4. 2017-06-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52473 * gfortran.dg/cshift_2.f90: New test. From-SVN: r249620 |
||
Janne Blomqvist
|
d86e68e207 |
Don't assume __secure_getenv is available
Glibc 2.17 made __secure_getenv an officially supported function, and renamed it secure_getenv. The libgfortran configure has checked for both of these, per https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv. Unfortunately, while the dynamical library (libc.so) retains the __secure_getenv symbol for backwards compatibility, the static library (libc.a) does not. This means that a libgfortran.a compiled against an older glibc will not work if one tries to link against a newer libc.a. This creates problems for providing gfortran binary distributions that work on as many target systems as possible. Thus, retain the support for __secure_getenv but call it only via a weak reference. Regtested on x86_64-pc-linux-gnu. 2017-05-11 Janne Blomqvist <jb@gcc.gnu.org> * libgfortran.h: HAVE_SECURE_GETENV: Don't check HAVE___SECURE_GETENV. * environ/runtime.c (secure_getenv): Use __secure_getenv via a weak reference. From-SVN: r247927 |
||
Thomas Koenig
|
20305b5047 |
re PR libfortran/79956 (many new -Wmaybe-uninitialized warnings with bootstrap-O3)
2017-03-15 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/79956 * libgfortran.h (GFC_ASSERT): New macro. * m4/reshape.m4 (reshape_'rtype_ccode`): Use GFC_ASSERT to specify that sdim > 0 and rdim > 0. * intrinsic/reshape_generic.c (reshape_internal): Likweise. * generated/reshape_c10.c: Regenerated. * generated/reshape_c16.c: Regenerated. * generated/reshape_c4.c: Regenerated. * generated/reshape_c8.c: Regenerated. * generated/reshape_i16.c: Regenerated. * generated/reshape_i4.c: Regenerated. * generated/reshape_i8.c: Regenerated. * generated/reshape_r10.c: Regenerated. * generated/reshape_r16.c: Regenerated. * generated/reshape_r4.c: Regenerated. * generated/reshape_r8.c: Regenerated. From-SVN: r246153 |
||
Janne Blomqvist
|
c1e9bbcc49 |
Revert r244448
From-SVN: r244454 |
||
Janne Blomqvist
|
a6ab4e077b |
PR 78534 Change character length from int to size_t
In order to handle large character lengths on (L)LP64 targets, switch the GFortran character length from an int to a size_t. This is an ABI change, as procedures with character arguments take hidden arguments with the character length. I also changed the _size member in vtables from int to size_t, as there were some cases where character lengths and sizes were apparently mixed up and caused regressions otherwise. Although I haven't tested, this might enable very large derived types as well. Also, as there are some places in the frontend were negative character lengths are used as special flag values, in the frontend the character length is handled as a signed variable of the same size as a size_t, although in the runtime library it really is size_t. I haven't changed the character length variables for the co-array intrinsics, as this is something that may need to be synchronized with OpenCoarrays. This is v4 of the patch. v3 was applied but had to reverted due to breaking bootstrap. The fix is in resolve.c:resolve_charlen, where it's necessary to check that an expression is constant before using mpz_sgn. Overview of v3 of the patch: All the issues pointed out by FX's review of v2 have been fixed. In particular, there are now new functions gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT instead of a long value. Similarly, gfc_get_int_expr now takes a HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by gfc_extract_hwi. Also, the preliminary work to handle gfc_charlen_type_node being unsigned has been removed. Regtested on x86_64-pc-linux-gnu and i686-pc-linux-gnu. frontend: 2017-01-13 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of hardcoded kind. (find_intrinsic_vtab): Likewise. * expr.c (gfc_get_character_expr): Length parameter of type gfc_charlen_t. (gfc_get_int_expr): Value argument of type HOST_WIDE_INT. (gfc_extract_hwi): New function. (simplify_const_ref): Make string_len of type gfc_charlen_t. (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs. * gfortran.h (gfc_mpz_get_hwi): New prototype. (gfc_mpz_set_hwi): Likewise. (gfc_charlen_t): New typedef. (gfc_expr): Use gfc_charlen_t for character lengths. (gfc_size_kind): New extern variable. (gfc_extract_hwi): New prototype. (gfc_get_character_expr): Use gfc_charlen_t for character length. (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument. * iresolve.c (gfc_resolve_repeat): Pass string length directly without temporary, use gfc_charlen_int_kind. * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen. * misc.c (gfc_mpz_get_hwi): New function. (gfc_mpz_set_hwi): New function. * module.c (atom_int): Change type from int to HOST_WIDE_INT. (parse_integer): Don't complain about large integers. (write_atom): Use HOST_WIDE_INT for integers. (mio_integer): Handle integer type mismatch. (mio_hwi): New function. (mio_intrinsic_op): Use HOST_WIDE_INT. (mio_array_ref): Likewise. (mio_expr): Likewise. * resolve.c (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf. (resolve_substring_charlen): Use gfc_charlen_int_kind. (resolve_charlen): Use mpz_sgn to determine sign. * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t instead of long. * target-memory.c (size_character): Length argument of type gfc_charlen_t. (gfc_encode_character): Likewise. (gfc_interpret_character): Use gfc_charlen_t. * target-memory.h (gfc_encode_character): Modify prototype. * trans-array.c (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type. * trans-const.c (gfc_conv_mpz_to_tree_type): New function. * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype. * trans-expr.c (gfc_class_len_or_zero_get): Build const of type gfc_charlen_type_node. (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of 4, fold_convert to correct type. (gfc_conv_class_to_class): Build const of type size_type_node for size. (gfc_copy_class_to_class): Likewise. (gfc_conv_string_length): Use same type in expression. (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen. (gfc_conv_string_tmp): Make sure len is of the right type. (gfc_conv_concat_op): Use same type in expression. (gfc_conv_procedure_call): Likewise. (alloc_scalar_allocatable_for_subcomponent_assignment): fold_convert to right type. (gfc_trans_subcomponent_assign): Likewise. (trans_class_vptr_len_assignment): Build const of correct type. (gfc_trans_pointer_assignment): Likewise. (alloc_scalar_allocatable_for_assignment): fold_convert to right type in expr. (trans_class_assignment): Build const of correct type. * trans-intrinsic.c (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_repeat): Do calculation in sizetype. * trans-io.c (gfc_build_io_library_fndecls): Use gfc_charlen_type_node for character lengths. * trans-stmt.c (gfc_trans_label_assign): Build const of gfc_charlen_type_node. (gfc_trans_character_select): Likewise. (gfc_trans_allocate): Likewise, don't typecast strlen result. (gfc_trans_deallocate): Don't typecast strlen result. * trans-types.c (gfc_size_kind): New variable. (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind from size_type_node. testsuite: 2017-01-13 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T. * gfortran.dg/repeat_7.f90: New test for PR 66310. * gfortran.dg/scan_2.f90: Handle potential cast in assignment. * gfortran.dg/string_1.f90: Limit to ilp32 targets. * gfortran.dg/string_1_lp64.f90: New test. * gfortran.dg/string_3.f90: Limit to ilp32 targets. * gfortran.dg/string_3_lp64.f90: New test. libgfortran: 2017-01-13 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 * intrinsics/args.c (getarg_i4): Use gfc_charlen_type. (get_command_argument_i4): Likewise. (get_command_i4): Likewise. * intrinsics/chmod.c (chmod_internal): Likewise. * intrinsics/env.c (get_environment_variable_i4): Likewise. * intrinsics/extends_type_of.c (struct vtype): Use size_t for size member. * intrinsics/gerror.c (gerror): Use gfc_charlen_type. * intrinsics/getlog.c (getlog): Likewise. * intrinsics/hostnm.c (hostnm_0): Likewise. * intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to work if gfc_charlen_type is unsigned. (string_scan): Likewise. * io/transfer.c (transfer_character): Modify prototype. (transfer_character_write): Likewise. (transfer_character_wide): Likewise. (transfer_character_wide_write): Likewise. (transfer_array): Typecast to avoid signed-unsigned comparison. * io/unit.c (is_trim_ok): Use gfc_charlen_type. * io/write.c (namelist_write): Likewise. * libgfortran.h (gfc_charlen_type): Change typedef to size_t. From-SVN: r244448 |
||
Janne Blomqvist
|
84aff3c2d4 |
PR 78534 Revert r244011
r244011 caused regressions on 32-bit hosts. From-SVN: r244027 |
||
Janne Blomqvist
|
994e4aca2c |
PR 78534 Change character length from int to size_t
In order to handle large character lengths on (L)LP64 targets, switch the GFortran character length from an int to a size_t. This is an ABI change, as procedures with character arguments take hidden arguments with the character length. I also changed the _size member in vtables from int to size_t, as there were some cases where character lengths and sizes were apparently mixed up and caused regressions otherwise. Although I haven't tested, this might enable very large derived types as well. Also, as there are some places in the frontend were negative character lengths are used as special flag values, in the frontend the character length is handled as a signed variable of the same size as a size_t, although in the runtime library it really is size_t. I haven't changed the character length variables for the co-array intrinsics, as this is something that may need to be synchronized with OpenCoarrays. This is v3 of the patch. All the issues pointed out by FX's review of v2 have been fixed. In particular, there are now new functions gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT instead of a long value. Similarly, gfc_get_int_expr now takes a HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by gfc_extract_hwi. Also, the preliminary work to handle gfc_charlen_type_node being unsigned has been removed. Regtested on x86_64-pc-linux-gnu. frontend: 2017-01-03 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of hardcoded kind. (find_intrinsic_vtab): Likewise. * expr.c (gfc_get_character_expr): Length parameter of type gfc_charlen_t. (gfc_get_int_expr): Value argument of type HOST_WIDE_INT. (gfc_extract_hwi): New function. (simplify_const_ref): Make string_len of type gfc_charlen_t. (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs. * gfortran.h (gfc_mpz_get_hwi): New prototype. (gfc_mpz_set_hwi): Likewise. (gfc_charlen_t): New typedef. (gfc_expr): Use gfc_charlen_t for character lengths. (gfc_size_kind): New extern variable. (gfc_extract_hwi): New prototype. (gfc_get_character_expr): Use gfc_charlen_t for character length. (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument. * iresolve.c (gfc_resolve_repeat): Pass string length directly without temporary, use gfc_charlen_int_kind. * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen. * misc.c (gfc_mpz_get_hwi): New function. (gfc_mpz_set_hwi): New function. * module.c (atom_int): Change type from int to HOST_WIDE_INT. (parse_integer): Don't complain about large integers. (write_atom): Use HOST_WIDE_INT for integers. (mio_integer): Handle integer type mismatch. (mio_hwi): New function. (mio_intrinsic_op): Use HOST_WIDE_INT. (mio_array_ref): Likewise. (mio_expr): Likewise. * resolve.c (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf. (resolve_charlen): Use mpz_sgn to determine sign. * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t instead of long. * target-memory.c (size_character): Length argument of type gfc_charlen_t. (gfc_encode_character): Likewise. (gfc_interpret_character): Use gfc_charlen_t. * target-memory.h (gfc_encode_character): Modify prototype. * trans-array.c (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type. * trans-const.c (gfc_conv_mpz_to_tree_type): New function. * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype. * trans-expr.c (gfc_class_len_or_zero_get): Build const of type gfc_charlen_type_node. (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of 4, fold_convert to correct type. (gfc_conv_class_to_class): Build const of type size_type_node for size. (gfc_copy_class_to_class): Likewise. (gfc_conv_string_length): Use same type in expression. (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen. (gfc_conv_string_tmp): Make sure len is of the right type. (gfc_conv_concat_op): Use same type in expression. (gfc_conv_procedure_call): Likewise. (alloc_scalar_allocatable_for_subcomponent_assignment): fold_convert to right type. (gfc_trans_subcomponent_assign): Likewise. (trans_class_vptr_len_assignment): Build const of correct type. (gfc_trans_pointer_assignment): Likewise. (alloc_scalar_allocatable_for_assignment): fold_convert to right type in expr. (trans_class_assignment): Build const of correct type. * trans-intrinsic.c (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_repeat): Do calculation in sizetype. * trans-io.c (gfc_build_io_library_fndecls): Use gfc_charlen_type_node for character lengths. * trans-stmt.c (gfc_trans_label_assign): Build const of gfc_charlen_type_node. (gfc_trans_character_select): Likewise. (gfc_trans_allocate): Likewise, don't typecast strlen result. (gfc_trans_deallocate): Don't typecast strlen result. * trans-types.c (gfc_size_kind): New variable. (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind from size_type_node. testsuite: 2017-01-03 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * gfortran.dg/dependency_49.f90: Change scan-tree-dump-times due to gfc_trans_string_copy change to avoid -Wstringop-overflow. * gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T. * gfortran.dg/repeat_7.f90: New test for PR 66310. * gfortran.dg/scan_2.f90: Handle potential cast in assignment. * gfortran.dg/string_1.f90: Limit to ilp32 targets. * gfortran.dg/string_1_lp64.f90: New test. * gfortran.dg/string_3.f90: Limit to ilp32 targets. * gfortran.dg/string_3_lp64.f90: New test. * gfortran.dg/transfer_intrinsic_1.f90: Change scan-tree-dump-times due to gfc_trans_string_copy change to avoid -Wstringop-overflow. libgfortran: 2017-01-03 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 * intrinsics/args.c (getarg_i4): Use gfc_charlen_type. (get_command_argument_i4): Likewise. (get_command_i4): Likewise. * intrinsics/chmod.c (chmod_internal): Likewise. * intrinsics/env.c (get_environment_variable_i4): Likewise. * intrinsics/extends_type_of.c (struct vtype): Use size_t for size member. * intrinsics/gerror.c (gerror): Use gfc_charlen_type. * intrinsics/getlog.c (getlog): Likewise. * intrinsics/hostnm.c (hostnm_0): Likewise. * intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to work if gfc_charlen_type is unsigned. (string_scan): Likewise. * io/transfer.c (transfer_character): Modify prototype. (transfer_character_write): Likewise. (transfer_character_wide): Likewise. (transfer_character_wide_write): Likewise. (transfer_array): Typecast to avoid signed-unsigned comparison. * io/unit.c (is_trim_ok): Use gfc_charlen_type. * io/write.c (namelist_write): Likewise. * libgfortran.h (gfc_charlen_type): Change typedef to size_t. From-SVN: r244011 |
||
Jakub Jelinek
|
cbe34bb5ed |
Update copyright years.
From-SVN: r243994 |
||
Francois-Xavier Coudert
|
887d9b8b6d |
libgfortran.h: Include <stdlib.h> header.
* libgfortran.h: Include <stdlib.h> header. * intrinsics/access.c: Do not include <stdlib.h> header. * intrinsics/chdir.c: Do not include <stdlib.h> header. * intrinsics/chmod.c: Do not include <stdlib.h> header. * intrinsics/date_and_time.c: Do not include <stdlib.h> header. * intrinsics/env.c: Do not include <stdlib.h> header. * intrinsics/execute_command_line.c: Do not include <stdlib.h> header. * intrinsics/exit.c: Do not include <stdlib.h> header. * intrinsics/getcwd.c: Do not include <stdlib.h> header. * intrinsics/getlog.c: Do not include <stdlib.h> header. * intrinsics/link.c: Do not include <stdlib.h> header. * intrinsics/move_alloc.c: Do not include <stdlib.h> header. * intrinsics/perror.c: Do not include <stdlib.h> header. * intrinsics/random.c: Do not include <stdlib.h> header. * intrinsics/rename.c: Do not include <stdlib.h> header. * intrinsics/reshape_generic.c: Do not include <stdlib.h> header. * intrinsics/stat.c: Do not include <stdlib.h> header. * intrinsics/symlnk.c: Do not include <stdlib.h> header. * intrinsics/system.c: Do not include <stdlib.h> header. * intrinsics/unlink.c: Do not include <stdlib.h> header. * io/fbuf.c: Do not include <stdlib.h> header. * io/format.c: Do not include <stdlib.h> header. * io/intrinsics.c: Do not include <stdlib.h> header. * io/list_read.c: Do not include <stdlib.h> header. * io/lock.c: Do not include <stdlib.h> header. * io/open.c: Do not include <stdlib.h> header. * io/read.c: Do not include <stdlib.h> header. * io/transfer.c: Do not include <stdlib.h> header. * io/unit.c: Do not include <stdlib.h> header. * io/unix.c: Do not include <stdlib.h> header. * io/write.c: Do not include <stdlib.h> header. * m4/all.m4: Do not include <stdlib.h> header. * m4/any.m4: Do not include <stdlib.h> header. * m4/bessel.m4: Do not include <stdlib.h> header. * m4/count.m4: Do not include <stdlib.h> header. * m4/cshift0.m4: Do not include <stdlib.h> header. * m4/cshift1.m4: Do not include <stdlib.h> header. * m4/eoshift1.m4: Do not include <stdlib.h> header. * m4/eoshift3.m4: Do not include <stdlib.h> header. * m4/iall.m4: Do not include <stdlib.h> header. * m4/iany.m4: Do not include <stdlib.h> header. * m4/in_pack.m4: Do not include <stdlib.h> header. * m4/in_unpack.m4: Do not include <stdlib.h> header. * m4/iparity.m4: Do not include <stdlib.h> header. * m4/matmul.m4: Do not include <stdlib.h> header. * m4/matmull.m4: Do not include <stdlib.h> header. * m4/maxloc0.m4: Do not include <stdlib.h> header. * m4/maxloc1.m4: Do not include <stdlib.h> header. * m4/maxval.m4: Do not include <stdlib.h> header. * m4/minloc0.m4: Do not include <stdlib.h> header. * m4/minloc1.m4: Do not include <stdlib.h> header. * m4/minval.m4: Do not include <stdlib.h> header. * m4/norm2.m4: Do not include <stdlib.h> header. * m4/pack.m4: Do not include <stdlib.h> header. * m4/parity.m4: Do not include <stdlib.h> header. * m4/product.m4: Do not include <stdlib.h> header. * m4/reshape.m4: Do not include <stdlib.h> header. * m4/shape.m4: Do not include <stdlib.h> header. * m4/spread.m4: Do not include <stdlib.h> header. * m4/sum.m4: Do not include <stdlib.h> header. * m4/unpack.m4: Do not include <stdlib.h> header. * runtime/environ.c: Do not include <stdlib.h> header. * runtime/error.c: Do not include <stdlib.h> header. * runtime/memory.c: Do not include <stdlib.h> header. * runtime/minimal.c: Do not include <stdlib.h> header. * runtime/string.c: Do not include <stdlib.h> header. * generated/all_l1.c: Regenerate. * generated/all_l16.c: Regenerate. * generated/all_l2.c: Regenerate. * generated/all_l4.c: Regenerate. * generated/all_l8.c: Regenerate. * generated/any_l1.c: Regenerate. * generated/any_l16.c: Regenerate. * generated/any_l2.c: Regenerate. * generated/any_l4.c: Regenerate. * generated/any_l8.c: Regenerate. * generated/bessel_r10.c: Regenerate. * generated/bessel_r16.c: Regenerate. * generated/bessel_r4.c: Regenerate. * generated/bessel_r8.c: Regenerate. * generated/count_16_l.c: Regenerate. * generated/count_1_l.c: Regenerate. * generated/count_2_l.c: Regenerate. * generated/count_4_l.c: Regenerate. * generated/count_8_l.c: Regenerate. * generated/cshift0_c10.c: Regenerate. * generated/cshift0_c16.c: Regenerate. * generated/cshift0_c4.c: Regenerate. * generated/cshift0_c8.c: Regenerate. * generated/cshift0_i1.c: Regenerate. * generated/cshift0_i16.c: Regenerate. * generated/cshift0_i2.c: Regenerate. * generated/cshift0_i4.c: Regenerate. * generated/cshift0_i8.c: Regenerate. * generated/cshift0_r10.c: Regenerate. * generated/cshift0_r16.c: Regenerate. * generated/cshift0_r4.c: Regenerate. * generated/cshift0_r8.c: Regenerate. * generated/cshift1_16.c: Regenerate. * generated/cshift1_4.c: Regenerate. * generated/cshift1_8.c: Regenerate. * generated/eoshift1_16.c: Regenerate. * generated/eoshift1_4.c: Regenerate. * generated/eoshift1_8.c: Regenerate. * generated/eoshift3_16.c: Regenerate. * generated/eoshift3_4.c: Regenerate. * generated/eoshift3_8.c: Regenerate. * generated/iall_i1.c: Regenerate. * generated/iall_i16.c: Regenerate. * generated/iall_i2.c: Regenerate. * generated/iall_i4.c: Regenerate. * generated/iall_i8.c: Regenerate. * generated/iany_i1.c: Regenerate. * generated/iany_i16.c: Regenerate. * generated/iany_i2.c: Regenerate. * generated/iany_i4.c: Regenerate. * generated/iany_i8.c: Regenerate. * generated/in_pack_c10.c: Regenerate. * generated/in_pack_c16.c: Regenerate. * generated/in_pack_c4.c: Regenerate. * generated/in_pack_c8.c: Regenerate. * generated/in_pack_i1.c: Regenerate. * generated/in_pack_i16.c: Regenerate. * generated/in_pack_i2.c: Regenerate. * generated/in_pack_i4.c: Regenerate. * generated/in_pack_i8.c: Regenerate. * generated/in_pack_r10.c: Regenerate. * generated/in_pack_r16.c: Regenerate. * generated/in_pack_r4.c: Regenerate. * generated/in_pack_r8.c: Regenerate. * generated/in_unpack_c10.c: Regenerate. * generated/in_unpack_c16.c: Regenerate. * generated/in_unpack_c4.c: Regenerate. * generated/in_unpack_c8.c: Regenerate. * generated/in_unpack_i1.c: Regenerate. * generated/in_unpack_i16.c: Regenerate. * generated/in_unpack_i2.c: Regenerate. * generated/in_unpack_i4.c: Regenerate. * generated/in_unpack_i8.c: Regenerate. * generated/in_unpack_r10.c: Regenerate. * generated/in_unpack_r16.c: Regenerate. * generated/in_unpack_r4.c: Regenerate. * generated/in_unpack_r8.c: Regenerate. * generated/iparity_i1.c: Regenerate. * generated/iparity_i16.c: Regenerate. * generated/iparity_i2.c: Regenerate. * generated/iparity_i4.c: Regenerate. * generated/iparity_i8.c: Regenerate. * generated/matmul_c10.c: Regenerate. * generated/matmul_c16.c: Regenerate. * generated/matmul_c4.c: Regenerate. * generated/matmul_c8.c: Regenerate. * generated/matmul_i1.c: Regenerate. * generated/matmul_i16.c: Regenerate. * generated/matmul_i2.c: Regenerate. * generated/matmul_i4.c: Regenerate. * generated/matmul_i8.c: Regenerate. * generated/matmul_l16.c: Regenerate. * generated/matmul_l4.c: Regenerate. * generated/matmul_l8.c: Regenerate. * generated/matmul_r10.c: Regenerate. * generated/matmul_r16.c: Regenerate. * generated/matmul_r4.c: Regenerate. * generated/matmul_r8.c: Regenerate. * generated/maxloc0_16_i1.c: Regenerate. * generated/maxloc0_16_i16.c: Regenerate. * generated/maxloc0_16_i2.c: Regenerate. * generated/maxloc0_16_i4.c: Regenerate. * generated/maxloc0_16_i8.c: Regenerate. * generated/maxloc0_16_r10.c: Regenerate. * generated/maxloc0_16_r16.c: Regenerate. * generated/maxloc0_16_r4.c: Regenerate. * generated/maxloc0_16_r8.c: Regenerate. * generated/maxloc0_4_i1.c: Regenerate. * generated/maxloc0_4_i16.c: Regenerate. * generated/maxloc0_4_i2.c: Regenerate. * generated/maxloc0_4_i4.c: Regenerate. * generated/maxloc0_4_i8.c: Regenerate. * generated/maxloc0_4_r10.c: Regenerate. * generated/maxloc0_4_r16.c: Regenerate. * generated/maxloc0_4_r4.c: Regenerate. * generated/maxloc0_4_r8.c: Regenerate. * generated/maxloc0_8_i1.c: Regenerate. * generated/maxloc0_8_i16.c: Regenerate. * generated/maxloc0_8_i2.c: Regenerate. * generated/maxloc0_8_i4.c: Regenerate. * generated/maxloc0_8_i8.c: Regenerate. * generated/maxloc0_8_r10.c: Regenerate. * generated/maxloc0_8_r16.c: Regenerate. * generated/maxloc0_8_r4.c: Regenerate. * generated/maxloc0_8_r8.c: Regenerate. * generated/maxloc1_16_i1.c: Regenerate. * generated/maxloc1_16_i16.c: Regenerate. * generated/maxloc1_16_i2.c: Regenerate. * generated/maxloc1_16_i4.c: Regenerate. * generated/maxloc1_16_i8.c: Regenerate. * generated/maxloc1_16_r10.c: Regenerate. * generated/maxloc1_16_r16.c: Regenerate. * generated/maxloc1_16_r4.c: Regenerate. * generated/maxloc1_16_r8.c: Regenerate. * generated/maxloc1_4_i1.c: Regenerate. * generated/maxloc1_4_i16.c: Regenerate. * generated/maxloc1_4_i2.c: Regenerate. * generated/maxloc1_4_i4.c: Regenerate. * generated/maxloc1_4_i8.c: Regenerate. * generated/maxloc1_4_r10.c: Regenerate. * generated/maxloc1_4_r16.c: Regenerate. * generated/maxloc1_4_r4.c: Regenerate. * generated/maxloc1_4_r8.c: Regenerate. * generated/maxloc1_8_i1.c: Regenerate. * generated/maxloc1_8_i16.c: Regenerate. * generated/maxloc1_8_i2.c: Regenerate. * generated/maxloc1_8_i4.c: Regenerate. * generated/maxloc1_8_i8.c: Regenerate. * generated/maxloc1_8_r10.c: Regenerate. * generated/maxloc1_8_r16.c: Regenerate. * generated/maxloc1_8_r4.c: Regenerate. * generated/maxloc1_8_r8.c: Regenerate. * generated/maxval_i1.c: Regenerate. * generated/maxval_i16.c: Regenerate. * generated/maxval_i2.c: Regenerate. * generated/maxval_i4.c: Regenerate. * generated/maxval_i8.c: Regenerate. * generated/maxval_r10.c: Regenerate. * generated/maxval_r16.c: Regenerate. * generated/maxval_r4.c: Regenerate. * generated/maxval_r8.c: Regenerate. * generated/minloc0_16_i1.c: Regenerate. * generated/minloc0_16_i16.c: Regenerate. * generated/minloc0_16_i2.c: Regenerate. * generated/minloc0_16_i4.c: Regenerate. * generated/minloc0_16_i8.c: Regenerate. * generated/minloc0_16_r10.c: Regenerate. * generated/minloc0_16_r16.c: Regenerate. * generated/minloc0_16_r4.c: Regenerate. * generated/minloc0_16_r8.c: Regenerate. * generated/minloc0_4_i1.c: Regenerate. * generated/minloc0_4_i16.c: Regenerate. * generated/minloc0_4_i2.c: Regenerate. * generated/minloc0_4_i4.c: Regenerate. * generated/minloc0_4_i8.c: Regenerate. * generated/minloc0_4_r10.c: Regenerate. * generated/minloc0_4_r16.c: Regenerate. * generated/minloc0_4_r4.c: Regenerate. * generated/minloc0_4_r8.c: Regenerate. * generated/minloc0_8_i1.c: Regenerate. * generated/minloc0_8_i16.c: Regenerate. * generated/minloc0_8_i2.c: Regenerate. * generated/minloc0_8_i4.c: Regenerate. * generated/minloc0_8_i8.c: Regenerate. * generated/minloc0_8_r10.c: Regenerate. * generated/minloc0_8_r16.c: Regenerate. * generated/minloc0_8_r4.c: Regenerate. * generated/minloc0_8_r8.c: Regenerate. * generated/minloc1_16_i1.c: Regenerate. * generated/minloc1_16_i16.c: Regenerate. * generated/minloc1_16_i2.c: Regenerate. * generated/minloc1_16_i4.c: Regenerate. * generated/minloc1_16_i8.c: Regenerate. * generated/minloc1_16_r10.c: Regenerate. * generated/minloc1_16_r16.c: Regenerate. * generated/minloc1_16_r4.c: Regenerate. * generated/minloc1_16_r8.c: Regenerate. * generated/minloc1_4_i1.c: Regenerate. * generated/minloc1_4_i16.c: Regenerate. * generated/minloc1_4_i2.c: Regenerate. * generated/minloc1_4_i4.c: Regenerate. * generated/minloc1_4_i8.c: Regenerate. * generated/minloc1_4_r10.c: Regenerate. * generated/minloc1_4_r16.c: Regenerate. * generated/minloc1_4_r4.c: Regenerate. * generated/minloc1_4_r8.c: Regenerate. * generated/minloc1_8_i1.c: Regenerate. * generated/minloc1_8_i16.c: Regenerate. * generated/minloc1_8_i2.c: Regenerate. * generated/minloc1_8_i4.c: Regenerate. * generated/minloc1_8_i8.c: Regenerate. * generated/minloc1_8_r10.c: Regenerate. * generated/minloc1_8_r16.c: Regenerate. * generated/minloc1_8_r4.c: Regenerate. * generated/minloc1_8_r8.c: Regenerate. * generated/minval_i1.c: Regenerate. * generated/minval_i16.c: Regenerate. * generated/minval_i2.c: Regenerate. * generated/minval_i4.c: Regenerate. * generated/minval_i8.c: Regenerate. * generated/minval_r10.c: Regenerate. * generated/minval_r16.c: Regenerate. * generated/minval_r4.c: Regenerate. * generated/minval_r8.c: Regenerate. * generated/norm2_r10.c: Regenerate. * generated/norm2_r16.c: Regenerate. * generated/norm2_r4.c: Regenerate. * generated/norm2_r8.c: Regenerate. * generated/pack_c10.c: Regenerate. * generated/pack_c16.c: Regenerate. * generated/pack_c4.c: Regenerate. * generated/pack_c8.c: Regenerate. * generated/pack_i1.c: Regenerate. * generated/pack_i16.c: Regenerate. * generated/pack_i2.c: Regenerate. * generated/pack_i4.c: Regenerate. * generated/pack_i8.c: Regenerate. * generated/pack_r10.c: Regenerate. * generated/pack_r16.c: Regenerate. * generated/pack_r4.c: Regenerate. * generated/pack_r8.c: Regenerate. * generated/parity_l1.c: Regenerate. * generated/parity_l16.c: Regenerate. * generated/parity_l2.c: Regenerate. * generated/parity_l4.c: Regenerate. * generated/parity_l8.c: Regenerate. * generated/product_c10.c: Regenerate. * generated/product_c16.c: Regenerate. * generated/product_c4.c: Regenerate. * generated/product_c8.c: Regenerate. * generated/product_i1.c: Regenerate. * generated/product_i16.c: Regenerate. * generated/product_i2.c: Regenerate. * generated/product_i4.c: Regenerate. * generated/product_i8.c: Regenerate. * generated/product_r10.c: Regenerate. * generated/product_r16.c: Regenerate. * generated/product_r4.c: Regenerate. * generated/product_r8.c: Regenerate. * generated/reshape_c10.c: Regenerate. * generated/reshape_c16.c: Regenerate. * generated/reshape_c4.c: Regenerate. * generated/reshape_c8.c: Regenerate. * generated/reshape_i16.c: Regenerate. * generated/reshape_i4.c: Regenerate. * generated/reshape_i8.c: Regenerate. * generated/reshape_r10.c: Regenerate. * generated/reshape_r16.c: Regenerate. * generated/reshape_r4.c: Regenerate. * generated/reshape_r8.c: Regenerate. * generated/shape_i1.c: Regenerate. * generated/shape_i16.c: Regenerate. * generated/shape_i2.c: Regenerate. * generated/shape_i4.c: Regenerate. * generated/shape_i8.c: Regenerate. * generated/spread_c10.c: Regenerate. * generated/spread_c16.c: Regenerate. * generated/spread_c4.c: Regenerate. * generated/spread_c8.c: Regenerate. * generated/spread_i1.c: Regenerate. * generated/spread_i16.c: Regenerate. * generated/spread_i2.c: Regenerate. * generated/spread_i4.c: Regenerate. * generated/spread_i8.c: Regenerate. * generated/spread_r10.c: Regenerate. * generated/spread_r16.c: Regenerate. * generated/spread_r4.c: Regenerate. * generated/spread_r8.c: Regenerate. * generated/sum_c10.c: Regenerate. * generated/sum_c16.c: Regenerate. * generated/sum_c4.c: Regenerate. * generated/sum_c8.c: Regenerate. * generated/sum_i1.c: Regenerate. * generated/sum_i16.c: Regenerate. * generated/sum_i2.c: Regenerate. * generated/sum_i4.c: Regenerate. * generated/sum_i8.c: Regenerate. * generated/sum_r10.c: Regenerate. * generated/sum_r16.c: Regenerate. * generated/sum_r4.c: Regenerate. * generated/sum_r8.c: Regenerate. * generated/unpack_c10.c: Regenerate. * generated/unpack_c16.c: Regenerate. * generated/unpack_c4.c: Regenerate. * generated/unpack_c8.c: Regenerate. * generated/unpack_i1.c: Regenerate. * generated/unpack_i16.c: Regenerate. * generated/unpack_i2.c: Regenerate. * generated/unpack_i4.c: Regenerate. * generated/unpack_i8.c: Regenerate. * generated/unpack_r10.c: Regenerate. * generated/unpack_r16.c: Regenerate. * generated/unpack_r4.c: Regenerate. * generated/unpack_r8.c: Regenerate. From-SVN: r243846 |
||
Janne Blomqvist
|
7e294024ad |
Remove unused libgfortran functions
Now that the libgfortran ABI major version has been bumped, we can remove functions for which the frontend nowadays generates inline code. This removes the malloc, free, exponent, fraction, nearest, rrspacing, spacing, set_exponent and transpose intrinsics. Also the unused store_exe_path function is removed. 2016-12-19 Janne Blomqvist <jb@gcc.gnu.org> * Makefile.am: Remove exponent, fraction, nearest, rrspacing, set_exponent, spacing, transpose, malloc, transpose_generic. * Makefile.in: Regenerate. * generated/exponent_r10.c: Remove. * generated/exponent_r16.c: Remove. * generated/exponent_r4.c: Remove. * generated/exponent_r8.c: Remove. * generated/fraction_r10.c: Remove. * generated/fraction_r16.c: Remove. * generated/fraction_r4.c: Remove. * generated/fraction_r8.c: Remove. * generated/nearest_r10.c: Remove. * generated/nearest_r16.c: Remove. * generated/nearest_r4.c: Remove. * generated/nearest_r8.c: Remove. * generated/rrspacing_r10.c: Remove. * generated/rrspacing_r16.c: Remove. * generated/rrspacing_r4.c: Remove. * generated/rrspacing_r8.c: Remove. * generated/set_exponent_r10.c: Remove. * generated/set_exponent_r16.c: Remove. * generated/set_exponent_r4.c: Remove. * generated/set_exponent_r8.c: Remove. * generated/spacing_r10.c: Remove. * generated/spacing_r16.c: Remove. * generated/spacing_r4.c: Remove. * generated/spacing_r8.c: Remove. * generated/transpose_c10.c: Remove. * generated/transpose_c16.c: Remove. * generated/transpose_c4.c: Remove. * generated/transpose_c8.c: Remove. * generated/transpose_i16.c: Remove. * generated/transpose_i4.c: Remove. * generated/transpose_i8.c: Remove. * generated/transpose_r10.c: Remove. * generated/transpose_r16.c: Remove. * generated/transpose_r4.c: Remove. * generated/transpose_r8.c: Remove. * gfortran.map: Remove exponent, fraction, nearest, rrspacing, set_exponent, spacing, transpose, malloc, free, transpose_generic, store_exe_path. * intrinsics/malloc.c: Remove. * intrinsics/transpose_generic.c: Remove. * libgfortran.h (store_exe_path): Remove. * m4/exponent.m4: Remove. * m4/fraction.m4: Remove. * m4/nearest.m4: Remove. * m4/rrspacing.m4: Remove. * m4/set_exponent.m4: Remove. * m4/spacing.m4: Remove. * m4/transpose.m4: Remove. * runtime/main.c (store_exe_path): Remove. From-SVN: r243799 |
||
Fritz Reese
|
0ef33d4462 |
New I/O specifiers CARRIAGECONTROL, READONLY, SHARE with -fdec.
gcc/fortran/ * gfortran.texi: Document. * frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL. * io.c (gfc_free_open, gfc_resolve_open, gfc_match_open): Ditto. * gfortran.h (gfc_open): Add SHARE, CARRIAGECONTROL, and READONLY. * io.c (io_tag, match_open_element): Ditto. * ioparm.def: Ditto. * trans-io.c (gfc_trans_open): Ditto. * io.c (match_dec_etag, match_dec_ftag): New functions. libgfortran/io/ * libgfortran.h (IOPARM_OPEN_HAS_READONLY, IOPARM_OPEN_HAS_SHARE, IOPARM_OPEN_HAS_CC): New for READONLY, SHARE, and CARRIAGECONTROL. * close.c (st_close): Support READONLY. * io.h (st_parameter_open, unit_flags): Support SHARE, CARRIAGECONTROL, and READONLY. * open.c (st_open): Ditto. * transfer.c (data_transfer_init): Ditto. * io.h (st_parameter_dt): New member 'cc' for CARRIAGECONTROL. * write.c (write_check_cc, write_cc): New functions for CARRIAGECONTROL. * transfer.c (next_record_cc): Ditto. * file_pos.c (st_endfile): Support SHARE and CARRIAGECONTROL. * io.h (st_parameter_inquire): Ditto. * open.c (edit_modes, new_unit): Ditto. * inquire.c (inquire_via_unit, inquire_via_filename): Ditto. * io.h (unit_share, unit_cc, cc_fortran, IOPARM_INQUIRE_HAS_SHARE, IOPARM_INQUIRE_HAS_CC): New for SHARE and CARRIAGECONTROL. * open.c (share_opt, cc_opt): Ditto. * read.c (read_x): Support CARRIAGECONTROL. * transfer.c (read_sf, next_record_r, next_record_w): Ditto. * write.c (list_formatted_write_scalar, write_a): Ditto. * unix.h (close_share): New prototype. * unix.c (open_share, close_share): New functions to handle SHARE. * unix.c (open_external): Handle READONLY. Call open_share. * close.c (st_close): Call close_share. gcc/testsuite/ * dec_io_1.f90: New test. * dec_io_2.f90: New test. * dec_io_3.f90: New test. * dec_io_4.f90: New test. * dec_io_5.f90: New test. * dec_io_6.f90: New test. From-SVN: r241550 |
||
Jakub Jelinek
|
818ab71a41 |
Update copyright years.
From-SVN: r232055 |
||
Janne Blomqvist
|
71cda9cac8 |
PR 53379 Print backtrace on error termination.
2015-09-05 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53379 * libgfortran.h (exit_error): New prototype. * runtime/error.c (exit_error): New function. (os_error): Call exit_error instead of exit. (runtime_error): Likewise. (runtime_error_at): Likewise. (internal_error): Likewise. (generate_error): Likewise. (notify_std): Likewise. * runtime/stop.c (error_stop_string): Likewise. (error_stop_numeric): Likewise. From-SVN: r227503 |
||
Janne Blomqvist
|
1b0b9fcb92 |
PR 67414 Better diagnostics on backtrace failure, gf_strerror bugfix
2015-09-02 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/67414 * io/write.c (gfc_itoa): Move to runtime/string.c. * libgfortran.h (show_backtrace): Make arg bool. (gfc_itoa): New prototype. * runtime/backtrace.c (struct mystate): Change type of try_simple field, add in_signal_handler field. (error_callback): Print out error number, or if not in a signal handler, the error message. (show_backtrace): Change type of arg, change initialization of struct mystate. (backtrace): Call show_backtrace with correct arg type. * runtime/compile_options.c (backtrace_handler): Call with correct arg type. * runtime/error.c (sys_abort): Likewise. (gf_strerror): Handle newlocale() failure. * runtime/string.c (gfc_itoa): Function moved here from io/write.c. From-SVN: r227404 |
||
Francois-Xavier Coudert
|
485adf79b5 |
libgfortran.h (show_variables): Remove prototype.
* libgfortran.h (show_variables): Remove prototype. * runtime/environ.c (print_spaces, var_source, show_integer, show_boolean, show_sep, show_string): Remove functions. * runtime/main.c (init): Remove dead code. From-SVN: r227208 |
||
Francois-Xavier Coudert
|
a139f28147 |
* libgfortran.h (check_buffered): Remove unused prototype.
From-SVN: r227174 |
||
Francois-Xavier Coudert
|
ad4f95e395 |
re PR libfortran/54572 (Use libbacktrace library)
PR libfortran/54572 * Makefile.def: Make libgfortran depend on libbacktrace. * Makefile.in: Regenerate. * config-lang.in: Add libbacktrace to target_libs. * Makefile.am (libgfortran_la_LDFLAGS): Link in libbacktrace. (AM_CPPFLAGS): Add libbacktrace directories to include paths. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Remove checks for strtok_r, wait, execve, pipe, and dup2. Remove call to GCC_CHECK_UNWIND_GETIPINFO. * libgfortran.h (full_exe_path, find_addr2line, backtrace): Remove prototypes. (show_backtrace): Add prototype. * runtime/backtrace.c: Rework file entirely. * runtime/compile_options.c (backtrace_handler): Rename backtrace to show_backtrace. (maybe_find_addr2line): Remove function. (set_options): Remove call to maybe_find_addr2line. * runtime/error.c (sys_abort): Rename backtrace to show_backtrace. * runtime/main.c (store_exe_path): Empty function body. (full_exe_path, gfstrtok_r, find_addr2line): Remove functions. (cleanup): Don't free removed variables. * runtime/minimal.c (full_exe_path): Remove function. (set_args): Don't set exe_path. * gfortran.dg/backtrace_1.f90: New test. From-SVN: r227106 |
||
Uros Bizjak
|
c276d6055e |
re PR libfortran/66650 (libgfortran: warning: left shift of negative value [-Wshift-negative-value])
PR libgfortran/66650 * libgfortran.h (GFC_DTYPE_SIZE_MASK): Rewrite to avoid "left shift of negative value" warning. From-SVN: r226355 |
||
Jakub Jelinek
|
5624e564d2 |
Update copyright years.
From-SVN: r219188 |
||
Janne Blomqvist
|
581d232670 |
PR 60324 Unbounded stack allocations in libgfortran.
2014-11-13 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/60324 * configure: Regenerated. * configure.ac (AM_CFLAGS): Add Werror=vla. * libgfortran.h (gfc_alloca): Remove macro. (fc_strdup_notrim): New prototype. * intrinsics/access.c (access_func): Use fc_strdup rather than stack allocation. * intrinsics/chdir.c (chdir_i4_sub): Likewise. (chdir_i8_sub): Likewise. * intrinsics/chmod.c (chmod_internal): New function, move logic here. (chmod_func): Call chmod_internal. * intrinsics/env.c (getenv): Use fc_strdup rather than stack allocation. (get_environment_variable_i4): Likewise. * intrinsics/execute_command_line.c (execute_command_line): Likewise. * intrinsics/hostnm.c (hostnm_0): New function, use static buffer rather than VLA. (hostnm_i4_sub): Call hostnm_0. (hostnm_i8_sub): Likewise. (hostnm): Likewise. * intrinsics/link.c (link_internal): New function, use fc_strdup rather than stack allocation. (link_i4_sub): Call link_internal. (link_i8_sub): Likewise. (link_i4): Likewise. (link_i8): Likewise. * intrinsics/perror.c (perror_sub): Use fc_strdup rather than stack allocation. * intrinsics/random.c (random_seed_i4): Use static buffer rather than VLA, use _Static_assert to make sure it's big enough. * intrinsics/rename.c (rename_internal): New function, use fc_strdup rather than stack allocation. (rename_i4_sub): Call rename_internal. (rename_i8_sub): Likewise. (rename_i4): Likewise. (rename_i8): Likewise. * intrinsics/stat.c (stat_i4_sub_0): Use fc_strdup rather than stack allocation. (stat_i8_sub_0): Likewise. * intrinsics/symlink.c (symlnk_internal): New function, use fc_strdup rather than stack allocation. (symlnk_i4_sub): Call symlnk_internal. (symlnk_i8_sub): Likewise. (symlnk_i4): Likewise. (symlnk_i8): Likewise. * intrinsics/system.c (system_sub): Use fc_strdup rather than stack allocation. * intrinsics/unlink.c (unlink_i4_sub): Likewise. * io/file_pos.c (READ_CHUNK): Make it a macro rather than variable. * io/list_read.c (nml_get_obj_data): Use fixed stack buffer, fall back to xmalloc/free for large sizes. * io/read.c (read_f): Likewise. * io/transfer.c (MAX_READ): Make it a macro rather than variable. (WRITE_CHUNK): Likewise. * io/write_float.def (write_float): Use fixed stack buffer, fall back to xmalloc/free for large sizes. * runtime/string.c (fc_strdup_notrim): New function. From-SVN: r217480 |