aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/libgfortran
diff options
context:
space:
mode:
authorsynergydev <synergye@codefi.re>2013-10-17 18:16:42 -0700
committersynergydev <synergye@codefi.re>2013-10-17 18:16:42 -0700
commit61c0330cc243abf13fdd01f377a7f80bd3989eb1 (patch)
tree119b08ae76294f23e2b1b7e72ff9a06afa9e8509 /gcc-4.8/libgfortran
parent1c712bf7621f3859c33fd3afaa61fdcaf3fdfd76 (diff)
downloadtoolchain_gcc-61c0330cc243abf13fdd01f377a7f80bd3989eb1.tar.gz
toolchain_gcc-61c0330cc243abf13fdd01f377a7f80bd3989eb1.tar.bz2
toolchain_gcc-61c0330cc243abf13fdd01f377a7f80bd3989eb1.zip
[4.8] Merge GCC 4.8.2
Change-Id: I0f1fcf69c5076d8534c5c45562745e1a37adb197
Diffstat (limited to 'gcc-4.8/libgfortran')
-rw-r--r--gcc-4.8/libgfortran/ChangeLog27
-rw-r--r--gcc-4.8/libgfortran/config/fpu-387.h44
-rw-r--r--gcc-4.8/libgfortran/io/list_read.c32
3 files changed, 77 insertions, 26 deletions
diff --git a/gcc-4.8/libgfortran/ChangeLog b/gcc-4.8/libgfortran/ChangeLog
index 99b919641..cd7a210e5 100644
--- a/gcc-4.8/libgfortran/ChangeLog
+++ b/gcc-4.8/libgfortran/ChangeLog
@@ -1,3 +1,30 @@
+2013-10-16 Release Manager
+
+ * GCC 4.8.2 released.
+
+2013-10-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55469
+ * io/list_read (parse_repeat, read_integer, read_character,
+ parse_real, read_real, check_type, list_formatted_read_scalar,
+ finish_list_read): Call list_free.
+
+2013-06-21 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2013-06-20 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/fpu-387.h (_FPU_MASK_ALL): New.
+ (_FPU_EX_ALL): Ditto.
+ (set_fpu): Use fstcw to store x87 FPU control word. Use fnclex to
+ clear stalled exception flags. Correctly clear stalled SSE
+ exception flags. Simplify code.
+
+ Backport from mainline
+ 2013-06-19 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/fpu-387.h: Use __asm__ and __volatile__ consistently.
+
2013-05-31 Release Manager
* GCC 4.8.1 released.
diff --git a/gcc-4.8/libgfortran/config/fpu-387.h b/gcc-4.8/libgfortran/config/fpu-387.h
index 913eb60b1..9c80fffea 100644
--- a/gcc-4.8/libgfortran/config/fpu-387.h
+++ b/gcc-4.8/libgfortran/config/fpu-387.h
@@ -73,7 +73,7 @@ has_sse (void)
/* We need a single SSE instruction here so the handler can safely skip
over it. */
- __asm__ volatile ("movaps %xmm0,%xmm0");
+ __asm__ __volatile__ ("movaps\t%xmm0,%xmm0");
sigaction (SIGILL, &oact, NULL);
@@ -95,42 +95,42 @@ has_sse (void)
#define _FPU_MASK_OM 0x08
#define _FPU_MASK_UM 0x10
#define _FPU_MASK_PM 0x20
+#define _FPU_MASK_ALL 0x3f
+
+#define _FPU_EX_ALL 0x3f
void set_fpu (void)
{
+ int excepts = 0;
unsigned short cw;
- asm volatile ("fnstcw %0" : "=m" (cw));
+ __asm__ __volatile__ ("fstcw\t%0" : "=m" (cw));
- cw |= (_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM
- | _FPU_MASK_UM | _FPU_MASK_PM);
+ if (options.fpe & GFC_FPE_INVALID) excepts |= _FPU_MASK_IM;
+ if (options.fpe & GFC_FPE_DENORMAL) excepts |= _FPU_MASK_DM;
+ if (options.fpe & GFC_FPE_ZERO) excepts |= _FPU_MASK_ZM;
+ if (options.fpe & GFC_FPE_OVERFLOW) excepts |= _FPU_MASK_OM;
+ if (options.fpe & GFC_FPE_UNDERFLOW) excepts |= _FPU_MASK_UM;
+ if (options.fpe & GFC_FPE_INEXACT) excepts |= _FPU_MASK_PM;
- if (options.fpe & GFC_FPE_INVALID) cw &= ~_FPU_MASK_IM;
- if (options.fpe & GFC_FPE_DENORMAL) cw &= ~_FPU_MASK_DM;
- if (options.fpe & GFC_FPE_ZERO) cw &= ~_FPU_MASK_ZM;
- if (options.fpe & GFC_FPE_OVERFLOW) cw &= ~_FPU_MASK_OM;
- if (options.fpe & GFC_FPE_UNDERFLOW) cw &= ~_FPU_MASK_UM;
- if (options.fpe & GFC_FPE_INEXACT) cw &= ~_FPU_MASK_PM;
+ cw |= _FPU_MASK_ALL;
+ cw &= ~excepts;
- asm volatile ("fldcw %0" : : "m" (cw));
+ __asm__ __volatile__ ("fnclex\n\tfldcw\t%0" : : "m" (cw));
if (has_sse())
{
unsigned int cw_sse;
- asm volatile ("%vstmxcsr %0" : "=m" (cw_sse));
+ __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse));
- cw_sse &= 0xffff0000;
- cw_sse |= (_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM
- | _FPU_MASK_UM | _FPU_MASK_PM ) << 7;
+ /* The SSE exception masks are shifted by 7 bits. */
+ cw_sse |= _FPU_MASK_ALL << 7;
+ cw_sse &= ~(excepts << 7);
- if (options.fpe & GFC_FPE_INVALID) cw_sse &= ~(_FPU_MASK_IM << 7);
- if (options.fpe & GFC_FPE_DENORMAL) cw_sse &= ~(_FPU_MASK_DM << 7);
- if (options.fpe & GFC_FPE_ZERO) cw_sse &= ~(_FPU_MASK_ZM << 7);
- if (options.fpe & GFC_FPE_OVERFLOW) cw_sse &= ~(_FPU_MASK_OM << 7);
- if (options.fpe & GFC_FPE_UNDERFLOW) cw_sse &= ~(_FPU_MASK_UM << 7);
- if (options.fpe & GFC_FPE_INEXACT) cw_sse &= ~(_FPU_MASK_PM << 7);
+ /* Clear stalled exception flags. */
+ cw_sse &= ~_FPU_EX_ALL;
- asm volatile ("%vldmxcsr %0" : : "m" (cw_sse));
+ __asm__ __volatile__ ("%vldmxcsr\t%0" : : "m" (cw_sse));
}
}
diff --git a/gcc-4.8/libgfortran/io/list_read.c b/gcc-4.8/libgfortran/io/list_read.c
index 5a44bdf78..60f4549cd 100644
--- a/gcc-4.8/libgfortran/io/list_read.c
+++ b/gcc-4.8/libgfortran/io/list_read.c
@@ -616,6 +616,7 @@ parse_repeat (st_parameter_dt *dtp)
free_saved (dtp);
if (c == EOF)
{
+ free_line (dtp);
hit_eof (dtp);
return 1;
}
@@ -905,11 +906,14 @@ read_integer (st_parameter_dt *dtp, int length)
free_saved (dtp);
if (c == EOF)
{
+ free_line (dtp);
hit_eof (dtp);
return;
}
else if (c != '\n')
eat_line (dtp);
+
+ free_line (dtp);
snprintf (message, MSGLEN, "Bad integer for item %d in list input",
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
@@ -1079,7 +1083,6 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
unget_char (dtp, c);
eat_separator (dtp);
dtp->u.p.saved_type = BT_CHARACTER;
- free_line (dtp);
}
else
{
@@ -1088,10 +1091,12 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
}
+ free_line (dtp);
return;
eof:
free_saved (dtp);
+ free_line (dtp);
hit_eof (dtp);
}
@@ -1286,11 +1291,14 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
free_saved (dtp);
if (c == EOF)
{
+ free_line (dtp);
hit_eof (dtp);
return 1;
}
else if (c != '\n')
eat_line (dtp);
+
+ free_line (dtp);
snprintf (message, MSGLEN, "Bad floating point number for item %d",
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
@@ -1391,11 +1399,14 @@ eol_4:
free_saved (dtp);
if (c == EOF)
{
+ free_line (dtp);
hit_eof (dtp);
return;
}
else if (c != '\n')
eat_line (dtp);
+
+ free_line (dtp);
snprintf (message, MSGLEN, "Bad complex value in item %d of list input",
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
@@ -1630,7 +1641,10 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
eat_separator (dtp);
push_char (dtp, '\0');
if (convert_real (dtp, dest, dtp->u.p.saved_string, length))
- return;
+ {
+ free_saved (dtp);
+ return;
+ }
free_saved (dtp);
dtp->u.p.saved_type = BT_REAL;
@@ -1768,12 +1782,14 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
free_saved (dtp);
if (c == EOF)
{
+ free_line (dtp);
hit_eof (dtp);
return;
}
else if (c != '\n')
eat_line (dtp);
+ free_line (dtp);
snprintf (message, MSGLEN, "Bad real number in item %d of list input",
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
@@ -1790,6 +1806,7 @@ check_type (st_parameter_dt *dtp, bt type, int len)
if (dtp->u.p.saved_type != BT_UNKNOWN && dtp->u.p.saved_type != type)
{
+ free_line (dtp);
snprintf (message, MSGLEN, "Read type %s where %s was expected for item %d",
type_name (dtp->u.p.saved_type), type_name (type),
dtp->u.p.item_count);
@@ -1803,6 +1820,7 @@ check_type (st_parameter_dt *dtp, bt type, int len)
if (dtp->u.p.saved_length != len)
{
+ free_line (dtp);
snprintf (message, MSGLEN,
"Read kind %d %s where kind %d is required for item %d",
dtp->u.p.saved_length, type_name (dtp->u.p.saved_type), len,
@@ -1976,7 +1994,10 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p,
cleanup:
if (err == LIBERROR_END)
- hit_eof (dtp);
+ {
+ free_line (dtp);
+ hit_eof (dtp);
+ }
return err;
}
@@ -2024,7 +2045,10 @@ finish_list_read (st_parameter_dt *dtp)
err = eat_line (dtp);
if (err == LIBERROR_END)
- hit_eof (dtp);
+ {
+ free_line (dtp);
+ hit_eof (dtp);
+ }
}
/* NAMELIST INPUT