diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2016-04-12 13:39:01 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2016-04-13 11:36:36 +0200 |
commit | 690ad47d37c8585f546f7ddeb28fb28d7b6cc73f (patch) | |
tree | 6b60258795fdf8a42ac410e0e1f406055f9b4146 /libgfortran | |
parent | 55d3bceea8eef018564a026e615af58cca5d6273 (diff) |
Merge branches/gcc-5-branch rev 234898.linaro-local/Merge-gcc-5-branch-04-3
Change-Id: I076a131171e689eede74dd1827406c6d3855fcbd
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 16 | ||||
-rw-r--r-- | libgfortran/caf/libcaf.h | 4 | ||||
-rw-r--r-- | libgfortran/caf/single.c | 17 | ||||
-rw-r--r-- | libgfortran/io/write_float.def | 26 |
4 files changed, 55 insertions, 8 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f53de385ea1..b3952c36f50 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,17 @@ +2016-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + Dominique d'Humieres <dominiq@lps.ens.fr> + + PR libgfortran/70235 + * io/write_float.def: Fix PF format for negative values of the scale + factor. + +2016-03-28 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + + Backport from trunk. + * caf/libcaf.h: caf_stop_numeric and caf_stop_str prototype. + * caf/single.c: _gfortran_caf_stop_numeric and + _gfortran_caf_stop_str implementation. + 2016-02-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/69651 @@ -18,7 +32,7 @@ (read_character): Remove condition testing c = '!' which is now inside the is_separator macro. Remove code related to DELIM_NONE. (parse_real): Reject '!' unless in namelist mode. (read_complex): Reject - '!' unless in namelist mode. (read_real): Likewise reject '!'. + '!' unless in namelist mode. (read_real): Likewise reject '!'. 2015-12-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h index ebda579d06c..ef86dd367e4 100644 --- a/libgfortran/caf/libcaf.h +++ b/libgfortran/caf/libcaf.h @@ -105,6 +105,10 @@ void _gfortran_caf_sync_all (int *, char *, int); void _gfortran_caf_sync_memory (int *, char *, int); void _gfortran_caf_sync_images (int, int[], int *, char *, int); +void _gfortran_caf_stop_numeric (int32_t) + __attribute__ ((noreturn)); +void _gfortran_caf_stop_str (const char *, int32_t) + __attribute__ ((noreturn)); void _gfortran_caf_error_stop_str (const char *, int32_t) __attribute__ ((noreturn)); void _gfortran_caf_error_stop (int32_t) __attribute__ ((noreturn)); diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c index 9c4b3434f5c..e95b798902a 100644 --- a/libgfortran/caf/single.c +++ b/libgfortran/caf/single.c @@ -204,6 +204,23 @@ _gfortran_caf_sync_images (int count __attribute__ ((unused)), *stat = 0; } +void +_gfortran_caf_stop_numeric(int32_t stop_code) +{ + fprintf (stderr, "STOP %d\n", stop_code); + exit (0); +} + +void +_gfortran_caf_stop_str(const char *string, int32_t len) +{ + fputs ("STOP ", stderr); + while (len--) + fputc (*(string++), stderr); + fputs ("\n", stderr); + + exit (0); +} void _gfortran_caf_error_stop_str (const char *string, int32_t len) diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index b983c784498..f79bf334e5e 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -184,9 +184,6 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, memmove (digits + nbefore, digits + nbefore + 1, p); digits[nbefore + p] = '.'; nbefore += p; - nafter = d - p; - if (nafter < 0) - nafter = 0; nafter = d; nzero = 0; } @@ -204,12 +201,27 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, { nzero = -(nbefore + p); memmove (digits + 1, digits, nbefore); - digits++; - nafter = d + nbefore; + nafter = d - nzero; + if (nafter == 0 && d > 0) + { + /* This is needed to get the correct rounding. */ + memmove (digits + 1, digits, ndigits - 1); + digits[1] = '0'; + nafter = 1; + nzero = d - 1; + } + else if (nafter < 0) + { + /* Reset digits to 0 in order to get correct rounding + towards infinity. */ + for (i = 0; i < ndigits; i++) + digits[i] = '0'; + digits[ndigits - 1] = '1'; + nafter = d; + nzero = 0; + } nbefore = 0; } - if (nzero > d) - nzero = d; } } else |