aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgfortran
diff options
context:
space:
mode:
authorYiran Wang <yiran@google.com>2015-06-23 15:33:17 -0700
committerYiran Wang <yiran@google.com>2015-06-29 10:56:28 -0700
commit1d9fec7937f45dde5e04cac966a2d9a12f2fc15a (patch)
tree3fbcd18a379a05fd6d43491a107e1f36bc61b185 /gcc-4.9/libgfortran
parentf378ebf14df0952eae870c9865bab8326aa8f137 (diff)
downloadtoolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.gz
toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.bz2
toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.zip
Synchronize with google/gcc-4_9 to r224707 (from r214835)
Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d
Diffstat (limited to 'gcc-4.9/libgfortran')
-rw-r--r--gcc-4.9/libgfortran/ChangeLog28
-rw-r--r--gcc-4.9/libgfortran/config.h.in3
-rwxr-xr-xgcc-4.9/libgfortran/configure10
-rw-r--r--gcc-4.9/libgfortran/configure.ac3
-rw-r--r--gcc-4.9/libgfortran/io/unit.c1
-rw-r--r--gcc-4.9/libgfortran/runtime/main.c44
-rw-r--r--gcc-4.9/libgfortran/runtime/memory.c4
7 files changed, 73 insertions, 20 deletions
diff --git a/gcc-4.9/libgfortran/ChangeLog b/gcc-4.9/libgfortran/ChangeLog
index e0a003cb2..6b9954930 100644
--- a/gcc-4.9/libgfortran/ChangeLog
+++ b/gcc-4.9/libgfortran/ChangeLog
@@ -1,3 +1,31 @@
+2014-10-30 Release Manager
+
+ * GCC 4.9.2 released.
+
+2014-10-20 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/63589
+ * configure.ac: Check for strtok_r.
+ * runtime/main.c (gfstrtok_r): Fallback implementation of
+ strtok_r.
+ (find_addr2line): Use strtok_r to split PATH.
+ * config.h.in: Regenerated.
+ * configure: Regenerated.
+
+2014-10-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/63460
+ * io/unit.c (init_units): Initialize the DELIM flag to
+ UNSPECIFIED for the STDIN unit so that the flag is
+ correctly set later.
+
+2014-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2014-08-04 Jakub Jelinek <jakub@redhat.com>
+
+ * runtime/memory.c (xmallocarray): Avoid division for the common case.
+
2014-08-20 Steven G. Kargl <kargl@gcc.gnu.org>
PR libgfortran/62188
diff --git a/gcc-4.9/libgfortran/config.h.in b/gcc-4.9/libgfortran/config.h.in
index 8298f8d78..5c9de02ac 100644
--- a/gcc-4.9/libgfortran/config.h.in
+++ b/gcc-4.9/libgfortran/config.h.in
@@ -732,6 +732,9 @@
/* Define to 1 if you have the `strtof' function. */
#undef HAVE_STRTOF
+/* Define to 1 if you have the `strtok_r' function. */
+#undef HAVE_STRTOK_R
+
/* Define to 1 if you have the `strtold' function. */
#undef HAVE_STRTOLD
diff --git a/gcc-4.9/libgfortran/configure b/gcc-4.9/libgfortran/configure
index 8a1002c84..d3a40f381 100755
--- a/gcc-4.9/libgfortran/configure
+++ b/gcc-4.9/libgfortran/configure
@@ -2599,6 +2599,7 @@ as_fn_append ac_func_list " getegid"
as_fn_append ac_func_list " secure_getenv"
as_fn_append ac_func_list " __secure_getenv"
as_fn_append ac_func_list " mkostemp"
+as_fn_append ac_func_list " strtok_r"
as_fn_append ac_header_list " math.h"
# Check that the precious variables saved in the cache have kept the same
# value.
@@ -12358,7 +12359,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12349 "configure"
+#line 12362 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12464,7 +12465,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12455 "configure"
+#line 12468 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16488,6 +16489,9 @@ $as_echo "#define HAVE_LOCALTIME_R 1" >>confdefs.h
$as_echo "#define HAVE_GMTIME_R 1" >>confdefs.h
+$as_echo "#define HAVE_STRTOK_R 1" >>confdefs.h
+
+
# At some point, we should differentiate between architectures
# like x86, which have long double versions, and alpha/powerpc/etc.,
# which don't. For the time being, punt.
@@ -16620,6 +16624,8 @@ done
+
+
fi
# Check strerror_r, cannot be above as versions with two and three arguments exist
diff --git a/gcc-4.9/libgfortran/configure.ac b/gcc-4.9/libgfortran/configure.ac
index de2d65e76..e93012395 100644
--- a/gcc-4.9/libgfortran/configure.ac
+++ b/gcc-4.9/libgfortran/configure.ac
@@ -272,6 +272,7 @@ if test "x${with_newlib}" = "xyes"; then
AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.])
AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.])
AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.])
+ AC_DEFINE(HAVE_STRTOK_R, 1, [Define if you have strtok_r.])
# At some point, we should differentiate between architectures
# like x86, which have long double versions, and alpha/powerpc/etc.,
@@ -286,7 +287,7 @@ else
strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
readlink getgid getpid getppid getuid geteuid umask getegid \
- secure_getenv __secure_getenv mkostemp)
+ secure_getenv __secure_getenv mkostemp strtok_r)
fi
# Check strerror_r, cannot be above as versions with two and three arguments exist
diff --git a/gcc-4.9/libgfortran/io/unit.c b/gcc-4.9/libgfortran/io/unit.c
index d191a8ae2..f8bd5d327 100644
--- a/gcc-4.9/libgfortran/io/unit.c
+++ b/gcc-4.9/libgfortran/io/unit.c
@@ -580,6 +580,7 @@ init_units (void)
u->flags.position = POSITION_ASIS;
u->flags.sign = SIGN_SUPPRESS;
u->flags.decimal = DECIMAL_POINT;
+ u->flags.delim = DELIM_UNSPECIFIED;
u->flags.encoding = ENCODING_DEFAULT;
u->flags.async = ASYNC_NO;
u->flags.round = ROUND_UNSPECIFIED;
diff --git a/gcc-4.9/libgfortran/runtime/main.c b/gcc-4.9/libgfortran/runtime/main.c
index 58ec6cc49..a103c554b 100644
--- a/gcc-4.9/libgfortran/runtime/main.c
+++ b/gcc-4.9/libgfortran/runtime/main.c
@@ -153,6 +153,16 @@ full_exe_path (void)
}
+#ifndef HAVE_STRTOK_R
+static char*
+gfstrtok_r (char *str, const char *delim,
+ char **saveptr __attribute__ ((unused)))
+{
+ return strtok (str, delim);
+}
+#define strtok_r gfstrtok_r
+#endif
+
char *addr2line_path;
/* Find addr2line and store the path. */
@@ -161,30 +171,32 @@ void
find_addr2line (void)
{
#ifdef HAVE_ACCESS
-#define A2L_LEN 10
+#define A2L_LEN 11
char *path = secure_getenv ("PATH");
if (!path)
return;
+ char *tp = strdup (path);
+ if (!tp)
+ return;
size_t n = strlen (path);
- char ap[n + 1 + A2L_LEN];
- size_t ai = 0;
- for (size_t i = 0; i < n; i++)
+ char *ap = xmalloc (n + A2L_LEN);
+ char *saveptr;
+ for (char *str = tp;; str = NULL)
{
- if (path[i] != ':')
- ap[ai++] = path[i];
- else
+ char *token = strtok_r (str, ":", &saveptr);
+ if (!token)
+ break;
+ size_t toklen = strlen (token);
+ memcpy (ap, token, toklen);
+ memcpy (ap + toklen, "/addr2line", A2L_LEN);
+ if (access (ap, R_OK|X_OK) == 0)
{
- ap[ai++] = '/';
- memcpy (ap + ai, "addr2line", A2L_LEN);
- if (access (ap, R_OK|X_OK) == 0)
- {
- addr2line_path = strdup (ap);
- return;
- }
- else
- ai = 0;
+ addr2line_path = strdup (ap);
+ break;
}
}
+ free (tp);
+ free (ap);
#endif
}
diff --git a/gcc-4.9/libgfortran/runtime/memory.c b/gcc-4.9/libgfortran/runtime/memory.c
index c1e735894..d3b77de4b 100644
--- a/gcc-4.9/libgfortran/runtime/memory.c
+++ b/gcc-4.9/libgfortran/runtime/memory.c
@@ -56,7 +56,9 @@ xmallocarray (size_t nmemb, size_t size)
if (!nmemb || !size)
size = nmemb = 1;
- else if (nmemb > SIZE_MAX / size)
+#define HALF_SIZE_T (((size_t) 1) << (__CHAR_BIT__ * sizeof (size_t) / 2))
+ else if (__builtin_expect ((nmemb | size) >= HALF_SIZE_T, 0)
+ && nmemb > SIZE_MAX / size)
{
errno = ENOMEM;
os_error ("Integer overflow in xmallocarray");