Commit Graph

126 Commits

Author SHA1 Message Date
Francois-Xavier Coudert 57504df9ee re PR libfortran/19155 ([4.0 only] blanks not treated as zeros in 'E' format read (NIST FM110.FOR))
PR libfortran/19155
	* io/read.c (read_f): Take care of spaces after initial sign.
	* gfortran.dg/pr19155.f: Add test.

From-SVN: r100861
2005-06-12 19:59:17 +00:00
Francois-Xavier Coudert 12e59662e3 re PR libfortran/20179 (cannot mix C and Fortran I/O)
PR libfortran/20179
	* io/unix.c (fd_close): Add test so that we don't close()
	stdout and stderr.

From-SVN: r100353
2005-05-30 07:38:36 +00:00
Francois-Xavier Coudert c9330b0331 re PR libfortran/20006 ($ format extension doesn't work)
PR libfortran/20006
	* io.c (format_item_1): Add check and extension warning for
	$ edit descriptor.
	* io/format.c (parse_format_list): Set repeat count of $ format
	node to 1.
	* io/transfer.c (read_sf): Add g.seen_dollar to the test
	concerning advancing I/O.
	(data_transfer_init): Likewise.
	(finalize_transfer): Likewise.

From-SVN: r100314
2005-05-29 12:22:49 +00:00
Peter Wainwright c220bdaec9 re PR libfortran/21376 (libfortran "E" output format causes FPE)
PR libfortran/21376
	* io/write.c (output_float): Rework logic to avoid call to log10
	with argument equal to zero.

From-SVN: r100068
2005-05-22 21:17:42 +00:00
Andreas Jaeger a0f94629e9 unit.c (get_unit): Mark argument as unused.
* io/unit.c (get_unit): Mark argument as unused.
	(init_units): Avoid warning about signed comparision.

From-SVN: r99842
2005-05-17 19:02:38 +02:00
Andreas Jaeger 8f2a14065c configure.ac: Add additional warning flags.
* configure.ac: Add additional warning flags.
	* configure: Regenerate.

	* io/write.c (calculate_G_format): Remove unused parameter.
	(output_float): Remove unused parameter.
	(write_float): Change callers.
	(nml_write_obj): Avoid signed warning.
	Make variable const to support -Wwrite-strings.

	* io/unix.c (fd_alloc, mmap_open, mmap_sfree, mem_sfree,
	mem_truncate): Mark argument as unused.

	* io/unit.c (get_unit): Mark argument as unused.
	(init_units): Avoid warning about signed comparision.

	* io/transfer.c (next_record_r): Remove unused parameter.
	(next_record_w): Remove unused parameter.
	(next_record): Change callers.
	(iolength_transfer): Mark arguments as unused.

	* io/open.c: Add initializer.

	* io/list_read.c (read_character): Mark argument as unused.
	(nml_match_name): Add const to make compile with -Wwrite-strings.

	* io/format.c: Add initializer.

From-SVN: r99839
2005-05-17 18:54:58 +02:00
Andreas Jaeger 7672ae2082 eoshift1.m4: Initialize variables to avoid warnings.
* m4/eoshift1.m4: Initialize variables to avoid warnings.
	* m4/eoshift3.m4: Initialize variables to avoid warnings.
	* generated/eoshift1_4.c, generated/eoshift1_8.c,
	generated/eoshift3_4.c, generated/eoshift3_8.c: Regenerated.

	* intrinsics/spread_generic.c (spread): Initialize variables to
	avoid warnings.

	* intrinsics/eoshift0.c (eoshift0): Initialize variables to avoid
	warnings.
	* intrinsics/eoshift2.c (eoshift2): Initialize variables to avoid
	warnings.

	* io/list_read.c (nml_get_obj_data): Initialize variables to avoid
	warnings.

From-SVN: r99726
2005-05-15 17:50:09 +02:00
Andreas Jaeger 6b0215364d system_clock.c (system_clock_4, [...]): Add missing returns, reformat a bit.
* intrinsics/system_clock.c (system_clock_4, system_clock_8): Add
	missing returns, reformat a bit.

	* io/write.c (nml_write_obj): Use %d again - and cast to int,
	st_sprintf does not handle %ld.

From-SVN: r99722
2005-05-15 17:33:12 +02:00
Andreas Jaeger 944e86ee09 unit.c (is_internal_unit): Add void as parameter list.
* io/unit.c (is_internal_unit): Add void as parameter list.

	* io/transfer.c: Move prototype declarations before the functions.

From-SVN: r99721
2005-05-15 15:25:19 +02:00
Andreas Jaeger 420aa7b82c Remove extra whitespace.
From-SVN: r99720
2005-05-15 14:49:45 +02:00
Andreas Jaeger 4b6903ec2f normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
	list.

	* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.

	* io/transfer.c: Do not use empty initializers for global objects.
	Add missing initializers.

	* io/lock.c: Do not use empty initializers for global objects.

	* io/close.c: Add missing initializers.

	* runtime/environ.c: Add missing initializers. Do not use empty
	initializers for global object.
	(init_string): Mark argument as unused.

	* runtime/main.c (cleanup): Fix parameter list.

	* io/io.h: Fix parameter lists.

	* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
	warning.

	* generated/transpose_c4.c, generated/transpose_c8.c,
	generated/transpose_i4.c, generated/transpose_i8.c,
	generated/matmul_c4.c, generated/matmul_c8.c,
	generated/matmul_i4.c, generated/matmul_i8.c,
	generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.

	* io/write.c (nml_write_obj): Fix 64-bit problem.

	* io/list_read.c (nml_get_obj_data): Add missing braces around
	initializer to avoid warnings.

	* intrinsics/etime.c (etime_sub): Remove unused variable.

From-SVN: r99719
2005-05-15 14:44:42 +02:00
Andreas Jaeger deeab82073 chdir.c, [...]: Include <string.h> for prototypes.
* intrinsics/chdir.c, intrinsics/getlog.c, intrinsics/link.c,
	intrinsics/symlnk.c, intrinsics/perror.c: Include <string.h> for
	prototypes.

	* runtime/string.c (compare0): Remove unused variable.
	* io/unit.c (init_units): Remove unused variables.
	* intrinsics/getcwd.c (getcwd_i4_sub): Remove unused variable.
	* intrinsics/unlink.c (unlink_i4_sub): Remove unused variable.
	* intrinsics/stat.c (stat_i4_sub, fstat_i8_sub, fstat_i4_sub,
	stat_i8_sub): Remove unused variable.

From-SVN: r99716
2005-05-15 10:25:52 +02:00
Thomas Koenig c42a19d5e3 re PR libfortran/21324 (#undef GFC_CLEAR_MEMORY causes testsuite failures)
2005-05-12  Thomas Koenig  <Thomas.Koenig@online.de>

        PR libfortran/21324
        * runtime/memory.c:  Don't define GFC_CLEAR_MEMORY (it's a
        performance hog).
        * io/open.c (new_unit): Zero freshly allocated memory for
        unit structure.
        * io/unit.c (init_units):  Zero freshly allocated memory for
        STDIN, STDOUT and STDERR.
        * io/unix.c (open_internal):  Zero freshly allocated memory
        for unix_stream.
        (fd_to_stream):  Likewise.

From-SVN: r99619
2005-05-12 17:50:33 +00:00
Bud Davis 802fc8260d re PR libfortran/19478 (reading back from /dev/null)
PR fortran/19478
	* io/unix.c (fd_truncate): update positions when ftruncate
	fails (like writing to /dev/null).
	* gfortran.dg/dev_null.f90: New test.

From-SVN: r99570
2005-05-11 10:34:05 +00:00
Francois-Xavier Coudert da32fddcb6 re PR libfortran/21471 ('POSITION = "APPEND"' doesn't seem to work)
PR libfortran/21471
	* open.c (new_unit): Take care of the case where POSITION_APPEND
	is specified (sseek to the end, and set u>-endfile).
	* gfortran.dg/append-1.f90: New test.

From-SVN: r99560
2005-05-11 05:56:20 +00:00
Francois-Xavier Coudert 8809f6f945 re PR libfortran/20788 (Loading libgfortran.so clobbers C redirection of stdin/stdout/stderr)
PR libfortran/20788
	Missing entry from previous commit:
	* io/unix.c (fd_to_stream): Add an avoid_mmap argument indicating
	we don't we to mmap this stream. Use fd_open instead of mmap_open
	in that case.
	(open_external): Call fd_to_stream with avoid_mmap = 0.
	(input_stream): Call fd_to_stream with avoid_mmap = 1.
	(output_stream): Likewise.
	(error_stream): Likewise.

	Really committing:
	* io/read.c (read_f): Accept 'e', 'E', 'd' and 'D' as first
	non-blank characters of a real number.

From-SVN: r99508
2005-05-10 08:34:58 +00:00
Francois-Xavier Coudert 4581ba9d4f re PR libfortran/19155 ([4.0 only] blanks not treated as zeros in 'E' format read (NIST FM110.FOR))
PR libfortran/19155
	* io/read.c (read_f): Accept 'e', 'E', 'd' and 'D' as first
	non-blank characters of a real number.
	* gfortran.dg/pr19155.f: New test.

From-SVN: r99424
2005-05-09 11:21:01 +00:00
Francois-Xavier Coudert 1fb2002d69 configure.ac: Check for ftruncate and chsize.
* configure.ac: Check for ftruncate and chsize.
	* io/unix.c (fd_truncate): Provide chsize as alternative to
	ftruncate.
	* config.h.in: Regenerate.
	* configure: Regenerate.

From-SVN: r98989
2005-04-29 14:24:04 +00:00
David Edelsohn 9adcdfb365 rewind.c (st_rewind): Flush the stream when resetting the mode from WRITING to READING.
* io/rewind.c (st_rewind): Flush the stream when resetting the mode
        from WRITING to READING.

From-SVN: r98788
2005-04-26 15:27:11 -04:00
Paul Thomas bfe936c0c1 Fix bug that causes testsuite failure in namelist_13.f90 on some systems.
Co-Authored-By: Jerry DeLisle <jvdelisle@verizon.net>

From-SVN: r98610
2005-04-23 12:38:08 +00:00
Paul Thomas 883dd42959 correct memory leaks in namelist code for derived types
From-SVN: r98352
2005-04-18 22:19:27 +00:00
Francois-Xavier Coudert 293fcb2e28 re PR libfortran/20950 ([4.0 only] segfault in INQUIRE asking for SEQUENTIAL status)
PR libfortran/20950
	* io/inquire.c (inquire_via_unit): Check for the gfc_unit being
	NULL when setting ioparm.sequential.
	* gfortran.dg/pr20950.f: New test.

From-SVN: r98312
2005-04-18 07:34:32 +00:00
Paul Thomas 29dc5138c3 re PR fortran/17472 ([4.0 only] namelist does not handle arrays)
-------------------------------------------------------------------

From-SVN: r98287
2005-04-17 20:09:37 +00:00
Thomas Koenig 59afe4b424 [multiple changes]
2005-04-10  Thomas Koenig <Thomas.Koenig@online.de>

        PR libfortran/17992
        PR libfortran/19568
        PR libfortran/19595
        PR libfortran/20005
        PR libfortran/20092
        PR libfortran/20131
        PR libfortran/20138
        PR libfortran/20661
        PR libfortran/20744
        * io/transfer.c (top level): eor_condition: New static variable.
        (read_sf): Remove unnecessary zeroing of buffer (there is enough
        information in its length).
        Return a string of length 0 (to be padded by caller) if EOR was
        seen previously.
        Remove erroneous special casing of EOR for standard input.
        Set eor_condition for non-advancing I/O if an end of line was
        detected.
        Increment ioparm.size if necessary.
        (formatted_transfer):  Skip the function if there is an EOR condition.
        (data_transfer_init):  Initialize eor_condition to zero (false).
        (next_record_r):  Clear sf_seen_eor if a \n has been seen already.
        (finalize_transfer):  If there is an EOR condition, raise the error.

2005-04-10   Thomas Koenig  <Thomas.Koenig@online.de>

        * eor_handling_1.f90: New test case.
        * eor_handling_2.f90: New test case.
        * eor_handling_3.f90: New test case.
        * eor_handling_4.f90: New test case.
        * eor_handling_5.f90: New test case.
        * noadv_size.f90: New test case.
        * pad_no.f90: New test case.

From-SVN: r97943
2005-04-10 08:35:39 +00:00
Bud Davis 48248fa771 re PR libfortran/19872 ([4.0 only] closed and re-opened file not overwriten)
PR fortran/19872
* io/transfer.c (data_transfer_init): truncate an existing
  file on the first write.

Co-Authored-By: Steven G. Kargl <kargls@comcast.net>

From-SVN: r97937
2005-04-10 03:43:09 +00:00
Andrew Pinski 53d8a8ac22 re PR fortran/13257 ([4.0 only] Error instead of warning for missing comma in format string)
PR fortran/13257

fortran/ChangeLog:
	* io.c (check_format): Allow an optional comma
	between descriptors.

libgfortran/ChangeLog:
	* format.c (parse_format_list): Allow an optional comma
	between descriptors.

testsuite/ChangeLog:
	* comma_format_extension_[1234].f: New tests.

From-SVN: r97919
2005-04-09 11:44:07 -07:00
Eric Botcazou 01d87b6f3d backspace.c (unformatted_backspace): Do not dereference the pointer to the stream.
* io/backspace.c (unformatted_backspace): Do not dereference
	the pointer to the stream.

From-SVN: r97851
2005-04-08 19:07:54 +00:00
Francois-Xavier Coudert 51e9d74cb8 re PR libfortran/20755 (gfortran - prints the same number with 1p4G12.3 two different ways)
PR libfortran/20755
	* write.c (write_float): A G edit descriptor may locally change
	the scale factor, but it needs to be restored afterwards.

	* gfortran.dg/pr20755.f: New test.

From-SVN: r97627
2005-04-05 14:20:10 +00:00
Dale Ranta 00f07d96bd re PR libfortran/20068 (Backspace problems)
PR libfortran/20068
	PR libfortran/20125
	PR libfortran/20156
	PR libfortran/20471

	* io/backspace.c (unformatted_backspace): Fix error in arithmetic.
	(st_backspace): When in WRITING mode, we flush and falling back
	into READING mode. In all cases, correctly position the stream.

	* gfortran.dg/backspace.f: New test.

Co-Authored-By: Francois-Xavier Coudert <coudert@clipper.ens.fr>

From-SVN: r97478
2005-04-03 08:07:43 +00:00
Francois-Xavier Coudert 14fd645e24 re PR libfortran/20660 (INQUIRE incorrectly reports the existence of UNITS)
PR libfortran/20660
    * io/inquire.c (inquire_via_unit): Non-opened units should still be
    reported by an INQUIRE statement as existing.
    * io/transfer.c (data_transfer_init): Never accept negative units.

    PR libfortran/20660
    * gfortran.dg/negative_unit.f: New test.

From-SVN: r97326
2005-03-31 15:30:06 +00:00
François-Xavier Coudert 82498ed4b9 re PR libfortran/20163 ([4.0 only] gfortran - error opening direct access file)
PR libfortran/20163
	* io/open.c (st_open): call library_end() before returning even if
	an error arises.

	* gfortran.dg/pr20163-2.f: New test.

From-SVN: r97153
2005-03-29 08:37:32 +00:00
Francois-Xavier Coudert 94887ef478 re PR libfortran/19678 (DOS files don't work for list directed input)
PR libfortran/19678
        PR libfortran/19679
        * gfortran.dg/dos_eol.f: New test.

        PR libfortran/19678
        * list_read.c (next_char, eat_separator, finish_separator, read_real)
        (namelist_read): Add support for '\r' as well as '\n' as EOL
        character.

        PR libfortran/19679
        * list_read.c (read_sf): Add a '\r' in a test to support DOS
        line-endings when line length is exceeded.

From-SVN: r97041
2005-03-25 13:35:29 +00:00
Francois-Xavier Coudert a50f3cd3e6 re PR libfortran/15332 (colon edit descriptor not handled correctly)
PR libfortran/15332

      * io/format.c (parse_format_list): format node for colon edit
      descriptor needs a repeat counter set to 1.

      * gfortran.dg/pr15332.f: New test.

From-SVN: r97036
2005-03-25 07:04:27 +00:00
François-Xavier Coudert 85624ffd34 * libgfortran/io/write.c (output_float): fix typo in last commit.
From-SVN: r96958
2005-03-23 22:31:56 +00:00
Francois-Xavier Coudert fd4f678cf2 re PR libfortran/18025 (libgfortran: format, incompatible "minimum width" edit descriptor)
PR libfortran/18025
        * write.c (output_float): Handling the "F0.d" format similarly as
        commercial compilers.

        * pr18025.f90: New test.

From-SVN: r96953
2005-03-23 21:42:10 +00:00
François-Xavier Coudert 0376d694c2 * io.h: Setting higher default record length.
From-SVN: r96574
2005-03-16 19:33:07 +00:00
Francois-Xavier Coudert 2786eb77b2 open.c (new_unit): set record length to max_offset rather than using a hard-coded limit (which was...
* open.c (new_unit): set record length to max_offset rather than
	  using a hard-coded limit (which was too low).

	* write_big_array.f90: New test.

From-SVN: r96573
2005-03-16 19:32:08 +00:00
Francois-Xavier Coudert dcdeec06a0 write.c (output_float): special check when writing 0.0 with EN and ES formats.
* write.c (output_float): special check when writing 0.0 with
          EN and ES formats.

        * pr20480.f90: New test.

From-SVN: r96566
2005-03-16 18:09:03 +00:00
Francois-Xavier Coudert 0b2df4a703 [multiple changes]
2005-03-12  Francois-Xavier Coudert  <coudert@clipper.ens.fr>

        PR libfortran/20124
        * gfortran.dg/pr20124.f90: New Test

2005-03-11  Francois-Xavier Coudert  <coudert@clipper.ens.fr>

        PR libfortran/20124
        * write.c (output_float): Adds a nzero_real variable to store
        the number of leading zeros whatever the format width is. Corrects
        the rounding of numbers less than 10^(-width). Fixes typo in an
        error message. Updates copyright years

From-SVN: r96291
2005-03-11 08:03:02 +00:00
Tobias Schlüter c7c61e5ec5 * io/write.c: Update copyright years.
From-SVN: r95630
2005-02-27 21:11:01 +01:00
Francois-Xavier Coudert d8f92af2cf re PR libfortran/20101 (zero prints incorrectly with 1pe12.4)
libgfortran/
2005-02-27  Fran��ois-Xavier Coudert  <coudert@clipper.ens.fr>

 PR libfortran/20101
* write.c (output_float): Adding special check for value 0.0 in
PE format.

gcc/testsuite/
2005-02-27  Fran��ois-Xavier Coudert  <coudert@clipper.ens.fr>

PR libfortran/20101
* gfortran.dg/write_0_pe_format.f90: New test.

From-SVN: r95628
2005-02-27 20:47:12 +01:00
Tobias Schlüter 34d6d42fb4 write.c (output_float): Fix typo in condition.
libgfortran/
* io/write.c (output_float): Fix typo in condition.

gcc/testsuite/
* gfortran.dg/e_d_fmt.f90: New test.

From-SVN: r95615
2005-02-27 17:17:56 +01:00
Bud Davis 397763d2af [multiple changes]
2004-02-22  Paul Thomas <paulthomas2@wannado.fr>
            Bud Davis  <bdavis@gfortran.org>

        * io/list_read.c (read_real): Handle separators properly
        in list directed read.

2005-02-22  Bud Davis  <bdavis@gfortran.org>

        * gfortran.dg/list_read_4.f90: new test.

From-SVN: r95436
2005-02-23 04:09:17 +00:00
Bud Davis ec88bf8bb7 [multiple changes]
2004-02-21  Bud Davis  <bdavis@gfortran.org>

        PR fortran/20086
        * io/transfer.c (write_constant_string): accept an 'h' as
        the start of a hollerith format string.

2005-02-21  Bud Davis  <bdavis9659@comcast.net>

        PR fortran/20086
        * gfortran.dg/pr20086.f90: New test.

From-SVN: r95379
2005-02-22 03:26:25 +00:00
Steven G. Kargl 95b49c6f9d * io/write.c(output_float): Typo in error message.
From-SVN: r95343
2005-02-21 19:59:58 +00:00
Bud Davis 23e044cc1d re PR libfortran/19647 (inquire(delim=) returns garbage)
2005-01-30  Bud Davis  <bdavis@gfortran.org>

        PR fortran/19647
        * io/inquire.c (inquire_via_unit): Use correct variable for
        pad.

        * gfortan.dg/inquire_7.f90

From-SVN: r94439
2005-01-30 13:16:19 +00:00
Thomas Koenig 24a09741e4 re PR libfortran/19595 ([4.0 only] eor does not work)
2005-01-29  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/19595
	* io/transfer.c (data_transfer_init): eor requires advance="NO".
testsuite/
	* gfortran.dg/eor_1.f90:  New test.

From-SVN: r94410
2005-01-29 15:45:17 +00:00
Tobias Schlüter 8dac1b213e re PR libfortran/19524 (5 times uninitialized var in libgfortran)
PR libfortran/19524
* io/read.c (read_f): Don't free uninitialized pointer.

From-SVN: r94232
2005-01-25 22:40:25 +01:00
Paul Brook 2d304c90bd Update Copyright.
From-SVN: r94118
2005-01-23 17:16:43 +00:00
Thomas Koenig 0e69bba9fc re PR libfortran/19451 (Read after a write with a read only file)
2005-01-22  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/19451
	* io/transfer.c (finalize_transfer):  Don't do anything if
	there is an error condition.
	* open_readonly_1.f90:  New test.

From-SVN: r94101
2005-01-23 02:18:33 +00:00