aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
AgeCommit message (Collapse)AuthorFilesLines
2021-09-14Daily bump.GCC Administrator1-0/+6
2021-09-13libgfortran: Handle m68k extended real format in ISO_Fortran_binding.hAndreas Schwab1-0/+7
libgfortran/ * ISO_Fortran_binding.h (CFI_type_long_double) (CFI_type_long_double_Complex) [LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16382 && LDBL_MAX_EXP == 16384]: Define.
2021-09-08Daily bump.GCC Administrator1-0/+20
2021-09-07libgfortran: Makefile fix for ISO_Fortran_binding.hTobias Burnus2-12/+8
libgfortran/ChangeLog: * Makefile.am (gfor_built_src): Depend on include/ISO_Fortran_binding.h not on ISO_Fortran_binding.h. (ISO_Fortran_binding.h): Rename make target to ... (include/ISO_Fortran_binding.h): ... this. * Makefile.in: Regenerate.
2021-09-06Fortran: Revert to non-multilib-specific ISO_Fortran_binding.hSandra Loosemore6-86/+87
Commit fef67987cf502fe322e92ddce22eea7ac46b4d75 changed the libgfortran build process to generate multilib-specific versions of ISO_Fortran_binding.h from a template, by running gfortran to identify the values of the Fortran kind constants C_LONG_DOUBLE, C_FLOAT128, and C_INT128_T. This caused multiple problems with search paths, both for build-tree testing and installed-tree use, not all of which have been fixed. This patch reverts to a non-multilib-specific .h file that uses GCC's predefined preprocessor symbols to detect the supported types and map them to kind values in the same way as the Fortran front end. 2021-09-06 Sandra Loosemore <sandra@codesourcery.com> libgfortran/ * ISO_Fortran_binding-1-tmpl.h: Deleted. * ISO_Fortran_binding-2-tmpl.h: Deleted. * ISO_Fortran_binding-3-tmpl.h: Deleted. * ISO_Fortran_binding.h: New file to replace the above. * Makefile.am (gfor_cdir): Remove MULTISUBDIR. (ISO_Fortran_binding.h): Simplify to just copy the file. * Makefile.in: Regenerated. * mk-kinds-h.sh: Revert pieces no longer needed for ISO_Fortran_binding.h.
2021-09-03Daily bump.GCC Administrator1-0/+16
2021-09-02libgfortran: Further fixes for GFC/CFI descriptor conversions.Sandra Loosemore2-27/+103
This patch is for: PR100907 - Bind(c): failure handling wide character PR100911 - Bind(c): failure handling C_PTR PR100914 - Bind(c): errors handling complex PR100915 - Bind(c): failure handling C_FUNPTR PR100917 - Bind(c): errors handling long double real All of these problems are related to the GFC descriptors constructed by the Fortran front end containing ambigous or incomplete information. This patch does not attempt to change the GFC data structure or the front end, and only makes the runtime interpret it in more reasonable ways. It's not a complete fix for any of the listed issues. The Fortran front end does not distinguish between C_PTR and C_FUNPTR, mapping both onto BT_VOID. That is what this patch does also. The other bugs are related to GFC descriptors only containing elem_len and not kind. For complex types, the elem_len needs to be divided by 2 and then mapped onto a real kind. On x86 targets, the kind corresponding to C long double is different than its elem_len; since we cannot accurately disambiguate between a 16-byte kind 10 long double from __float128, this patch arbitrarily prefers to interpret that as the standard long double type rather than the GNU extension. Similarly, for character types, the GFC descriptor cannot distinguish between character(kind=c_char, len=4) and character(kind=ucs4, len=1). But since the front end currently rejects anything other than len=1 (PR92482) this patch uses the latter interpretation. 2021-09-01 Sandra Loosemore <sandra@codesourcery.com> José Rui Faustino de Sousa <jrfsousa@gmail.com> gcc/testsuite/ PR fortran/100911 PR fortran/100915 PR fortran/100916 * gfortran.dg/PR100911.c: New file. * gfortran.dg/PR100911.f90: New file. * gfortran.dg/PR100914.c: New file. * gfortran.dg/PR100914.f90: New file. * gfortran.dg/PR100915.c: New file. * gfortran.dg/PR100915.f90: New file. libgfortran/ PR fortran/100907 PR fortran/100911 PR fortran/100914 PR fortran/100915 PR fortran/100917 * ISO_Fortran_binding-1-tmpl.h (CFI_type_cfunptr): Make equivalent to CFI_type_cptr. * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Fix handling of CFI_type_cptr and CFI_type_cfunptr. Additional error checking and code cleanup. (gfc_desc_to_cfi_desc): Likewise. Also correct kind mapping for character, complex, and long double types.
2021-08-28Daily bump.GCC Administrator1-0/+8
2021-08-27libgfortran: Use the libtool macro to determine libm availability.Iain Sandoe5-5/+149
We recently had a report of build failure against a Darwin branch on the latest OS release. This was because (temporarily) the symlink from libm.dylib => libSystem.dylib had been removed/omitted. libm is not needed on Darwin, and should not be added unconditionally even if that is (mostly) harmless since it is a symlink to libc. There could be cases where the addition was not completely harmless because the presentation of the symlink would cause the symbols exposed in libSystem to be considered ahead of ones presented in convenience libraries. libgfortran/ChangeLog: * Makefile.am: Use configured libm availability. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Use libtool macro to find libm availability. * libgfortran.spec.in: Use configured libm availability.
2021-08-11Daily bump.GCC Administrator1-0/+10
2021-08-10gfortran: Fix in-build-tree testing [PR101305, PR101660]Tobias Burnus2-1/+18
ISO_Fortran_binding.h is written in the build dir - hence, a previous commit added it as include directory for in-build-tree testing. However, it turned out that -I$specdir/libgfortran interferes with reading .mod files as they are then no longer regareded as intrinsic modules. Solution: Create an extra include/ directory in the libgfortran build dir and copy ISO_Fortran_binding.h to that directory. As -B$specdir/libgfortran already causes gfortran to read that include subdirectory, the -I flag is no longer needed. PR libfortran/101305 PR fortran/101660 PR testsuite/101847 libgfortran/ChangeLog: * Makefile.am (ISO_Fortran_binding.h): Create include/ in the build dir and copy the include file to it. (clean-local): Add for removing the 'include' directory. * Makefile.in: Regenerate. gcc/testsuite/ChangeLog: * lib/gfortran.exp (gfortran_init): Remove -I$specpath/libgfortran from the string used to set GFORTRAN_UNDER_TEST.
2021-07-29Daily bump.GCC Administrator1-0/+43
2021-07-27Bind(c): Improve error checking in CFI_* functionsSandra Loosemore1-116/+168
This patch adds additional run-time checking for invalid arguments to CFI_establish and CFI_setpointer. It also changes existing messages throughout the CFI_* functions to use PRIiPTR to format CFI_index_t values instead of casting them to int and using %d (which may not work on targets where int is a smaller type), simplifies wording of some messages, and fixes issues with capitalization, typos, and the like. Additionally some coding standards problems such as >80 character lines are addressed. 2021-07-24 Sandra Loosemore <sandra@codesourcery.com> PR libfortran/101317 libgfortran/ * runtime/ISO_Fortran_binding.c: Include <inttypes.h>. (CFI_address): Tidy error messages and comments. (CFI_allocate): Likewise. (CFI_deallocate): Likewise. (CFI_establish): Likewise. Add new checks for validity of elem_len when it's used, plus type argument and extents. (CFI_is_contiguous): Tidy error messages and comments. (CFI_section): Likewise. Refactor some repetitive code to make it more understandable. (CFI_select_part): Likewise. (CFI_setpointer): Likewise. Check that source is not an unallocated allocatable array or an assumed-size array. gcc/testsuite/ * gfortran.dg/ISO_Fortran_binding_17.f90: Fix typo in error message patterns.
2021-07-27Bind(c): Fix bugs in CFI_sectionSandra Loosemore1-17/+10
CFI_section was incorrectly adjusting the base pointer for the result array twice in different ways. It was also overwriting the array dimension info in the result descriptor before computing the base address offset from the source descriptor, which caused problems if the two descriptors are the same. This patch fixes both problems and makes the code simpler, too. A consequence of this patch is that the result array is now 0-based in all dimensions instead of starting at the numbering to match the first element of the source array. The Fortran standard only specifies the shape of the result array, not its lower bounds, so this is permitted and probably less confusing for users as well as implementors. 2021-07-17 Sandra Loosemore <sandra@codesourcery.com> PR libfortran/101310 libgfortran/ * runtime/ISO_Fortran_binding.c (CFI_section): Fix the base address computation and simplify the code. gcc/testsuite/ * gfortran.dg/ISO_Fortran_binding_1.c (section_c): Remove incorrect assertions.
2021-07-27Bind(C): Correct sizes of some types in CFI_establishSandra Loosemore1-9/+10
CFI_establish was failing to set the default elem_len correctly for CFI_type_cptr, CFI_type_cfunptr, CFI_type_long_double, and CFI_type_long_double_Complex. 2021-07-13 Sandra Loosemore <sandra@codesourcery.com> libgfortran/ PR libfortran/101305 * runtime/ISO_Fortran_binding.c (CFI_establish): Special-case CFI_type_cptr and CFI_type_cfunptr. Correct size of long double on targets where it has kind 10.
2021-07-27Bind(C): Fix type encodings in ISO_Fortran_binding.hSandra Loosemore7-51/+128
ISO_Fortran_binding.h had many incorrect hardwired kind encodings in the definitions of the CFI_type_* macros. Additionally, not all targets support all the defined type encodings, and the Fortran standard requires those macros to have a negative value. This patch changes ISO_Fortran_binding.h to use sizeof instead of hard-coded sizes, and assembles it from fragments that reflect the set of types supported by the target. 2021-07-22 Sandra Loosemore <sandra@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> libgfortran/ PR libfortran/101305 * ISO_Fortran_binding.h: Fix hard-coded sizes and split into... * ISO_Fortran_binding-1-tmpl.h: New file. * ISO_Fortran_binding-2-tmpl.h: New file. * ISO_Fortran_binding-3-tmpl.h: New file. * Makefile.am: Add rule for generating ISO_Fortran_binding.h. Adjust pathnames to that file. * Makefile.in: Regenerated. * mk-kinds-h.sh: New file. * runtime/ISO_Fortran_binding.c: Fix include path.
2021-07-27Daily bump.GCC Administrator1-0/+12
2021-07-26PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor handlingTobias Burnus1-8/+48
Fortran: Fix attributes and bounds in ISO_Fortran_binding. 2021-07-26 José Rui Faustino de Sousa <jrfsousa@gmail.com> Tobias Burnus <tobias@codesourcery.com> PR fortran/93308 PR fortran/93963 PR fortran/94327 PR fortran/94331 PR fortran/97046 gcc/fortran/ChangeLog: * trans-decl.c (convert_CFI_desc): Only copy out the descriptor if necessary. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Updated attribute handling which reflect a previous intermediate version of the standard. Only copy out the descriptor if necessary. libgfortran/ChangeLog: * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Add code to verify the descriptor. Correct bounds calculation. (gfc_desc_to_cfi_desc): Add code to verify the descriptor. gcc/testsuite/ChangeLog: * gfortran.dg/ISO_Fortran_binding_1.f90: Add pointer attribute, this test is still erroneous but now it compiles. * gfortran.dg/bind_c_array_params_2.f90: Update regex to match code changes. * gfortran.dg/PR93308.f90: New test. * gfortran.dg/PR93963.f90: New test. * gfortran.dg/PR94327.c: New test. * gfortran.dg/PR94327.f90: New test. * gfortran.dg/PR94331.c: New test. * gfortran.dg/PR94331.f90: New test. * gfortran.dg/PR97046.f90: New test.
2021-07-23Daily bump.GCC Administrator1-0/+6
2021-07-22Bind(c): signed char is not a Fortran character typeSandra Loosemore1-7/+6
CFI_allocate and CFI_select_part were incorrectly treating CFI_type_signed_char as a Fortran character type for the purpose of deciding whether or not to use the elem_len argument. It is a Fortran integer type per table 18.2 in the 2018 Fortran standard. Other functions in ISO_Fortran_binding.c appeared to handle this case correctly already. 2021-07-15 Sandra Loosemore <sandra@codesourcery.com> libgfortran/ * runtime/ISO_Fortran_binding.c (CFI_allocate): Don't use elem_len for CFI_type_signed_char. (CFI_select_part): Likewise.
2021-07-02Daily bump.GCC Administrator1-0/+7
2021-07-01Fortran: set version field in CFI_cdesc_t to CFI_VERSIONSandra Loosemore1-2/+2
When converting a GFC descriptor to a CFI descriptor, it was incorrectly copying the version number from the former to the latter. It should be using the value of CFI_VERSION instead (currently 1). Going the other direction, the GFC version field is initialized to zero elsewhere, so do that here too. 2021-06-30 Tobias Burnus <tobias@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com> libgfortran/ * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Initialize version field to 0. (gfc_desc_to_cfi_desc): Initialize version field to CFI_VERSION.
2021-06-30Daily bump.GCC Administrator1-0/+6
2021-06-29Fortran: Re-enable 128-bit integers for AMD GCNJulian Brown2-22/+4
This patch reverts the part of Tobias's patch for PR target/96306 that disables 128-bit integer support for AMD GCN. 2021-06-18 Julian Brown <julian@codesourcery.com> libgfortran/ PR target/96306 * configure.ac: Remove stanza that removes KIND=16 integers for AMD GCN. * configure: Regenerate.
2021-06-23Daily bump.GCC Administrator1-0/+7
2021-06-22Fortran: fix sm computation in CFI_allocate [PR93524]Sandra Loosemore1-4/+1
This patch fixes a bug in setting the step multiplier field in the C descriptor for array dimensions > 2. 2021-06-21 Sandra Loosemore <sandra@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> libgfortran/ PR fortran/93524 * runtime/ISO_Fortran_binding.c (CFI_allocate): Fix sm computation. gcc/testsuite/ PR fortran/93524 * gfortran.dg/pr93524.c: New. * gfortran.dg/pr93524.f90: New.
2021-06-09Daily bump.GCC Administrator1-0/+5
2021-06-08Fix "tailing" typo.Martin Liska2-2/+2
gcc/fortran/ChangeLog: * intrinsic.texi: Fix typo. * trans-expr.c (gfc_trans_pointer_assignment): Likewise. gcc/ChangeLog: * genautomata.c (create_automata): Fix typo. libgfortran/ChangeLog: * intrinsics/chmod.c (chmod_internal): Fix typo. * io/transfer.c (read_sf): Likewise. libquadmath/ChangeLog: * libquadmath.texi: Fix typo. gcc/testsuite/ChangeLog: * gcc.dg/format/strfmon-1.c: Fix typo. * gfortran.dg/char4-subscript.f90: Likewise.
2021-06-06Daily bump.GCC Administrator1-0/+8
2021-06-05Fortran: Fix some issues with pointers to character.José Rui Faustino de Sousa2-1/+2
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.
2021-05-23Revert "PR98301 Add missing changelog entries."Martin Liska1-9/+0
This reverts commit c4771b3438a8cd9afcef1762957b763f8df3fa6e.
2021-05-23Daily bump.GCC Administrator1-0/+8
2021-05-22PR98301 Add missing changelog entries.Andre Vehreschild1-0/+9
2021-05-22Steve Kargl <kargl@gcc.gnu.org>Andre Vehreschild4-54/+77
PR fortran/98301 - random_init() is broken Correct implementation of random_init() when -fcoarray=lib is given. gcc/fortran/ChangeLog: PR fortran/98301 * trans-decl.c (gfc_build_builtin_function_decls): Move decl. * trans-intrinsic.c (conv_intrinsic_random_init): Use bool for lib-call of caf_random_init instead of logical (4-byte). * trans.h: Add tree var for random_init. libgfortran/ChangeLog: PR fortran/98301 * caf/libcaf.h (_gfortran_caf_random_init): New function. * caf/single.c (_gfortran_caf_random_init): New function. * gfortran.map: Added fndecl. * intrinsics/random_init.f90: Implement random_init.
2021-05-06Daily bump.GCC Administrator1-0/+5
2021-05-05libgfortran/intrinsics/chmod.c: Silence unused var warningTobias Burnus1-1/+4
libgfortran/ChangeLog: * intrinsics/chmod.c (chmod_internal): Only declare mode_mask var if HAVE_UMASK.
2021-05-03Daily bump.GCC Administrator1-0/+9
2021-05-02Fortran: Async I/O - avoid unlocked unlocking [PR100352]Tobias Burnus3-10/+12
Follow up to PR100352, which moved unit unlocking to st_*_done_worker to avoid lock order reversal; however, as async_io uses a different lock, the (unlocked locked) unit lock shall not be unlocked there. libgfortran/ChangeLog: PR libgomp/100352 * io/transfer.c (st_read_done_worker, st_write_done_worker): Add new arg whether to unlock unit. (st_read_done, st_write_done): Call it with true. * io/async.c (async_io): Call it with false. * io/io.h (st_write_done_worker, st_read_done_worker): Update prototype.
2021-03-13Daily bump.GCC Administrator1-0/+9
2021-03-12Fortran: Fix libgfortran I/O race with newunit_free [PR99529]Tobias Burnus2-9/+24
libgfortran/ChangeLog: * io/transfer.c (st_read_done_worker, st_write_done_worker): Call unlock_unit here, add unit_lock lock around newunit_free call. (st_read_done, st_write_done): Only call unlock_unit when not calling the worker function. * io/unit.c (set_internal_unit): Don't reset the unit_number to the same number as this cause race warnings.
2021-03-06Daily bump.GCC Administrator1-0/+31
2021-03-05PR libfortran/99218 - matmul on temporary array accesses invalid memoryHarald Anlauf27-92/+184
Do not invoke tuned rank-2 times rank-2 matmul if rank(b) == 1. libgfortran/ChangeLog: PR libfortran/99218 * m4/matmul_internal.m4: Invoke tuned matmul only for rank(b)>1. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Likewise. * generated/matmul_c4.c: Likewise. * generated/matmul_c8.c: Likewise. * generated/matmul_i1.c: Likewise. * generated/matmul_i16.c: Likewise. * generated/matmul_i2.c: Likewise. * generated/matmul_i4.c: Likewise. * generated/matmul_i8.c: Likewise. * generated/matmul_r10.c: Likewise. * generated/matmul_r16.c: Likewise. * generated/matmul_r4.c: Likewise. * generated/matmul_r8.c: Likewise. * generated/matmulavx128_c10.c: Likewise. * generated/matmulavx128_c16.c: Likewise. * generated/matmulavx128_c4.c: Likewise. * generated/matmulavx128_c8.c: Likewise. * generated/matmulavx128_i1.c: Likewise. * generated/matmulavx128_i16.c: Likewise. * generated/matmulavx128_i2.c: Likewise. * generated/matmulavx128_i4.c: Likewise. * generated/matmulavx128_i8.c: Likewise. * generated/matmulavx128_r10.c: Likewise. * generated/matmulavx128_r16.c: Likewise. * generated/matmulavx128_r4.c: Likewise. * generated/matmulavx128_r8.c: Likewise. gcc/testsuite/ChangeLog: PR libfortran/99218 * gfortran.dg/matmul_21.f90: New test.
2021-03-04Daily bump.GCC Administrator1-0/+7
2021-03-03libgfortran: Fix negation for largest integer [PR81986]Tobias Burnus1-1/+1
libgfortran/ChangeLog: 2021-03-01 Vittorio Zecca <zeccav@gmail.com> Tobias Burnus <tobias@codesourcery.com> PR libfortran/81986 * runtime/string.c (gfc_itoa): Cast to unsigned before negating.
2021-02-13Daily bump.GCC Administrator1-0/+6
2021-02-12libgfortran: Fix PR95647 by changing the interfaces of operators .eq. and .ne.Steve Kargl1-4/+5
The FE converts the old school .eq. to ==, and then tracks the ==. The module starts with == and so it does not properly overload the .eq. Reversing the interfaces fixes this. 2021-02-12 Steve Kargl <sgk@troutmask.apl.washington.edu> libgfortran/ChangeLog: PR libfortran/95647 * ieee/ieee_arithmetic.F90: Flip interfaces of operators .eq. to == and .ne. to /= . gcc/testsuite/ChangeLog: PR libfortran/95647 * gfortran.dg/ieee/ieee_12.f90: New test.
2021-02-12Daily bump.GCC Administrator1-0/+6
2021-02-10libgfortran: Fix unwanted end-of-record by checking if seen_dollar.Jerry DeLisle1-0/+2
libgfortran/ChangeLog: PR libfortran/98825 * io/transfer.c (next_record_w): Insert check for seen_dollar and if so, skip issueing next record. gcc/testsuite/ChangeLog: PR libfortran/98825 * gfortran.dg/dollar_edit_descriptor_4.f: New test.
2021-01-28Daily bump.GCC Administrator1-0/+5
2021-01-27Fix strides for C descriptors with stride > 2.Harris Snyder1-1/+6
libgfortran/ChangeLog: * runtime/ISO_Fortran_binding.c (CFI_establish): fixed strides for rank >2 arrays. gcc/testsuite/ChangeLog: * gfortran.dg/ISO_Fortran_binding_18.c: New test. * gfortran.dg/ISO_Fortran_binding_18.f90: New test.