aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
AgeCommit message (Collapse)AuthorFilesLines
2021-10-28Only allocate a single chunk of memory on startup.devel/coarray_nativeNicolas Koenig5-138/+31
2021-10-04Take memory from envirnoment variables; document those.Thomas Koenig3-13/+55
2021-09-24Install libcaf_shared libraries in the same directory as libgfortran.Thomas Koenig3-66/+26
2021-09-24Add correct link flags to libgfortran.spec.in.Thomas Koenig6-58/+111
Removed extraneous HUHU.
2021-09-13Merged current trunk to branch.Thomas Koenig788-1551/+2308
2021-01-17Use an initial shared memory size of 256 GB on Apple.Thomas Koenig1-0/+9
This implements an idea that Nicolas had to overcome the Darwin problem that it is not possible to extend a shared memory segment on that system. The remedy is simple: Use a memory segment that is larger than what can reasonably be used. This should only waste a few page table entries, while providing the functionality, at least for further testing. libgfortran/ChangeLog: * caf_shared/shared_memory.c (shared_memory_init): On Apple, use an initial size of 256 GB.
2021-01-17Add test cases for atomic subroutines, remove atomics from TODO.Thomas Koenig1-1/+0
libgfortran/ChangeLog: * caf_shared/README.native_coarrays: Remove atomics from list of unsupported features.
2021-01-10Add error checking to mutexes and condition variables.Thomas Koenig1-8/+17
After the discussions about PTHREAD_PROCESS_SHARED and after observing that on Cygwin the program simply hangs because this flag is not implemented there, the best way is to check for errors and exit with a clear error message instead of some mysterious hang. libgfortran/ChangeLog: * caf_shared/util.c (ERRCHECK): New macro. (initialize_shared_mutex): Use it to check return codes. (initialize_shared_condition): Likewise.
2021-01-05Fix CO_REDUCE with RESULT_IMAGE.Thomas Koenig1-1/+1
gcc/fortran/ChangeLog: * trans-array.c (gfc_conv_ss_descriptor): Use correct ref. * trans-intrinsic.c (trans_argument): Use gfc_conv_expr_reference. * trans-decl.c (gfc_build_builtin_function_decls): Correct spec for array. libgfortran/ChangeLog: * caf_shared/collective_subroutine.c (collsub_reduce_array): Fix off by one error for result. gcc/testsuite/ChangeLog: * gfortran.dg/caf-shared/co_reduce_1.f90: New test.
2021-01-03Merge branch 'master' into devel/coarray_nativeThomas Koenig9-49/+106
2021-01-01Make SYNC IMAGES(*) work by handling size of -1 in library.Thomas Koenig3-17/+40
libgfortran/ChangeLog: * caf_shared/sync.c (sync_table): Change size argument and index to int. * caf_shared/sync.h (sync_table): Adjust prototype. * caf_shared/wrapper.c (cas_sync_images): Add s argument to int, adjust call to sync_table. gcc/testsuite/ChangeLog: * gfortran.dg/caf-shared/sync_images_1.f90: New test. * gfortran.dg/caf-shared/sync_images_2.f90: New test.
2020-12-30Make STAT and ERRMSG work on ALLOCATE, move error handling to library.Thomas Koenig3-38/+100
This makes STAT and ERRMSG work on ALLOCATE. It also separates the allocation of coarrays into two functions: One without error checking, which is called by compiler-generated code, and one with error checking for call from user code. In the course of looking at this, it was also noticed that allocatable coarrays were not automatically deallocated; this is now also fixed. Also, saved allocatable coarrays are now saved. gcc/fortran/ChangeLog: * trans-array.c (gfc_allocate_shared_coarray): Remove extra arguments, just build the call. (allocate_shared_coarray_chk): New function. (gfc_array_allocate): Adjust where to set the offset. Error handling is done in the library for shared coarrays. (gfc_trans_deferred_array): No early return for allocatable shared coarrays. * trans-array.h (gfc_array_allocate): Adjust prototype. (gfc_allocate_shared_coarray): Likewise. * trans-decl.c: Rename gfor_fndecl_cas_coarray_allocate to gfor_fndecl_cas_coarray_alloc for brevity. Add gfor_fndecl_cas_coarray_alloc_chk. (gfc_build_builtin_function_decls): Likewise. (gfc_trans_shared_coarray): Adjust calling sequence for gfc_allocate_shared_coarray. (gfc_trans_deferred_vars): Correct handling of saved allocatable shared coarrays. * trans-stmt.c (gfc_trans_sync): Adjust whitespace.o (coarray_alloc_p): Remove. (gfc_trans_allocate): Add shared_coarray variable to adjust status and errmsg handling. * trans.h: Rename gfor_fndecl_cas_coarray_allocate to gfor_fndecl_cas_coarray_alloc for brevity. Add gfor_fndecl_cas_coarray_alloc_chk. libgfortran/ChangeLog: * caf_shared/coarraynative.c (test_for_cas_errors): Correct handling of stat. * caf_shared/libcoarraynative.h (STAT_ERRMSG_ENTRY_CHECK): Use unlikely in condition. (STAT_ERRMSG_ENTRY_CHECK_RET): Likewise. * caf_shared/wrapper.c (cas_coarray_alloc): Adjust arguments. Call cas_coarray_alloc_work. (cas_coarray_alloc_chk): New function. (cas_coarray_alloc_work): New function. gcc/testsuite/ChangeLog: * gfortran.dg/caf-shared/allocate_1.f90: Adjust number of calls to sync_all. * gfortran.dg/caf-shared/allocate_status_1.f90: New test. * gfortran.dg/caf-shared/automatic_deallocate_1.f90: New test. * gfortran.dg/caf-shared/save_allocatable_1.f90: New test.
2020-12-27Fix for broken MacOS limitation for name length of shm_open.Thomas Koenig1-2/+18
libgfortran/ChangeLog: * caf_shared/util.c (CUT_INT): New macro. (MEMOBJ_NAME): Set to something short if __APPLE__ is defined. (get_shmem_fd): Exit on any error but EEXIST.
2020-12-27Fix errors introduced by last commit.Thomas Koenig1-0/+4
gcc/fortran/ChangeLog: * trans-array.c (gfc_conv_array_ref): Before discarding offset, check if this is a coarray and we are building shared coarrays. * trans-decl.c (gfc_build_builtin_function_decls): Clear up types for cas_coarray_allocate. (gfc_trans_shared_coarray): Pass NULL_TREEs to status and errmsg. libgfortran/ChangeLog: * caf_shared/util.h (CAS_DEBUG_PR): New macro. gcc/testsuite/ChangeLog: * gfortran.dg/caf-shared/cas.exp: Add -g to debug flags to allow better backtrace.
2020-12-23Mention we also need automated linking.Thomas Koenig1-1/+1
2020-12-23Add TODOs in README.native_coarrays.Thomas Koenig1-0/+9
libgfortran/ChangeLog: * caf_shared/README.native_coarrays:
2020-12-23Add offset to allocatable shared coarrays.Thomas Koenig1-3/+5
This adds the calculation of the offset for allocatable coarrays, which was missing before, and fixes the resulting fallout for ALLOCATED. Additionally, it prepares the way for STAT and ERRMSG for ALLOCATE of coarrays, but that still needs changes to gfc_trans_allocate. gcc/fortran/ChangeLog: * trans-array.c (gfc_conv_array_ref): If se->address_only is set, throw away all the offset calculation. (gfc_allocate_shared_coarray): Add arguments stat, errmsg and errlen to call to allocate. Calculate offset for allocatable coarrays. (gfc_array_allocate): Adjust call to gfc_allocate_shared_coarray. * trans-array.h (gfc_allocate_shared_coarray): Change prototype of cas_coarray_alloc. * trans-decl.c (gfc_build_builtin_function_decls): Adjust cas_coarray_alloc to changed prototypes. (gfc_trans_shared_coarray): Adjust call to gfc_allocate_shared_coarray. * trans-intrinsic.c (gfc_conv_allocated): Set address_only on se. * trans.h: Add flag address_only to gfc_se. libgfortran/ChangeLog: * caf_shared/wrapper.c (cas_coarray_alloc): Add status, error and errmsg arguments and their checking.
2020-12-06Daily bump.GCC Administrator1-0/+5
2020-12-05Darwin : Update libtool and dependencies for Darwin20 [PR97865]Iain Sandoe1-16/+18
The change in major version (and the increment from Darwin19 to 20) caused libtool tests to fail which resulted in incorrect build settings for shared libraries. We take this opportunity to sort out the shared undefined symbols state rather than propagating the current unsound behaviour into a new rev. This change means that we default to the case that missing symbols are considered an error, and if one wants to allow this intentionally, the confiuration for that case should be set appropriately. Three existing cases need undefined dynamic lookup: libitm, where there is already a configuration mechanism to add the flags. libcc1, where we add simple configuration to add the flags for Darwin. libsanitizer, where we can add to the existing extra flags. libcc1/ChangeLog: PR target/97865 * Makefile.am: Add dynamic_lookup to LD flags for Darwin. * configure.ac: Test for Darwin host and set a flag. * Makefile.in: Regenerate. * configure: Regenerate. libitm/ChangeLog: PR target/97865 * configure.tgt: Add dynamic_lookup to XLDFLAGS for Darwin. * configure: Regenerate. libsanitizer/ChangeLog: PR target/97865 * configure.tgt: Add dynamic_lookup to EXTRA_CXXFLAGS for Darwin. * configure: Regenerate. ChangeLog: PR target/97865 * libtool.m4: Update handling of Darwin platform link flags for Darwin20. gcc/ChangeLog: PR target/97865 * configure: Regenerate. libatomic/ChangeLog: PR target/97865 * configure: Regenerate. libbacktrace/ChangeLog: PR target/97865 * configure: Regenerate. libffi/ChangeLog: PR target/97865 * configure: Regenerate. libgfortran/ChangeLog: PR target/97865 * configure: Regenerate. libgomp/ChangeLog: PR target/97865 * configure: Regenerate. libhsail-rt/ChangeLog: PR target/97865 * configure: Regenerate. libobjc/ChangeLog: PR target/97865 * configure: Regenerate. libphobos/ChangeLog: PR target/97865 * configure: Regenerate. libquadmath/ChangeLog: PR target/97865 * configure: Regenerate. libssp/ChangeLog: PR target/97865 * configure: Regenerate. libstdc++-v3/ChangeLog: PR target/97865 * configure: Regenerate. libvtv/ChangeLog: PR target/97865 * configure: Regenerate. zlib/ChangeLog: PR target/97865 * configure: Regenerate.
2020-11-30Daily bump.GCC Administrator1-0/+4
2020-11-29Fix hppa64-hpux11 build to remove source paths from embedded path.John David Anglin1-4/+4
This change adds the +nodefaultrpath ld option to remove all library paths that were specified with the -L option from the embedded path. 2020-11-29 John David Anglin <danglin@gcc.gnu.org> ChangeLog: * libtool.m4 (archive_cmds): Add +nodefaultrpath ld option on hppa64-*-hpux11*. libatomic/ChangeLog: * configure: Regenerate. libbacktrace/ChangeLog: * configure: Regenerate. libcc1/ChangeLog: * configure: Regenerate. libffi/ChangeLog: * configure: Regenerate. libgfortran/ChangeLog: * configure: Regenerate. libgomp/ChangeLog: * configure: Regenerate. libhsail-rt/ChangeLog: * configure: Regenerate. libitm/ChangeLog: * configure: Regenerate. libobjc/ChangeLog: * configure: Regenerate. liboffloadmic/ChangeLog: * configure: Regenerate. * plugin/configure: Regenerate. libquadmath/ChangeLog: * configure: Regenerate. libsanitizer/ChangeLog: * configure: Regenerate. libssp/ChangeLog: * configure: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate. libvtv/ChangeLog: * configure: Regenerate. lto-plugin/ChangeLog: * configure: Regenerate. zlib/ChangeLog: * configure: Regenerate.
2020-11-28Fix memory calculation in get_master.Thomas Koenig1-1/+1
libgfortran/ChangeLog: * caf_shared/coarraynative.c (get_master): Use correct struct for sizeof calculation.
2020-11-27Use size of correct struct in allocation for sync interface.Thomas Koenig2-1/+2
libgfortran/ChangeLog: * caf_shared/counter_barrier.c (change_internal_barrier_count): Adjust whitespace. * caf_shared/sync.c (sync_iface_init): Use size of correct struct.
2020-11-27Daily bump.GCC Administrator1-0/+22
2020-11-26libgfortran: Verify the presence of all functions for POSIX 2008 localeMaciej W. Rozycki4-9/+13
While we have `configure' checks for the individual POSIX 2008 extended locale functions we refer to and use to guard the respective call sites, we only verify the presence of `newlocale' for our global feature enable check. Consequently compilation fails for targets like NetBSD that only have partial support for POSIX 2008 locale features and in particular lack the `uselocale' function: .../libgfortran/io/transfer.c: In function 'data_transfer_init_worker': .../libgfortran/io/transfer.c:3416:30: error: 'old_locale_lock' undeclared (first use in this function) 3416 | __gthread_mutex_lock (&old_locale_lock); | ^~~~~~~~~~~~~~~ .../libgfortran/io/transfer.c:3416:30: note: each undeclared identifier is reported only once for each function it appears in .../libgfortran/io/transfer.c:3417:12: error: 'old_locale_ctr' undeclared (first use in this function) 3417 | if (!old_locale_ctr++) | ^~~~~~~~~~~~~~ .../libgfortran/io/transfer.c:3419:11: error: 'old_locale' undeclared (first use in this function); did you mean 'c_locale'? 3419 | old_locale = setlocale (LC_NUMERIC, NULL); | ^~~~~~~~~~ | c_locale .../libgfortran/io/transfer.c: In function 'finalize_transfer': .../libgfortran/io/transfer.c:4253:26: error: 'old_locale_lock' undeclared (first use in this function) 4253 | __gthread_mutex_lock (&old_locale_lock); | ^~~~~~~~~~~~~~~ .../libgfortran/io/transfer.c:4254:10: error: 'old_locale_ctr' undeclared (first use in this function) 4254 | if (!--old_locale_ctr) | ^~~~~~~~~~~~~~ .../libgfortran/io/transfer.c:4256:30: error: 'old_locale' undeclared (first use in this function); did you mean 'c_locale'? 4256 | setlocale (LC_NUMERIC, old_locale); | ^~~~~~~~~~ | c_locale make[3]: *** [Makefile:6221: transfer.lo] Error 1 Only enable the use of POSIX 2008 extended locale features then when all the three functions required are present, removing said build errors. libgfortran/ * io/io.h [HAVE_NEWLOCALE]: Also check for HAVE_FREELOCALE and HAVE_USELOCALE. [HAVE_FREELOCALE && HAVE_NEWLOCALE && HAVE_USELOCALE] (HAVE_POSIX_2008_LOCALE): New macro. (st_parameter_dt) [HAVE_NEWLOCALE]: Check for HAVE_POSIX_2008_LOCALE instead. * io/transfer.c (data_transfer_init_worker, finalize_transfer) [HAVE_USELOCALE]: Check for HAVE_POSIX_2008_LOCALE instead. * io/unit.c [HAVE_NEWLOCALE]: Likewise. (init_units) [HAVE_NEWLOCALE]: Likewise. (close_units) [HAVE_FREELOCALE]: Likewise. * runtime/error.c (gf_strerror) [HAVE_USELOCALE]: Likewise.
2020-11-26libgfortran: Correct FP feature macro checksMaciej W. Rozycki1-6/+6
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__.
2020-11-22Daily bump.GCC Administrator1-0/+5
2020-11-21Darwin, libgfortran : Do not use environ directly from the library.Iain Sandoe1-0/+5
On macOS / Darwin, the environ variable can be used directly in the code of an executable, but cannot be used in the code of a shared library (i.e. libgfortran.dylib), in this case. In such cases, the function _NSGetEnviron should be called to get the address of 'environ'. libgfortran/ChangeLog: * intrinsics/execute_command_line.c (environ): Use _NSGetEnviron to get the environment pointer on Darwin.
2020-11-15Rename directory from nca to caf_shared; also rename some files.Nicolas Koenig36-190/+190
libgfortran/ChangeLog: * nca: Rename directory to * caf_shared: New name * Makefile.am: Change directory name from nca to caf_shared, nca_minmax_c to cas_collsub_c and nca_minmax to cas_collsub. * Makefile.in: Regenerated. * generated/nca_minmax_i1.c: Regenerated. * generated/nca_minmax_i16.c: Regenerated. * generated/nca_minmax_i2.c: Regenerated. * generated/nca_minmax_i4.c: Regenerated. * generated/nca_minmax_i8.c: Regenerated. * generated/nca_minmax_r10.c: Regenerated. * generated/nca_minmax_r16.c: Regenerated. * generated/nca_minmax_r4.c: Regenerated. * generated/nca_minmax_r8.c: Regenerated. * generated/nca_minmax_s1.c: Regenerated. * generated/nca_minmax_s4.c: Regenerated. * m4/nca-minmax-s.m4: Rename to cas_collsub-s.m4. Adjust include path. * m4/nca_minmax.m4: Rename to cas_collsub.m4. Adjust include path.
2020-11-15Do not do overflow checks on allocating shared coarrays; reformatting.Nicolas Koenig10-411/+434
gcc/fortran/ChangeLog: PR fortran/97589 * trans-array.c (gfc_array_allocate): Do not do overflow checks for shared coarrays. libgfortran/ChangeLog: * nca/alloc.c: Reformat. * nca/allocator.c: Reformat. * nca/coarraynative.c: Reformat. * nca/collective_subroutine.c Reformat. * nca/counter_barrier.c: Reformat. * nca/hashmap.c: Reformat. * nca/shared_memory.c: Reformat. * nca/sync.c: Reformat. * nca/util.c: Reformat. * nca/wrapper.c: Reformat.
2020-11-09Fix test for size of memory allocation.Thomas Koenig1-1/+1
libgfortran/ChangeLog: * nca/shared_memory.c (shared_memory_get_mem_with_alignment): Fix test.
2020-11-08Implement stat and errmsg.Nicolas Koenig25-545/+1018
gcc/fortran/ChangeLog: * trans-decl.c (gfc_sym_mangled_function_id): Whitespace fix. (gfc_build_builtin_function_decls): Correct fn specs. * trans-intrinsic.c (trans_argument): Re-apply fix (?) (conv_cas_reduce): Likewise. (conv_co_collective): Likewise. libgfortran/ChangeLog: * Makefile.am: Add counter_barrier.c and counter_barrier.h * Makefile.in: Regenerate. * generated/nca_minmax_i1.c: Regenerated. * generated/nca_minmax_i16.c: Regenerated. * generated/nca_minmax_i2.c: Regenerated. * generated/nca_minmax_i4.c: Regenerated. * generated/nca_minmax_i8.c: Regenerated. * generated/nca_minmax_r10.c: Regenerated. * generated/nca_minmax_r16.c: Regenerated. * generated/nca_minmax_r4.c: Regenerated. * generated/nca_minmax_r8.c: Regenerated. * generated/nca_minmax_s1.c: Regenerated. * generated/nca_minmax_s4.c: Regenerated. * m4/nca-minmax-s.m4: Add stat and errmsg. * m4/nca_minmax.m4: Likewise. * nca/coarraynative.c (get_master): New function. (test_for_cas_errors): New function. (master_is_image_active): New function. (master_get_num_active_images): New function. (master_bind_active_image_barrier): New function. (error_on_missing_images): New function. (cas_master): New function. * nca/collective_subroutine.c (collsub_sync): Replace pthread_barrier_wait by counter_barrier. (collsub_reduce_array): Add error_on_missing_images. Adjust to number of images. (collsub_reduce_scalar): Likewise. (collsub_iface_init): Likewise. * nca/collective_subroutine.h: Replace pthread_barrier_t by counter_barrier. * nca/libcoarraynative.h: Include counter_barrier.h. Add handling for failed images, stat and errmsg. * nca/sync.c (sync_all_init): Replace pthread_barrir by counter_barrier. (sync_iface_init): Adjust handling to total_num_images. (sync_table): Likewise. (sync_all): LIkewise. * nca/sync.h: Include some theaders, adjust to counter_barrier. * nca/util.h: Add internal_proto to unpack_array_finish. * nca/wrapper.c (cas_collsub_reduce_array): Adjust to total_num_images, handle status and errmsg. (cas_collsub_reduce_scalar): Likewise. (cas_collsub_broadcast_array): Likewise. (cas_collsub_broadcast_scalar): Likewise. (cas_coarray_alloc): Likewise. (cas_coarray_free): Likewise. (cas_coarray_num_images): Likewise. (cas_coarray_sync_all): Likewise. (cas_sync_images): Likewise. * nca/counter_barrier.c: New file. * nca/counter_barrier.h: New file.
2020-11-02Daily bump.GCC Administrator1-0/+8
2020-10-30PR libfortran/97581 - clean up size calculation of random generator stateHarald Anlauf1-15/+17
The random number generator internal state may be saved to/restored from an array of integers. Clean up calculation of needed number of elements to avoid redefiniton of auxiliary macro SZ. libgfortran/ChangeLog: * intrinsics/random.c (SZ_IN_INT_4): Define size of state in int32_t. (SZ_IN_INT_8): Define size of state in int64_t. (SZ): Remove. (random_seed_i4): Use size SZ_IN_INT_4 instead of SZ. (random_seed_i8): Use size SZ_IN_INT_8 instead of SZ.
2020-10-28Merge branch 'master' into devel/coarray_native.Thomas Koenig43-1348/+1403
Merge into devel/coarray_native to prepare for later merging of coarray_native with master.
2020-10-27Always include libgfortran.h first; sanitize header dependencies.Thomas Koenig11-44/+14
libgfortran/ChangeLog: * nca/coarraynative.c: Do not include util.h. Remove commented include for stdlib.h.. * nca/collective_subroutine.c: Move #include <string.h> after other #include statement. * nca/hashmap.c: Include shared_memory.h and allocator.h * nca/hashmap.h: Remove includess. * nca/libcoarraynative.h: Include only those headers which are needed. * nca/shared_memory.c: Do not include util.h * nca/shared_memory.h: Do not include other headers. * nca/sync.c: Move include of string.h after other headers. * nca/sync.h: Remove include of shared_memory.h and alloc.h. * nca/util.h: Do not include stdint.h and stddef.h; include limits.h and assert.h. * nca/wrapper.c: Remove include for sync.h, util.h and collective_subroutine.h. Move include of string.h after other headers.
2020-10-19Daily bump.GCC Administrator1-0/+31
2020-10-18PR libfortran/97063 - Wrong result for vector (step size is negative) * matrixHarald Anlauf27-1288/+1288
The MATMUL intrinsic provided a wrong result for rank-1 times rank-2 array when a negative stride was used for addressing the elements of the rank-1 array, because a check on strides was erroneously placed before the check on the rank. Interchange order of checks. libgfortran/ChangeLog: * m4/matmul_internal.m4: Move check for rank-1 times rank-2 before checks on strides for rank-2 times rank-2. * 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: * gfortran.dg/matmul_20.f90: New test.
2020-10-18Implement comments from review.Nicolas KÃnig29-938/+429
This implements the comments from the review - the general prefix is now cas (for coarray shared), and native has been renamed to shared generally. Plus, there is a lot of cleanup such as removing dead code and debug statements. gcc/ChangeLog: PR fortran/88076 * flag-types.h (enum gfc_fcoarray): Change GFC_FCOARRAY_NATIVE to GFC_FCOARRAY_SHARED. gcc/fortran/ChangeLog: PR fortran/88076 * dump-parse-tree.c (show_symbol): Remove dumping of backend_decl. * frontend-passes.c (gfc_run_passes): Generally rename "native" to "shared" and "cas" instead of "nca". (co_reduce_code): Initialize num. Generally rename "native" to "shared" and "cas" instead of "nca". * gfortran.h: Generally rename "native" to "shared". * iresolve.c (gfc_resolve_co_collective): Use specific function for library coarrays. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_resolve_co_reduce): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_resolve_co_broadcast): Generally rename "native" to "shared" and "cas" instead of "nca". * lang.opt: Generally rename "native" to "shared" and "cas" instead of "nca". * resolve.c (fixup_coarray_args): Rename to (fixup_shared_coarray_args): Generally rename "native" to "shared" and "cas" instead of "nca". Get rid of a variable. (resolve_unknown_s): Fix whitespace. (resolve_call): Generally rename "native" to "shared" and "cas" instead of "nca". (resolve_critical): Revert spurious change. Generally rename "native" to "shared" and "cas" instead of "nca". * trans-array.c (gfc_add_strides): Fix comment format. (gfc_native_coarray_add_this_image_offset): Generally rename "native" to "shared" and "cas" instead of "nca". Formatting fixes. (gfc_conv_ss_descriptor): Generally rename "native" to "shared" and "cas" instead of "nca". (build_array_ref): Remove empty line. (gfc_conv_array_ref): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_array_init_size): Special-case GFC_COARRAY_SHARED. Generally rename "native" to "shared" and "cas" instead of "nca". Fix formatting. (gfc_allocate_native_coarray): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_array_allocate): Generally rename "native" to "shared" and "cas" instead of "nca". Fix comment syntax. (gfc_trans_dummy_array_bias): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_dataptr_offset): Generally rename "native" to "shared" and "cas" instead of "nca". Fix comment style. (gfc_conv_expr_descriptor): Remove code blocks guarded by #if 0 or #if 1. (gfc_conv_array_parameter): Likewise. (gfc_walk_array_ref): Likewise. * trans-array.h (enum gfc_coarray_allocation_type): Change offset from 3 to 1. * trans-decl.c: Generally rename "native" to "shared" and "cas" instead of "nca" for tree declarations. (gfc_build_qualified_array): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_build_dummy_array_decl): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_symbol_decl): Revert spurious change. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_build_builtin_function_decls): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_native_coarray): Clarify comment. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_deferred_vars): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_create_module_variable): Generally rename "native" to "shared" and "cas" instead of "nca". (generate_coarray_constructor_function): Generally rename "native" to "shared" and "cas" instead of "nca". (create_main_function): Generally rename "native" to "shared" and "cas" instead of "nca". * trans-expr.c (gfc_maybe_dereference_var): Remove branch where condition is always false. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_conv_procedure_call): Remove code blocks guarded by #if 0. Whitespace fix. * trans-intrinsic.c (trans_this_image): Generally rename "native" to "shared" and "cas" instead of "nca". (trans_image_index): Remove unneeded TODO. Generally rename "native" to "shared" and "cas" instead of "nca". (trans_num_images): Generally rename "native" to "shared" and "cas" instead of "nca". (conv_intrinsic_cobound): Generally rename "native" to "shared" and "cas" instead of "nca". (trans_argument): Clarify comment explaining what the function does. (conv_nca_reduce): Rename to... (conv_cas_reduce): this. Add comment. (conv_nca_broadcast): Rename to... (conv_cas_broadcast): this. (conv_nca_collective): Rename to... (conv_cas_collective): this. (conv_co_collective): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_conv_intrinsic_subroutine): Generally rename "native" to "shared" and "cas" instead of "nca". * trans-stmt.c (gfc_trans_lock_unlock): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_sync): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_critical): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_deallocate): Generally rename "native" to "shared" and "cas" instead of "nca". * trans-types.c (gfc_is_nodesc_array): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_build_array_type): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_nodesc_array_type): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_array_type_bounds): Generally rename "native" to "shared" and "cas" instead of "nca". * trans.c (gfc_trans_memory_barrier): Use sizeof instead of strlen, replace comma by semicolon. (gfc_build_array_ref): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_deallocate_with_status): Fix indentation. Generally rename "native" to "shared" and "cas" instead of "nca". * trans.h: Generally rename "native" to "shared" and "cas" instead of "nca". libgfortran/ChangeLog: PR fortran/88076 * m4/nca-minmax-s.m4: Change "nca" prefix to "cas". Add comments. * m4/nca_minmax.m4: Likewise. * nca/README.native_coarrays: Update. * nca/alloc.c (free_memory_with_id): Add FIXME. * nca/coarraynative.c (nca_master): Rename to (cas_master): Change logic for exiting images. * nca/collective_subroutine.c (get_collsub_buf): Add comment. (collsub_sync): Remove dead debug output. (collsub_reduce_array): Silence -Wsign-compare warning. (collsub_iface_init): Remove unused variable. (collsub_broadcast_scalar): Remove debug code. (collsub_broadcast_array): Remove unused variable. (nca_co_broadcast): Remove commented-out function, plus its (export_proto): prototype declaration. * nca/collective_subroutine.h (finish_collective_subroutine): Add. * nca/hashmap.c (num_entries): Silcence -Wsign-compare warning. (hash): Formatting change (add empty lines). (gen_mask): Likewise. (hmiadd): Likewise. (get_expected_offset): Likewise. (hashmap_init): Likewise. (scan_empty): Likewise. Remove unused argument. (hashmap_get): Formatting change (add empty lines). (hm_search_result_ptr): Likewise. (hm_search_result_contains): Likewise. (enlarge_hashmap_mem): Likewise. (resize_hm): Likewise. Remove argument in call to scan_empty. (hashmap_set): Remove dead debugging code. Silence -Wsign-compare warning. (hashmap_change_refcnt): Silence -Wsign-compare warning. (hashmap_inc): Formatting change. * nca/hashmap.h (Library): Add copyright notice. * nca/libcoarraynative.h (DEBUG_NATIVE_COARRAY): #define as 0 (NUM_ADDR_BITS): Remove dead code. (nca_master): Rename to (cas_master): this. * nca/shared_memory.c (shared_memory_get_mem_with_alignment): Remove debug code. * nca/shared_memory.h (SHARED_MEMORY_H): Move definition to start of file. * nca/sync.c (get_locked_table): Remove commented-out code. (sync_iface_init): Remove debug code. (sync_all): Remove debug code. * nca/sync.h: Add space after #include. * nca/util.c: Include assert.h. Add comment. (next_power_of_two): Remove comment. (pack_array_finish): Replace 0 by '\0' in memset. (unpack_array_finish): Zero variable count. * nca/wrapper.c (enum gfc_coarray_allocation_type): Enum starts at one. Add comment about need to keep in sync with trans-array.h. (nca_coarray_alloc): Rename to (cas_coarray_alloc): this. (nca_coarray_free): Rename to (cas_coarray_free): this. (nca_coarray_this_image): Rename to (cas_coarray_this_image): this. (nca_coarray_num_images): Rename to (cas_coarray_num_images): this. (nca_coarray_sync_all): Rename to (cas_coarray_sync_all): this. (nca_sync_images): Rename to (cas_sync_images): this. (nca_lock): Rename to (cas_lock): this. (nca_unlock): Rename to (cas_unlock): this. (nca_collsub_reduce_array): Rename to (cas_collsub_reduce_array): this. (nca_collsub_reduce_scalar): Rename to (cas_collsub_reduce_scalar): this. (nca_collsub_broadcast_array): Rename to (cas_collsub_broadcast_array): this. (nca_collsub_broadcast_scalar): Rename to (cas_collsub_broadcast_scalar): this. * nca/.tags: Delete. * nca/collective_inline.h: Delete. * generated/nca_minmax_i1.c: Regenerated. * generated/nca_minmax_i16.c: Regenerated. * generated/nca_minmax_i2.c: Regenerated. * generated/nca_minmax_i4.c: Regenerated. * generated/nca_minmax_i8.c: Regenerated. * generated/nca_minmax_r10.c: Regenerated. * generated/nca_minmax_r16.c: Regenerated. * generated/nca_minmax_r4.c: Regenerated. * generated/nca_minmax_r8.c: Regenerated. * generated/nca_minmax_s1.c: Regenerated. * generated/nca_minmax_s4.c: Regenerated.
2020-10-11Change name of option to -fcoarray=shared and library name to libcaf_shared.Nicolas KÃnig4-259/+259
gcc/fortran/ChangeLog: * lang.opt: Change name of option to -fcoarray=shared. libgfortran/ChangeLog: * Makefile.am: Change library name to libcaf_shared. * Makefile.in: Regenerated. * configure: Regenerated. * nca/README.native_coarrays: Document change. Correctly handle deallocation of components. gcc/fortran/ChangeLog: * trans-decl.c (gfc_build_builtin_function_decls): Fix types, add some documentation. (gfc_trans_native_coarray): Fix call. * trans.c (gfc_deallocate_with_status): Correctly handle deallocation of components.
2020-09-29Daily bump.GCC Administrator1-0/+19
2020-09-28libgfortran/m4/unpack.m4: Silence -Wmaybe-uninitializedTobias Burnus14-56/+56
libgfortran/ChangeLog: * m4/unpack.m4 (unpack0_'rtype_code`, unpack1_'rtype_code`): Move 'rstride[0]' initialization outside conditional branch to silence -Wmaybe-uninitialized. * 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.
2020-09-28Daily bump.GCC Administrator1-0/+4
2020-09-27aix: Use $(AR) without -X32_64 to build FAT libraries.Clément Chigot1-4/+5
AIX FAT libraries should be built with the version of AR chosen by configure. The GNU Make $(AR) variable includes the AIX -X32_64 option needed by the default Makefile rules to accept both 32 bit and 64 bit object files. The -X32_64 option conflicts with ar archiving objects of the same name used to build FAT libraries. This patch changes the Makefile fragments for AIX FAT libraries to use $(AR), but strips the -X32_64 option from the Make variable. libgcc/ChangeLog: 2020-09-27 Clement Chigot <clement.chigot@atos.net> * config/rs6000/t-slibgcc-aix: Use $(AR) without -X32_64. libatomic/ChangeLog: 2020-09-27 Clement Chigot <clement.chigot@atos.net> * config/t-aix: Use $(AR) without -X32_64. libgomp/ChangeLog: 2020-09-27 Clement Chigot <clement.chigot@atos.net> * config/t-aix: Use $(AR) without -X32_64. libstdc++-v3/ChangeLog: 2020-09-27 Clement Chigot <clement.chigot@atos.net> * config/os/aix/t-aix: Use $(AR) without -X32_64. libgfortran/ChangeLog: 2020-09-27 Clement Chigot <clement.chigot@atos.net> * config/t-aix: Use $(AR) without -X32_64.
2020-09-23Add README.native_coarrays.Nicolas KÃnig1-0/+35
2020-09-23Initial commit of coarray_native branch.I'm not telling you my name, idiot39-33/+10958
2020-09-04Daily bump.GCC Administrator1-0/+9
2020-09-03PR fortran/96890 - Wrong answer with intrinsic IALLHarald Anlauf6-6/+6
The IALL intrinsic would always return 0 when the DIM and MASK arguments were present since the initial value of repeated BIT-AND operations was set to 0 instead of -1. libgfortran/ChangeLog: * m4/iall.m4: Initial value for result should be -1. * generated/iall_i1.c (miall_i1): Generated. * generated/iall_i16.c (miall_i16): Likewise. * generated/iall_i2.c (miall_i2): Likewise. * generated/iall_i4.c (miall_i4): Likewise. * generated/iall_i8.c (miall_i8): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/iall_masked.f90: New test.
2020-08-25Daily bump.GCC Administrator1-0/+6
2020-08-24Fortran : get_environment_variable runtime error PR96486Mark Eggleston1-5/+2
Runtime error occurs when the type of the value argument is character(0): "Zero-length string passed as value...". The status argument, intent(out), will contain -1 if the value of the environment is too large to fit in the value argument, this is the case if the type is character(0) so there is no reason to produce a runtime error if the value argument is zero length. 2020-08-24 Mark Eggleston <markeggleston@gcc.gnu.org> libgfortran/ PR fortran/96486 * intrinsics/env.c: If value_len is > 0 blank the string. Copy the result only if its length is > 0. 2020-08-24 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/96486 * gfortran.dg/pr96486.f90: New test.