aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2021-01-03 21:40:04 +0100
committerThomas Koenig <tkoenig@gcc.gnu.org>2021-01-03 21:40:04 +0100
commitafae4a55ccaa0de95ea11e5f634084db6ab2f444 (patch)
treed632cc867d10410ba9fb750523be790b86846ac4 /libgfortran
parent9d9a82ec8478ff52c7a9d61f58cd2a7b6295b5f9 (diff)
parentd2eb616a0f7bea78164912aa438c29fe1ef5774a (diff)
downloadgcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.zip
gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.tar.gz
gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.tar.bz2
Merge branch 'master' into devel/coarray_native
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog44
-rwxr-xr-xlibgfortran/configure40
-rw-r--r--libgfortran/intrinsics/execute_command_line.c5
-rw-r--r--libgfortran/intrinsics/random.c32
-rw-r--r--libgfortran/io/io.h10
-rw-r--r--libgfortran/io/transfer.c4
-rw-r--r--libgfortran/io/unit.c6
-rw-r--r--libgfortran/libgfortran.h12
-rw-r--r--libgfortran/runtime/error.c2
9 files changed, 106 insertions, 49 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 104a149..4967867 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,47 @@
+2020-12-05 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR target/97865
+ * configure: Regenerate.
+
+2020-11-29 John David Anglin <danglin@gcc.gnu.org>
+
+ * configure: Regenerate.
+
+2020-11-26 Maciej W. Rozycki <macro@linux-mips.org>
+
+ * 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-26 Maciej W. Rozycki <macro@linux-mips.org>
+
+ * 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-21 Iain Sandoe <iain@sandoe.co.uk>
+
+ * intrinsics/execute_command_line.c (environ): Use
+ _NSGetEnviron to get the environment pointer on Darwin.
+
+2020-10-30 Harald Anlauf <anlauf@gmx.de>
+
+ * 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-18 Harald Anlauf <anlauf@gmx.de>
* m4/matmul_internal.m4: Move check for rank-1 times rank-2 before
diff --git a/libgfortran/configure b/libgfortran/configure
index 7ddd4a1..6a2fca2 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -9200,23 +9200,25 @@ _LT_EOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
$as_echo "$lt_cv_ld_force_load" >&6; }
- case $host_os in
- rhapsody* | darwin1.[012])
+ # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not expect to
+ # build without first building modern cctools / linker.
+ case $host_cpu-$host_os in
+ *-rhapsody* | *-darwin1.[012])
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
- darwin1.*)
+ *-darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ *-darwin*)
+ # darwin 5.x (macOS 10.1) onwards we only need to adjust when the
+ # deployment target is forced to an earlier version.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ ;;
10.[012][,.]*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- esac
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ *)
+ ;;
+ esac
;;
esac
if test "$lt_cv_apple_cc_single_mod" = "yes"; then
@@ -11019,7 +11021,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
if test "$GCC" = yes && test "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
- archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
@@ -11031,7 +11033,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
else
case $host_cpu in
hppa*64*)
- archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
@@ -12862,7 +12864,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12865 "configure"
+#line 12850 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14866,7 +14868,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
if test "$GCC" = yes && test "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
- archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
archive_cmds_FC='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
@@ -14878,7 +14880,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
else
case $host_cpu in
hppa*64*)
- archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
diff --git a/libgfortran/intrinsics/execute_command_line.c b/libgfortran/intrinsics/execute_command_line.c
index 71d61a7..6d7b8fc 100644
--- a/libgfortran/intrinsics/execute_command_line.c
+++ b/libgfortran/intrinsics/execute_command_line.c
@@ -34,7 +34,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
#ifdef HAVE_POSIX_SPAWN
#include <spawn.h>
+# ifdef __APPLE__
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron ())
+# else
extern char **environ;
+# endif
#endif
#if defined(HAVE_POSIX_SPAWN) || defined(HAVE_FORK)
#include <signal.h>
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index af8b1bc..a864ab9 100644
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -723,6 +723,9 @@ arandom_r16 (gfc_array_r16 *x)
/* Number of elements in master_state array. */
#define SZU64 (sizeof (master_state.s) / sizeof (uint64_t))
+/* Equivalent number of elements in an array of GFC_INTEGER_{4,8}. */
+#define SZ_IN_INT_4 (SZU64 * (sizeof (uint64_t) / sizeof (GFC_INTEGER_4)))
+#define SZ_IN_INT_8 (SZU64 * (sizeof (uint64_t) / sizeof (GFC_INTEGER_8)))
/* Keys for scrambling the seed in order to avoid poor seeds. */
@@ -751,14 +754,13 @@ void
random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
{
uint64_t seed[SZU64];
-#define SZ (sizeof (master_state.s) / sizeof (GFC_INTEGER_4))
/* Check that we only have one argument present. */
if ((size ? 1 : 0) + (put ? 1 : 0) + (get ? 1 : 0) > 1)
runtime_error ("RANDOM_SEED should have at most one argument present.");
if (size != NULL)
- *size = SZ;
+ *size = SZ_IN_INT_4;
prng_state* rs = get_rand_state();
@@ -770,7 +772,7 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
runtime_error ("Array rank of GET is not 1.");
/* If the array is too small, abort. */
- if (GFC_DESCRIPTOR_EXTENT(get,0) < (index_type) SZ)
+ if (GFC_DESCRIPTOR_EXTENT(get,0) < (index_type) SZ_IN_INT_4)
runtime_error ("Array size of GET is too small.");
if (!rs->init)
@@ -780,8 +782,9 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
scramble_seed (seed, rs->s);
/* Then copy it back to the user variable. */
- for (size_t i = 0; i < SZ ; i++)
- memcpy (&(get->base_addr[(SZ - 1 - i) * GFC_DESCRIPTOR_STRIDE(get,0)]),
+ for (size_t i = 0; i < SZ_IN_INT_4 ; i++)
+ memcpy (&(get->base_addr[(SZ_IN_INT_4 - 1 - i) *
+ GFC_DESCRIPTOR_STRIDE(get,0)]),
(unsigned char*) seed + i * sizeof(GFC_UINTEGER_4),
sizeof(GFC_UINTEGER_4));
}
@@ -805,13 +808,14 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
runtime_error ("Array rank of PUT is not 1.");
/* If the array is too small, abort. */
- if (GFC_DESCRIPTOR_EXTENT(put,0) < (index_type) SZ)
+ if (GFC_DESCRIPTOR_EXTENT(put,0) < (index_type) SZ_IN_INT_4)
runtime_error ("Array size of PUT is too small.");
/* We copy the seed given by the user. */
- for (size_t i = 0; i < SZ; i++)
+ for (size_t i = 0; i < SZ_IN_INT_4; i++)
memcpy ((unsigned char*) seed + i * sizeof(GFC_UINTEGER_4),
- &(put->base_addr[(SZ - 1 - i) * GFC_DESCRIPTOR_STRIDE(put,0)]),
+ &(put->base_addr[(SZ_IN_INT_4 - 1 - i) *
+ GFC_DESCRIPTOR_STRIDE(put,0)]),
sizeof(GFC_UINTEGER_4));
/* We put it after scrambling the bytes, to paper around users who
@@ -823,7 +827,6 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
__gthread_mutex_unlock (&random_lock);
}
-#undef SZ
}
iexport(random_seed_i4);
@@ -837,9 +840,8 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get)
if ((size ? 1 : 0) + (put ? 1 : 0) + (get ? 1 : 0) > 1)
runtime_error ("RANDOM_SEED should have at most one argument present.");
-#define SZ (sizeof (master_state.s) / sizeof (GFC_INTEGER_8))
if (size != NULL)
- *size = SZ;
+ *size = SZ_IN_INT_8;
prng_state* rs = get_rand_state();
@@ -851,7 +853,7 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get)
runtime_error ("Array rank of GET is not 1.");
/* If the array is too small, abort. */
- if (GFC_DESCRIPTOR_EXTENT(get,0) < (index_type) SZ)
+ if (GFC_DESCRIPTOR_EXTENT(get,0) < (index_type) SZ_IN_INT_8)
runtime_error ("Array size of GET is too small.");
if (!rs->init)
@@ -861,7 +863,7 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get)
scramble_seed (seed, rs->s);
/* This code now should do correct strides. */
- for (size_t i = 0; i < SZ; i++)
+ for (size_t i = 0; i < SZ_IN_INT_8; i++)
memcpy (&(get->base_addr[i * GFC_DESCRIPTOR_STRIDE(get,0)]), &seed[i],
sizeof (GFC_UINTEGER_8));
}
@@ -885,11 +887,11 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get)
runtime_error ("Array rank of PUT is not 1.");
/* If the array is too small, abort. */
- if (GFC_DESCRIPTOR_EXTENT(put,0) < (index_type) SZ)
+ if (GFC_DESCRIPTOR_EXTENT(put,0) < (index_type) SZ_IN_INT_8)
runtime_error ("Array size of PUT is too small.");
/* This code now should do correct strides. */
- for (size_t i = 0; i < SZ; i++)
+ for (size_t i = 0; i < SZ_IN_INT_8; i++)
memcpy (&seed[i], &(put->base_addr[i * GFC_DESCRIPTOR_STRIDE(put,0)]),
sizeof (GFC_UINTEGER_8));
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index ab4a103..b4a8113 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -52,8 +52,12 @@ struct format_data;
typedef struct fnode fnode;
struct gfc_unit;
-#ifdef HAVE_NEWLOCALE
-/* We have POSIX 2008 extended locale stuff. */
+#if defined (HAVE_FREELOCALE) && defined (HAVE_NEWLOCALE) \
+ && defined (HAVE_USELOCALE)
+/* We have POSIX 2008 extended locale stuff. We only choose to use it
+ if all the functions required are present as some systems, e.g. NetBSD
+ do not have `uselocale'. */
+#define HAVE_POSIX_2008_LOCALE
extern locale_t c_locale;
internal_proto(c_locale);
#else
@@ -562,7 +566,7 @@ typedef struct st_parameter_dt
char *line_buffer;
struct format_data *fmt;
namelist_info *ionml;
-#ifdef HAVE_NEWLOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
locale_t old_locale;
#endif
/* Current position within the look-ahead line buffer. */
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index dc18bc3..c36d8bc 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -3410,7 +3410,7 @@ data_transfer_init_worker (st_parameter_dt *dtp, int read_flag)
if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED)
{
-#ifdef HAVE_USELOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
dtp->u.p.old_locale = uselocale (c_locale);
#else
__gthread_mutex_lock (&old_locale_lock);
@@ -4243,7 +4243,7 @@ finalize_transfer (st_parameter_dt *dtp)
}
}
-#ifdef HAVE_USELOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
if (dtp->u.p.old_locale != (locale_t) 0)
{
uselocale (dtp->u.p.old_locale);
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index a3b0656..faf6299 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -114,7 +114,7 @@ static char stdout_name[] = "stdout";
static char stderr_name[] = "stderr";
-#ifdef HAVE_NEWLOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
locale_t c_locale;
#else
/* If we don't have POSIX 2008 per-thread locales, we need to use the
@@ -586,7 +586,7 @@ init_units (void)
{
gfc_unit *u;
-#ifdef HAVE_NEWLOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
c_locale = newlocale (0, "C", 0);
#else
#ifndef __GTHREAD_MUTEX_INIT
@@ -803,7 +803,7 @@ close_units (void)
free (newunits);
-#ifdef HAVE_FREELOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
freelocale (c_locale);
#endif
}
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index a6b0d5a..16d0687 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -288,13 +288,13 @@ typedef GFC_UINTEGER_4 gfc_char4_t;
/* M{IN,AX}{LOC,VAL} need also infinities and NaNs if supported. */
-#ifdef __FLT_HAS_INFINITY__
+#if __FLT_HAS_INFINITY__
# define GFC_REAL_4_INFINITY __builtin_inff ()
#endif
-#ifdef __DBL_HAS_INFINITY__
+#if __DBL_HAS_INFINITY__
# define GFC_REAL_8_INFINITY __builtin_inf ()
#endif
-#ifdef __LDBL_HAS_INFINITY__
+#if __LDBL_HAS_INFINITY__
# ifdef HAVE_GFC_REAL_10
# define GFC_REAL_10_INFINITY __builtin_infl ()
# endif
@@ -306,13 +306,13 @@ typedef GFC_UINTEGER_4 gfc_char4_t;
# endif
# endif
#endif
-#ifdef __FLT_HAS_QUIET_NAN__
+#if __FLT_HAS_QUIET_NAN__
# define GFC_REAL_4_QUIET_NAN __builtin_nanf ("")
#endif
-#ifdef __DBL_HAS_QUIET_NAN__
+#if __DBL_HAS_QUIET_NAN__
# define GFC_REAL_8_QUIET_NAN __builtin_nan ("")
#endif
-#ifdef __LDBL_HAS_QUIET_NAN__
+#if __LDBL_HAS_QUIET_NAN__
# ifdef HAVE_GFC_REAL_10
# define GFC_REAL_10_QUIET_NAN __builtin_nanl ("")
# endif
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index ff6b852..a401dba 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -272,7 +272,7 @@ gf_strerror (int errnum,
p = strerror (errnum);
return p;
#elif defined(HAVE_STRERROR_R)
-#ifdef HAVE_USELOCALE
+#ifdef HAVE_POSIX_2008_LOCALE
/* Some targets (Darwin at least) have the POSIX 2008 extended
locale functions, but not strerror_l. So reset the per-thread
locale here. */