Commit Graph

69 Commits

Author SHA1 Message Date
John David Anglin b7ca376ae9 re PR libfortran/79540 (FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test)
PR libgfortran/79540
	* io/write_float.def (build_float_string): Don't copy digits when
	ndigits is negative.

From-SVN: r269911
2019-03-25 11:48:36 +00:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Jerry DeLisle 3a579cbe07 re PR libfortran/86070 (gfortran.dg/fmt_zero_digits.f90 segmentation fault starting with r261077)
2018-06-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/86070
	* io/write_float.def (build_float_string): Initialize *len.

From-SVN: r261382
2018-06-10 01:49:02 +00:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Jerry DeLisle 5dcf68f510 re PR libfortran/77393 (Revision r237735 changed the behavior of F0.0)
2016-09-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/77393
	* io/write_float.def (build_float_string): Recognize when the
	result will not fit in the user provided, star fill, and exit
	early.

	* gfortran.dg/fmt_f0_2.f90: Update test.
	* gfortran.dg/fmt_f0_3.f90: New test.

From-SVN: r240018
2016-09-06 23:22:26 +00:00
Jerry DeLisle 5b0e27a724 re PR libfortran/48852 (Invalid spaces in list-directed output of complex constants)
2016-06-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48852
	* io/write.c: Cleaned up whitespace.
	(write_d, write_e, write_f, write_es, write_en): Use new helper function
	write_float_0. (write_float_0): New helper function.
	(get_precision, select_buffer, select_string, write_float_string): New
	helper functions used in remaining float writing functions. Helper function
	write_float_string now contains code for writing to kind=4 character
	internal units.
	(write_real): Modified to establish working buffers at this level and to
	use new helper functions.
	(write_real_g0): Likewise modified.
	(write_complex): Likewise modified. Gets both float strings before
	output so that final lengths can be determined which allows right
	justifying the complex number with no intervening spaces.
	* io/write_float.def (build_float_string): Renamed from previosly
	output_float, modified to use buffers passed in from higher functions,
	builds a null terminated string of the floating point value. Character
	kind=4 code eliminated.
	(write_infnan): Likewise modified to use incoming buffers and eliminate
	kind=4 related code.
	(OUTPUT_FLOAT_FMT_G): Deleted, functionality moved into FORMAT_FLOAT.
	(FORMAT_FLOAT): Renamed macro from WRITE_FLOAT. Use build_float_string.
	(get_float_string): Renamed from write_float, uses FORMAT_FLOAT macro.
	Buffer allocation removed, now at higher level.

	PR libgfortran/48852
	* gfortran.dg/char4_iunit_1.f03: Update test.
	* gfortran.dg/f2003_io_5.f03: Update test.
	* gfortran.dg/real_const_3.f90: Update test.

From-SVN: r237735
2016-06-23 15:58:05 +00:00
Dominique d'Humieres e0876e21cf [multiple changes]
2016-03-30  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-30  Dominique d'Humieres  <dominiq@lps.ens.fr>
	    Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* gfortran.dg/fmt_pf.f90: New test.

From-SVN: r234600
2016-03-30 22:47:45 +02:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Juoko Orava 9df47e83ee re PR fortran/50201 (gfortran with -static causes seg fault at runtime for writing double prec array with precision increased to kind=16)
2015-12-05  Juoko Orava <jouko.orava@iki.fi>

	PR fortran/50201
	* io/write_float.def: Avoid marking quadmath_snprintf as an untyped
	weak reference, which fixing linking with -static.

From-SVN: r231320
2015-12-05 18:12:26 +00:00
Jerry DeLisle ba67259c00 write_float.def (output_float): Move block determining room for leading zero to before checkng g0 formatting.
2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/write_float.def (output_float): Move block determining
	room for leading zero to before checkng g0 formatting.

From-SVN: r230728
2015-11-22 22:14:46 +00:00
Francois-Xavier Coudert 5cdf54b765 re PR libfortran/57496 (I/O: WRITE(*,*) HUGE(0._10) gives SIGFPE with -ffpe-trap=overflow)
PR libfortran/57496
	* io/write_float.def: Use built-in type-generic functions defined
	by libgfortran.h for isfinite, isnan, and signbit.

From-SVN: r227136
2015-08-24 16:31:47 +00:00
Jerry DeLisle 80f6181e27 re PR fortran/57822 (I/O: "(g0)" wrongly prints "E+0000")
2015-02-10 Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/57822
	* io/write_float.def (output_float): Apply fix of previous patch
	to correctly calculate the exponent number of digits and take
	care of wide character output.

From-SVN: r220606
2015-02-11 04:29:06 +00:00
Jerry DeLisle 94ce26f1b7 re PR fortran/57822 (I/O: "(g0)" wrongly prints "E+0000")
2015-02-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/57822
	* io/write_float.def (output_float): If doing g0 editing and
	exponent is zero, do not emit exponent.

From-SVN: r220564
2015-02-10 02:49:58 +00:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Janne Blomqvist 581d232670 PR 60324 Unbounded stack allocations in libgfortran.
2014-11-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/60324
	* configure: Regenerated.
	* configure.ac (AM_CFLAGS): Add Werror=vla.
	* libgfortran.h (gfc_alloca): Remove macro.
	(fc_strdup_notrim): New prototype.
	* intrinsics/access.c (access_func): Use fc_strdup rather than
	stack allocation.
	* intrinsics/chdir.c (chdir_i4_sub): Likewise.
	(chdir_i8_sub): Likewise.
	* intrinsics/chmod.c (chmod_internal): New function, move logic
	here.
	(chmod_func): Call chmod_internal.
	* intrinsics/env.c (getenv): Use fc_strdup rather than stack
	allocation.
	(get_environment_variable_i4): Likewise.
	* intrinsics/execute_command_line.c (execute_command_line):
	Likewise.
	* intrinsics/hostnm.c (hostnm_0): New function, use static buffer
	rather than VLA.
	(hostnm_i4_sub): Call hostnm_0.
	(hostnm_i8_sub): Likewise.
	(hostnm): Likewise.
	* intrinsics/link.c (link_internal): New function, use fc_strdup
	rather than stack allocation.
	(link_i4_sub): Call link_internal.
	(link_i8_sub): Likewise.
	(link_i4): Likewise.
	(link_i8): Likewise.
	* intrinsics/perror.c (perror_sub): Use fc_strdup rather than
	stack allocation.
	* intrinsics/random.c (random_seed_i4): Use static buffer rather
	than VLA, use _Static_assert to make sure it's big enough.
	* intrinsics/rename.c (rename_internal): New function, use
	fc_strdup rather than stack allocation.
	(rename_i4_sub): Call rename_internal.
	(rename_i8_sub): Likewise.
	(rename_i4): Likewise.
	(rename_i8): Likewise.
	* intrinsics/stat.c (stat_i4_sub_0): Use fc_strdup rather than
	stack allocation.
	(stat_i8_sub_0): Likewise.
	* intrinsics/symlink.c (symlnk_internal): New function, use
	fc_strdup rather than stack allocation.
	(symlnk_i4_sub): Call symlnk_internal.
	(symlnk_i8_sub): Likewise.
	(symlnk_i4): Likewise.
	(symlnk_i8): Likewise.
	* intrinsics/system.c (system_sub): Use fc_strdup rather than
	stack allocation.
	* intrinsics/unlink.c (unlink_i4_sub): Likewise.
	* io/file_pos.c (READ_CHUNK): Make it a macro rather than variable.
	* io/list_read.c (nml_get_obj_data): Use fixed stack buffer, fall
	back to xmalloc/free for large sizes.
	* io/read.c (read_f): Likewise.
	* io/transfer.c (MAX_READ): Make it a macro rather than variable.
	(WRITE_CHUNK): Likewise.
	* io/write_float.def (write_float): Use fixed stack buffer, fall
	back to xmalloc/free for large sizes.
	* runtime/string.c (fc_strdup_notrim): New function.

From-SVN: r217480
2014-11-13 14:05:01 +02:00
Dominique d'Humieres 4e185d7cee re PR fortran/60128 (Wrong ouput using en edit descriptor)
2014-03-08  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR libgfortran/60128
	* io/write_float.def (output_float): Remove unused variable
	nzero_real. Replace a double space with a single one.
	(determine_en_precision): Fix wrong handling of the EN format.

	PR libfortran/60128
	* gfortran.dg/fmt_en.f90: New test.

From-SVN: r208423
2014-03-08 06:04:34 +00:00
Jerry DeLisle 91d45414d8 write_float.def (output_float): Remove inadvertent test code from previous patch.
2014-01-20  Jerry DeLisle  <jvdelisle@gcc.gnu>
	    Dominique d'Humieres  <dominiq@lps.ens.fr>

	* io/write_float.def (output_float): Remove inadvertent test
	code from previous patch.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>

From-SVN: r206865
2014-01-21 02:39:53 +00:00
Jerry DeLisle 32aeb94ab1 re PR libfortran/59771 (Cleanup handling of Gw.0 and Gw.0Ee format)
2014-01-19  Jerry DeLisle  <jvdelisle@gcc.gnu>
	    Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR libfortran/59771
	PR libfortran/59774
	PR libfortran/59836
	* io/write_float.def (output_float): Fix wrong handling of the
	Fw.0 format.
	(output_float_FMT_G_): Fixes rounding issues with -m32.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>

From-SVN: r206785
2014-01-19 23:17:43 +00:00
Richard Sandiford f0bcf62899 Update copyright years in libgfortran/
From-SVN: r206296
2014-01-02 22:25:45 +00:00
Tobias Burnus c2b2130c71 re PR libfortran/57496 (I/O: WRITE(*,*) HUGE(0._10) gives SIGFPE with -ffpe-trap=overflow)
2013-06-01  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57496
        * io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L,
        * ISFINITE,
        SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2,
        ISNAN2L, ISNAN): New macros.
        (output_float_FMT_G_,WRITE_FLOAT): Use them.

From-SVN: r199598
2013-06-03 11:20:46 +02:00
Janne Blomqvist f5e3ed2d42 Use C99 bool instead of enum try.
2013-03-19  Janne Blomqvist  <jb@gcc.gnu.org>

	* libgfortran.h: Include stdbool.h.
	(enum try): Remove.
	(notify_std): Change return type to bool.
	* intrinsics/chmod.c: Don't include stdbool.h.
	* intrinsics/execute_command_line.c: Likewise.
	* io/format.c: Likewise.
	* io/list_read.c (nml_parse_qualifier): Change return type to bool.
	(nml_read_obj): Likewise.
	(nml_get_obj_data): Likewise.
	* io/transfer.c (read_block_form): Fix comment.
	(write_buf): Change return type to bool.
	* io/write.c: Don't include stdbool.h.
	* io/write_float.def (output_float): Change return type to bool.
	(output_float_FMT_G_ ## x): Change type of result variable.
	* runtime/error.c (notify_std): Change return type to bool.

From-SVN: r196791
2013-03-19 13:13:32 +02:00
Richard Sandiford e3c063ceda Update copyright years in libgfortran.
From-SVN: r195167
2013-01-14 18:20:58 +00:00
Janne Blomqvist eb3119f90f PR fortran/55539 Fix regression in -fno-sign-zero.
libgfortran ChangeLog:

2012-12-26  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/55539
	* io/write_float.def (output_float): Take into account decimal dot.

testsuite ChangeLog:

2012-12-26  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/55539
	* gfortran.dg/nosigned_zero_3.f90: New testcase.

From-SVN: r194717
2012-12-26 00:11:16 +02:00
Janne Blomqvist 789ebabf1d PR libfortran/52608 Move the removal of initial zeros.
2012-03-17  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/52608
	* io/write_float.def (output_float): Move removal of initial zeros
	until after the scale factor has been applied.

From-SVN: r185486
2012-03-17 19:19:49 +02:00
Janne Blomqvist 192b716b10 Remove commented out debug printf:s
From-SVN: r185444
2012-03-15 23:56:13 +02:00
Janne Blomqvist 37b659dd29 re PR libfortran/52434 (Insufficient number of digits in floating point formatting)
2012-03-15  Janne Blomqvist  <jb@gcc.gnu.org>

        PR libfortran/52434
        PR libfortran/48878
        PR libfortran/38199
        * io/unit.c (get_internal_unit): Default to ROUND_UNSPECIFIED.
        (init_units): Likewise.
        * io/write_float.def (determine_precision): New function.
        (output_float): Take into account buffer with %f format, no need
        for our own rounding if unspecified or processor specified
        rounding.
        (DTOA): Simplify format string, add parameters.
        (FDTOA): New macros similar to DTOA, but using %f format.
        (OUTPUT_FLOAT_FMT_G): Stack allocate newf, determine correct
        precision and fill buffer.
        (EN_PREC): New macro.
        (determine_en_precision): New function.
        (WRITE_FLOAT): For G format, move buffer filling into
        output_float_FMT_G, use FDTOA for F format.
        (write_float): Increase buffer due to F format.

testsuite ChangeLog:

2012-03-15  Janne Blomqvist  <jb@gcc.gnu.org>

        PR libfortran/52434
        PR libfortran/48878
        PR libfortran/38199
        * gfortran.dg/edit_real_1.f90: Don't assume roundTiesToAway.
        * gfortran.dg/round_1.f03: Likewise.

From-SVN: r185433
2012-03-15 17:14:43 +02:00
Janne Blomqvist 992b0aa1cf Let the compiler decide whether to inline.
2011-11-10  Janne Blomqvist  <jb@gcc.gnu.org>

	* intrinsics/cpu_time.c (__cpu_time_1): Don't force inlining.
	* intrinsics/random.c (rnumber_4): Remove inline attribute.
	(rnumber_8, rnumber_10, rnumber_16): Likewise.
	* intrinsics/system_clock.c (gf_gettime_mono): Likewise.
	* intrinsics/time_1.h (ATTRIBUTE_ALWAYS_INLINE): Remove macro.
	(gf_cputime): Add inline attribute for MingW version.
	* io/format.c (format_hash): Remove inline attribute.
	* io/io.h (memset4): Inline function from transfer.c and write.c
	moved here.
	* io/transfer.c (min_off): Remove inline attribute.
	(memset4): Move to io.h.
	* io/write.c (memset4): Likewise.
	(memcpy4): Remove inline attribute.
	* io/write_float.def (calculate_exp): Likewise.

From-SVN: r181260
2011-11-10 19:08:24 +02:00
Jerry DeLisle d6b872ad5e re PR libfortran/48787 (Invalid UP/DOWN rounding with F editing)
2011-05-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48787
	* io/write_float.def (output_float): Adjust up and down rounding for
	cases where 'd' = 0. Gather common code to one location.

From-SVN: r173408
2011-05-05 01:19:30 +00:00
Jerry DeLisle 7c4f44cd60 re PR libfortran/48787 (Invalid UP/DOWN rounding with F editing)
2011-05-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48787
	* io/write_float.def (output_float): Gather up integer declarations and
	add new 'p' for scale factor. Use 'p' in place of the 'dtp' reference
	everywhere. For ROUND_UP scan the digit string and only perform
	rounding if something other than '0' is found.

From-SVN: r173231
2011-05-01 12:32:18 +00:00
Jerry DeLisle a3f02fe44c re PR libfortran/48488 (Wrong default format for real numbers)
2011-04-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Janne Blomqvist  <jb@gcc.gnu.org>

	PR libgfortran/48488
	PR libgfortran/48602
	PR libgfortran/48615
	PR libgfortran/48684
	PR libgfortran/48787
	* io/write.c (write_d, write_e, write_f, write_en,
	write_es): Add precision compemsation parameter to call.
	(set_fnode_default): Adjust default widths to assure
	round trip on write and read. (write_real): Adjust call to write_float.
	(write_real_g0): Calculate compensation for extra precision and adjust
	call to write_float. 
	* io/write_float.def (output_float_FMT_G_): Use volatile rather than
	asm volatile to avoid optimization issue. Correctly calculate the
	number of blanks (nb) to be appended and simplify calculation logic.
	(write_float): Increase MIN_FIELD_WIDTH by one to accomodate the new
	default widths. Eliminate the code that attempted to reduce the
	the precision used in later sprintf functions.  Add call parameter to
	compensate for extra precision.

Co-Authored-By: Janne Blomqvist <jb@gcc.gnu.org>

From-SVN: r173166
2011-04-29 14:56:02 +00:00
Jerry DeLisle b48de48389 re PR libfortran/48602 (Invalid F conversion of G descriptor for values close to powers of 10)
2011-04-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48602
	* io/write_float.def (output_float_FMT_G): Fix reversal in conditional.
	Use asm volatile to mark temp variable, avoiding optimization errors.

From-SVN: r172753
2011-04-20 04:18:25 +00:00
Jerry DeLisle bc7409a8a9 re PR libfortran/48602 (Invalid F conversion of G descriptor for values close to powers of 10)
2011-04-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48602
	* io/write_float.def (output_float_FMT_G): Use current rounding mode
	to set the rounding parameters. (output_float): Skip rounding
	if value is zero.

From-SVN: r172634
2011-04-18 03:48:25 +00:00
Janne Blomqvist d30fe1c5cd Replace sprintf with snprintf
From-SVN: r172590
2011-04-16 20:43:03 +03:00
Jerry DeLisle 0b0a0c945f re PR libfortran/48589 (Invalid G0/G0.d editing for NaN/infinity)
2011-04-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48589
	* io/write_float.def (write_infnan): Set width properly for G0.

From-SVN: r172502
2011-04-15 16:29:44 +00:00
Jerry DeLisle 8e71a20690 re PR libfortran/48047 (Incorrect output rounding of double precision numbers)
2011-03-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/48047
	* io/write_float.def (write_float): Change MIN_FIELD_WIDTH to 48.

From-SVN: r170895
2011-03-12 00:49:51 +00:00
Jerry DeLisle 0eac6ca562 re PR libfortran/47567 (Wrong output for small absolute values with F editing)
2011-02-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47567
	* io/write_float.def (output_float): Move handling of w = 0 to after
	output rounding. Check for zero and set zero_flag accordingly. Set
	width according to zero_flag. Add better comments.

From-SVN: r170585
2011-03-01 02:24:50 +00:00
Jerry DeLisle 5a30f819c7 re PR libfortran/47567 (Wrong output for small absolute values with F editing)
2011-02-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47567
	* io/write_float.def (output_float): Remove special case handling of
	zero with width 1.

From-SVN: r170458
2011-02-24 04:52:00 +00:00
Jerry DeLisle ffe89a288f re PR libfortran/47567 (Wrong output for small absolute values with F editing)
2011-02-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47567
	* io/write_float.def (output_float): Adjust width for F0.d to
	allow space for negative signs on zero.

From-SVN: r170318
2011-02-19 15:10:55 +00:00
Jakub Jelinek 1d92226be3 re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
	* libquadmath.texi (quadmath_snprintf): Document.
	(quadmath_flt128tostr): Remove.
	* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
	Remove  quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
	gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
	* quadmath.h (quadmath_snprintf): New prototype.
	(quadmath_flt128tostr): Remove.
	* quadmath_weak.h (quadmath_snprintf): Add.
	(quadmath_flt128tostr): Remove.
	* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
	wctype.h, limits.h, ctype.h, printf.h, errno.h.
	(AC_USE_SYSTEM_EXTENSIONS): Add.
	(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
	USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
	* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf.  Remove
	quadmath_flt128tostr.
	* printf/printf_fphex.c: New file.
	* printf/_itowa.h: New file.
	* printf/mul_n.c: New file.
	* printf/quadmath-printf.h: New file.
	* printf/submul_1.c: New file.
	* printf/quadmath-printf.c: New file.
	* printf/gmp-impl.h: New file.
	* printf/lshift.c: New file.
	* printf/fpioconst.h: New file.
	* printf/add_n.c: New file.
	* printf/cmp.c: New file.
	* printf/sub_n.c: New file.
	* printf/mul.c: New file.
	* printf/divrem.c: New file.
	* printf/addmul_1.c: New file.
	* printf/printf_fp.c: New file.
	* printf/_itoa.h: New file.
	* printf/fpioconst.c: New file.
	* printf/_i18n_number.h: New file.
	* printf/flt1282mpn.c: New file.
	* printf/rshift.c: New file.
	* printf/mul_1.c: New file.
	* quadmath_io.c: Removed.
	* gdtoa/gdtoa.c: Removed.
	* gdtoa/g__fmt.c: Removed.
	* gdtoa/g_Qfmt.c: Removed.
	* gdtoa/dmisc.c: Removed.
	* gdtoa/ulp.c: Removed.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.

	* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
	quadmath_flt128tostr.
	* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
	of quadmath_flt128tostr.

From-SVN: r170135
2011-02-14 16:34:44 +01:00
Jerry DeLisle 9e7628863b re PR libfortran/47567 (Wrong output for small absolute values with F editing)
2011-02-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47567
	* io/write_float.def (output_float): Eliminate some redundant code.
	Adjust width for case of F0.X for values of zero and all other values.
	Expand cases where '*' is set to give cleaner results.

From-SVN: r169853
2011-02-05 17:58:48 +00:00
Jerry DeLisle 6e0576ee50 re PR libfortran/47434 (Wrong field width for NaN with (F0.n) formatting)
2011-01-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47434
	* io/write_float.def (write_infnan): Use calculate_sign to determine
	if the sign should be given and check field widths accordingly.

From-SVN: r169390
2011-01-29 17:31:04 +00:00
Jerry DeLisle 434b897293 re PR libfortran/47285 (G format outputs wrong number of characters when decimal supplied in literal)
2011-01-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47285
	* io/write_float.def (output_float): Return SUCCESS or FAILURE and use
	the result to set the padding.

From-SVN: r169320
2011-01-27 02:16:18 +00:00
Jakub Jelinek e313241f91 re PR fortran/46625 (libquadmath: Mangle internal symbols; rename __float128 <-> string functions)
PR fortran/46625
	* quadmath.map (QUADMATH_1.0): Remove quadmath_strtopQ
	and quadmath_dtoaq.  Add strtoflt128 and quadmath_flt128tostr.
	* quadmath_weak.h (quadmath_strtopQ, quadmath_dtoaq): Remove.
	(strtoflt128, quadmath_flt128tostr): Add.
	* gdtoa/strtopQ.c (quadmath_strtopQ): Rename to...
	(strtoflt128): ... this.  Return __float128, instead of writing
	to memory pointed by last argument.
	* quadmath.h: Use C style comments instead of C++ style.
	(quadmath_strtopQ, quadmath_dtoaq): Remove prototypes.
	(strtoflt128, quadmath_flt128tostr): Add prototypes.
	* libquadmath.texi (quadmath_dtoaq): Rename to quadmath_flt128tostr.
	(quadmath_strtopQ): Rename to strtoflt128.  Adjust prototype,
	adjust examples.
	* quadmath_io.c (quadmath_dtoaq): Rename to...
	(quadmath_flt128tostr): ... this.
libgfortran/
	* io/write_float.def (DTOAQ): Use quadmath_flt128tostr
	instead of quadmath_dtoa.
	* io/transfer128.c (tmp1, tmp2): New variables, bring in
	strtoflt128 and quadmath_flt128tostr.
	(transfer_real128, transfer_real128_write, transfer_complex128,
	transfer_complex128_write): Remove tmp1/tmp2 variables.
	* io/read.c (convert_real): Use strtoflt128 instead of
	quadmath_strtopQ, adjust for the changed arguments and return
	value.

From-SVN: r168856
2011-01-16 17:55:27 +01:00
Francois-Xavier Coudert 1ec601bf9f re PR fortran/32049 (Support on x86_64 also kind=16)
/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * Makefile.def: Add libquadmath; build it with language=fortran.
        * configure.ac: Add libquadmath.
        * Makefile.tpl: Handle multiple libs in check-[+language+].
        * Makefile.in: Regenerate.
        * configure: Regenerate.

libquadmath/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        Initial implementation and checkin.

gcc/fortran/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * gfortranspec.c (find_spec_file): New function.
        (lang_specific_driver): Try to find .spec file and use it.
        * trans-io.c (iocall): Define
        * IOCALL_X_REAL128/COMPLEX128(,write).
        (gfc_build_io_library_fndecls): Build decl for __float128 I/O.
        (transfer_expr): Call __float128 I/O functions.
        * trans-types.c (gfc_init_kinds): Allow kind-16 belonging
        to __float128.

gcc/testsuite/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * gfortran.dg/quad_1.f90: New.
        * lib/gcc-defs.exp (gcc-set-multilib-library-path): Use also
        compiler arguments.
        * lib/gfortran.exp (gfortran_link_flags): Add libquadmath to
        library search path; call gcc-set-multilib-library-path with
        arguments such that libgfortran.spec is found.
        (gfortran_init): Add path for libgfortran.spec to
GFORTRAN_UNDER_TEST.

libgomp/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * configure.ac: 
        * configure: Regenerate.

libgfortran/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * Makefile.am: Add missing pow_r16_i4.c, add transfer128.c,
        link libquadmath, if used.
        * acinclude.m4 (LIBGFOR_CHECK_FLOAT128): Add.
        * configure.ac: Use it, touch spec file.
        * gfortran.map: Add pow_r16_i4 and
        transfer_(real,complex)128(,write) functions.
        * intrinsics/cshift0.c (cshift0): Handle __float128 type.
        * intrinsics/erfc_scaled_inc.c: Ditto.
        * intrinsics/pack_generic.c (pack): Ditto
        * intrinsics/spread_generic.c (spread): Ditto.
        * intrinsics/unpack_generic.c (unpack1): Ditto.
        * io/read.c (convert_real): Ditto.
        * io/transfer.c: Update comments.
        * io/transfer128.c: New file.
        * io/write_float.def (write_float): Handle __float128 type.
        * libgfortran.h: #include quadmath_weak.h, define __builtin_infq
        and nanq.
        * m4/mtype.m4: Handle __float128 type.
        * runtime/in_pack_generic.c (internal_pack): Ditto.
        * runtime/in_unpack_generic.c (internal_unpack): Ditto.
        * kinds-override.h: New file.
        * libgfortran.spec.in: Ditto.
        * generated/pow_r16_i4.c: Generated.
        * Makefile.in: Regenerate.
        * configure: Regenerate.
        * config.h: Regenerate.
        * bessel_r10.c: Regenerate.
        * bessel_r16.c: Regenerate.
        * bessel_r4.c: Regenerate.
        * bessel_r8.c: Regenerate.
        * exponent_r16.c: Regenerate.
        * fraction_r16.c: Regenerate.
        * nearest_r16.c: Regenerate.
        * norm2_r10.c: Regenerate.
        * norm2_r16.c: Regenerate.
        * norm2_r4.c: Regenerate.
        * norm2_r8.c: Regenerate.
        * rrspacing_r16.c: Regenerate.
        * set_exponent_r16.c: Regenerate.
        * spacing_r16.c: Regenerate.


Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r166825
2010-11-16 22:23:19 +01:00
Francois-Xavier Coudert b1012ca4be acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE, [...]): Remove.
* acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE,
	LIBGFOR_CHECK_FOR_BROKEN_ISNAN,
	LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): Remove.
	* configure.ac: Remove above checks.
	* libgfortran.h: Define isnan, isinf, isfinite, isnormal and
	signbit in terms of the respective built-ins.
	* io/write_float.def (WRITE_FLOAT): Use signbit() instead of
	__builtin_signbit().
	* intrinsics/c99_functions.c (tgamma): Use isnan() instead of
	__builtin_isnan().
	* config.h.in: Regenerate.
	* configure: Regenerate.

From-SVN: r164119
2010-09-09 18:47:11 +00:00
Jerry DeLisle 746e63273f re PR fortran/44953 (FAIL: gfortran.dg/char4_iunit_1.f03 * execution test)
2010-07-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/44953
	* io/unix.c (mem_alloc_w4): Return gfc_char4_t instead of char type
	pointer. (mem_write4): Remove cast to gfc_char4_t.
	* io/transfer.c (write_block): Use a gfc_char4_t pointer.
	(memset4): New helper function. (next_record_w): Use new helper
	function rather than sset for internal units.  Don't attempt to pad
	with spaces if it is not needed.
	* io/unix.h: Update prototype for mem_alloc_w4.
	* io/write.c (memset4): Use gfc_char4_t pointer and chracter type.
	Don't use multiply by 4 to compute offset. (memcpy4): Likewise.
	(write_default_char4): Use a gfc_char4_t pointer and update memset4
	and memcpy calls. (write_a): Likewise. (write_l): Likewise.
	(write_boz): Likewise. (write_decimal): Likewise. (write_x): Likewise.
	(write_char): Add support for character(kind=4) internal units that
	was previously missed. (write_integer): Use a gfc_char4_t pointer and
	update memset4 and memcpy calls. (write_character): Likewise.
	(write_separator): Add support for character(kind=4) internal units
	that was previously missed.
	* write_float.def (output_float): Use a gfc_char4_t pointer and
	update memset4 and memcpy calls. (write_infnan): Likewise.
	(output_float_FMT_G_): Likewise.

From-SVN: r162304
2010-07-19 13:11:54 +00:00
Jerry DeLisle c7421e06ca re PR fortran/37077 (Implement Internal Unit I/O for character KIND=4)
2010-07-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/37077
	* io/read.c: Fix comment.
	* io/io.h (is_char4_unit): New macro.
	* io/unit.c (get_internal_unit): Call new function open_internal4.
	* io/unix.c (mem_alloc_r4): New function. (mem_alloc_w4): New function.
	(mem_read4): New function, temporary stub. (mem_write4): New function.
	(open_internal4): New function to set stream pointers to use the new
	mem functions.
	* io/transfer.c (write_block): Use new mem_alloc_w4 to access internal
	units of kind=4.
	* io/unix.h: Add prototypes for open_internal4, mem_alloc_w4, and
	mem_alloc_r4.
	* io/write.c (memset4): New helper function. (memcpy4): New helper
	function. (write_default_char4): Use new helper functions.
	(write_a): Likewise. (write_l): Likewise. (write_boz): Likewise.
	(write_decimal): Likewise. (write_x): Likewise.
	(write_integer): Likewise.
	* io/write_float.def (output_float): Add code blocks to handle internal
	unit kind=4 output utilizing gfc_char4_t pointers. (write_infnan): Use
	new helper functions. (OUTPUT_FLOAT_FMT_G): Update this macro likewise.

From-SVN: r162123
2010-07-13 02:12:08 +00:00
Janne Blomqvist bb408e876c Remove free_mem
From-SVN: r159160
2010-05-07 18:55:59 +03:00
Rainer Orth 28c64ec893 * io/write_float.def (WRITE_FLOAT): Use __builtin_signbit.
From-SVN: r157048
2010-02-24 15:35:40 +00:00