aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io
AgeCommit message (Collapse)AuthorFilesLines
2020-08-20Fortran : rejected f0.d edit descriptor PR96436Mark Eggleston1-1/+9
Zero length f format descriptors are valid for Fortran 95 and later. For g format descriptors from Fortran 2008 and later. Finally for D, E, EN and ES for Fortran 2018 and later. 2020-08-20 Mark Eggleston <markeggleston@gcc.gnu.org> libgfortran/ PR fortran/96436 * io/format.c (parse_format_list): Add new local variable "standard" to hold the required standard to check. If the format width is zero select standard depending on descriptor. Call notification_std using the new standard variable. 2020-08-20 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/96436 * gfortran.dg/pr96436_1.f90: New test. * gfortran.dg/pr96436_2.f90: New test. * gfortran.dg/pr96436_3.f90: New test. * gfortran.dg/pr96436_4.f90: New test. * gfortran.dg/pr96436_5.f90: New test. * gfortran.dg/pr96436_6.f90: New test. * gfortran.dg/pr96436_7.f90: New test. * gfortran.dg/pr96436_8.f90: New test. * gfortran.dg/pr96436_9.f90 * gfortran.dg/pr96436_10.f90
2020-07-24PR 93567, G edit descriptor uses E instead of F editing in rounding mode UP.Dominique d'Humieres1-4/+8
The switch between FMT_E and FMT_F is based on the absolute value. Set r=0 for rounding toward zero and r = 1 otherwise. If (exp_d - m) == 1 there is no rounding needed. libgfortran/ChangeLog: PR fortran/93567 * io/write_float.def (determine_en_precision): Fix switch between FMT_E and FMT_F. gcc/testsuite/ChangeLog: PR fortran/93567 * gfortran.dg/round_3.f08: Add test cases.
2020-07-24PR 93592 - Invalid UP/DOWN rounding with EN descriptor.Dominique d'Humieres1-1/+2
The fix is obvious (I have added a comment). The tests are probably an overkill, but it does not hurt. libgfortran/ChangeLog: PR fortran/93592 * io/write_float.def (build_float_string): Do not reset nbefore for FMT_F and FMT_EN. gcc/testsuite/ChangeLog: PR fortran/93592 * gfortran.dg/fmt_en.f90: Adjust test. * gfortran.dg/fmt_en_rd.f90: New test. * gfortran.dg/fmt_en_rn.f90: New test. * gfortran.dg/fmt_en_ru.f90: New test. * gfortran.dg/fmt_en_rz.f90: New test.
2020-06-13Disable -Wstringop-overflow warning after checking code path of caller.Thomas Koenig1-0/+8
The warning that is disabled, only on this single line, has been inspected and found to be not applicable; it is known that the size of the buffer is safe. libgfortran/ChangeLog: 2020-06-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95313 * io/write.c (ztoa_big): Disable -Wstringop-overflow for one line.
2020-06-08PR fortran/95195 - Fortran testcase should clean up afterwardsHarald Anlauf1-1/+1
Change testcase to check error message (iomsg) at runtime, rather than to crash. libgfortran/ PR fortran/95091 * io/transfer.c (finalize_transfer): Fix type in error message. gcc/testsuite/ PR fortran/95195 * gfortran.dg/namelist_97.f90: Adjust testcase.
2020-05-28PR fortran/95104 - Segfault on a legal WAIT statementHarald Anlauf1-3/+6
The initial commit for this PR uncovered a latent issue with unit locking in the Fortran run-time library. Add check for valid unit. 2020-05-28 Harald Anlauf <anlauf@gmx.de> libgfortran/ PR libfortran/95104 * io/unit.c (unlock_unit): Guard by check for NULL pointer.
2020-05-26PR fortran/95104 - Segfault on a legal WAIT statementHarald Anlauf1-1/+1
Referencing a unit in a WAIT statement that has not been opened before resulted in a NULL pointer dereference. Check for this condition. 2020-05-26 Harald Anlauf <anlauf@gmx.de> libgfortran/ PR libfortran/95104 * io/transfer.c (st_wait_async): Do not dereference NULL pointer. gcc/testsuite/ PR libfortran/95104 * gfortran.dg/pr95104.f90: New test. Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
2020-05-26PR libfortran/95195 - improve runtime error for namelist i/o to unformatted fileHarald Anlauf1-0/+8
Namelist input/output to unformatted files is prohibited. Generate useful runtime errors instead instead of misleading ones. 2020-05-26 Harald Anlauf <anlauf@gmx.de> libgfortran/ PR fortran/95195 * io/transfer.c (finalize_transfer): Generate runtime error for namelist input/output to unformatted file. gcc/testsuite/ PR fortran/95195 * gfortran.dg/namelist_97.f90: New test.
2020-05-23Fixes a hang on an invalid ID in a WAIT statement.Thomas Koenig1-0/+7
gcc/fortran/ChangeLog: 2020-05-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95191 * libgfortran.h (libgfortran_error_codes): Add LIBERROR_BAD_WAIT_ID. libgfortran/ChangeLog: 2020-05-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95191 * io/async.c (async_wait_id): Generate error if ID is higher than the highest current ID. * runtime/error.c (translate_error): Handle LIBERROR_BAD_WAIT_ID. libgomp/ChangeLog: 2020-05-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95191 * testsuite/libgomp.fortran/async_io_9.f90: New test.
2020-05-14Add early return for invalid STATUS for close.Thomas Koenig1-1/+7
2020-05-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95119 * io/close.c (close_status): Add CLOSE_INVALID. (st_close): Return early on invalid STATUS parameter. 2020-05-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95119 * testsuite/libgomp.fortran/close_errors_1.f90: New test.
2020-02-18Use au->lock exclusively for locking in async I/O.Thomas König2-37/+31
2020-02-18 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93599 * io/async.c (destroy_adv_cond): Do not destroy lock. (async_io): Make sure au->lock is locked for finishing of thread. Do not lock/unlock around signalling emptysignal. Unlock au->lock before return. (init_adv_cond): Do not initialize lock. (enqueue_transfer): Unlock after signal. (enqueue_done_id): Likewise. (enqueue_done): Likewise. (enqueue_close): Likewise. (enqueue_data_transfer): Likewise. (async_wait_id): Do not lock/unlock around signalling au->work. (async_wait): Unlock after signal. * io/async.h (SIGNAL): Add comment about needed au->lock. Remove locking/unlocking of advcond->lock. (WAIT_SIGNAL_MUTEX): Add comment. Remove locking/unlocking of advcond->lock. Unlock mutex only at the end. Loop on __ghread_cond_wait returning zero. (REVOKE_SIGNAL): Add comment. Remove locking/unlocking of advcond->lock. (struct adv_cond): Remove mutex from struct. asdf
2020-01-17PR93234 INQUIRE on pre-assigned files of ROUND and SIGN propertiesJerry DeLisle1-8/+8
PR libfortran/93234 * io/unit.c (set_internal_unit): Set round and sign flags correctly. * gfortran.dg/inquire_pre.f90: New test.
2020-01-17PR90374 Zero width format specifiers.Jerry DeLisle2-2/+6
PR libfortran/90374 * io/format.c (parse_format_list): Zero width not allowed with FMT_D. * io/write_float.def (build_float_string): Include range of higher exponent values that require wider width.
2020-01-02PR 90374 d0.d, e0.d, es0.d, en0.d, g0.d and ew.d edit descriptors.Jerry DeLisle5-97/+125
PR libfortran/90274 * io/format.c (parse_format_list): Implement the E0 exponent width to provide smallest possible width for exponent fields. Refactor code for correct parsing and better readability of the code. * io/io.h (write_real_w0): Change interface to pass in pointer to fnode. * io/transfer.c: Update all calls to write_real_w0 to use the new interface. * io/write.c ((write_real_w0): Use the new interface with fnode to access both the decimal precision and exponent widths used in build_float_string. * io/write_float.def (build_float_string): Use the passed in exponent width to calculate the used width in the case of E0. From-SVN: r279828
2020-01-01Update copyright years.Jakub Jelinek23-23/+23
From-SVN: r279813
2019-12-01re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d ↵Jerry DeLisle1-11/+13
and ew.d e0 edit descriptors for output) 2019-12-01 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/90374 * io/format.c (parse_format_list): Add braces to disambiguate conditional. From-SVN: r278886
2019-11-28re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d ↵Jerry DeLisle2-6/+12
and ew.d e0 edit descriptors for output) PR fortran/90374 * io.c (check_format): Allow zero width expoenent with e0. * io/format.c (parse_format_list): Relax format checking to allow e0 exponent specifier. * gfortran.dg/fmt_zero_width.f90: Update test. From-SVN: r278817
2019-11-24re PR libfortran/92100 (Formatted stream IO irreproducible read with binary ↵Jerry DeLisle1-2/+3
data in file) 2019-11-24 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/92100 io/transfer.c (data_transfer_init_worker): Use fbuf_reset instead of fbuf_flush before the seek. Note that fbuf_reset calls fbuf_flush and adjusts fbuf pointers. From-SVN: r278660
2019-11-24Fix EOF handling for arrays.Thomas Koenig1-15/+51
2019-11-23 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> PR fortran/92569 * io/transfer.c (transfer_array_inner): If position is at AFTER_ENDFILE in current unit, return from data loop. 2019-11-23 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> PR fortran/92569 * gfortran.dg/eof_6.f90: New test. Co-Authored-By: Harald Anlauf <anlauf@gmx.de> From-SVN: r278659
2019-11-07re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d ↵Jerry DeLisle5-37/+52
and ew.d e0 edit descriptors for output) 2019-11-06 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/90374 * io.c (check_format): Allow zero width for D, E, EN, and ES specifiers as default and when -std=F2018 is given. Retain existing errors when using the -fdec family of flags. * libgfortran/io/format.c (parse_format_list): Relax format checking for zero width as default and when -std=f2018. io/format.h (format_token): Move definition to io.h. io/io.h (format_token): Add definition here to allow access to this definition at higher levels. Rename the declaration of write_real_g0 to write_real_w0 and add a new format_token argument, allowing higher level functions to pass in the token for handling of g0 vs the other zero width specifiers. io/transfer.c (formatted_transfer_scalar_write): Add checks for zero width and call write_real_w0 to handle it. io/write.c (write_real_g0): Remove. (write_real_w0): Add new, same as previous write_real_g0 except check format token to handle the g0 case. * gfortran.dg/fmt_error_10.f: Modify for new constraints. * gfortran.dg/fmt_error_7.f: Add dg-options "-std=f95". * gfortran.dg/fmt_error_9.f: Modify for new constraints. * gfortran.dg/fmt_zero_width.f90: New test. From-SVN: r277905
2019-10-02re PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)Jerry DeLisle2-3/+4
2019-10-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/91593 * io/read.c (read_decimal): Cast constant to size_t to turn off a bogus warning. * io/write.c (btoa_big): Use memset in lieu of setting the null byte in a string buffer to turn off a bogus warning. From-SVN: r276439
2019-09-28re PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)Jerry DeLisle2-8/+16
2019-09-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/91593 * io/io.h: Add gcc_unreachable(). * io/transfer.c (file_mode, current_mode, formatted_transfer_scalar_read, formatted_transfer_scalar_write, pre_position, next_record_r, next_record_w): Add and use FORMATTED_UNSPECIFIED to enumeration. From-SVN: r276255
2019-08-07PR 53796 Make inquire(file=, recl=) conform to F2018Janne Blomqvist1-1/+3
In my original patch to fix PR 53796 I forgot to fix the behavior for unconnected units when inquiring via filename. This patch fixes that. Regtested on x86_64-pc-linux-gnu, committed as obvious. libgfortran/ChangeLog: 2019-08-07 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * io/inquire.c (inquire_via_filename): Set recl to -1 for unconnected units. gcc/testsuite/ChangeLog: 2019-08-07 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * gfortran.dg/inquire_recl_f2018.f90: Test for unconnected unit with inquire via filename. From-SVN: r274160
2019-07-21re PR libfortran/91030 (Poor performance of I/O -fconvert=big-endian)Thomas Koenig1-12/+35
2019-07-21 Thomas König <tkoenig@gcc.gnu.org> PR libfortran/91030 * gfortran.texi (GFORTRAN_FORMATTED_BUFFER_SIZE): Document (GFORTRAN_UNFORMATTED_BUFFER_SIZE): Likewise. 2019-07-21 Thomas König <tkoenig@gcc.gnu.org> PR libfortran/91030 * io/unix.c (BUFFER_SIZE): Delete. (BUFFER_FORMATTED_SIZE_DEFAULT): New variable. (BUFFER_UNFORMATTED_SIZE_DEFAULT): New variable. (unix_stream): Add buffer_size. (buf_read): Use s->buffer_size instead of BUFFER_SIZE. (buf_write): Likewise. (buf_init): Add argument unformatted. Handle block sizes for unformatted vs. formatted, using defaults if provided. (fd_to_stream): Add argument unformatted in call to buf_init. * libgfortran.h (options_t): Add buffer_size_formatted and buffer_size_unformatted. * runtime/environ.c (variable_table): Add GFORTRAN_UNFORMATTED_BUFFER_SIZE and GFORTRAN_FORMATTED_BUFFER_SIZE. From-SVN: r273643
2019-05-22fortran/89100: Default widths with -fdec-format-defaultsJanne Blomqvist5-14/+136
gcc/fortran ChangeLog: 2019-05-22 Jeff Law <law@redhat.com> Mark Eggleston <mark.eggleston@codethink.com> PR fortran/89100 * gfortran.texi: Add Default widths for F, G and I format descriptors to Extensions section. * invoke.texi: Add -fdec-format-defaults * io.c (check_format): Use default widths for i, f and g when flag_dec_format_defaults is enabled. * lang.opt: Add new option. * options.c (set_dec_flags): Add SET_BITFLAG for flag_dec_format_defaults. gcc/testsuite ChangeLog: 2019-05-22 Mark Eggleston <mark.eggleston@codethink.com> PR fortran/89100 * gfortran.dg/fmt_f_default_field_width_1.f90: New test. * gfortran.dg/fmt_f_default_field_width_2.f90: New test. * gfortran.dg/fmt_f_default_field_width_3.f90: New test. * gfortran.dg/fmt_g_default_field_width_1.f90: New test. * gfortran.dg/fmt_g_default_field_width_2.f90: New test. * gfortran.dg/fmt_g_default_field_width_3.f90: New test. * gfortran.dg/fmt_i_default_field_width_1.f90: New test. * gfortran.dg/fmt_i_default_field_width_2.f90: New test. * gfortran.dg/fmt_i_default_field_width_3.f90: New test. libgfortran ChangeLog: 2019-05-22 Jeff Law <law@redhat.com> PR fortran/89100 * io/format.c (parse_format_list): set default width when the IOPARM_DT_DEC_EXT flag is set for i, f and g. * io/io.h: add default_width_for_integer, default_width_for_float and default_precision_for_float. * io/write.c (write_boz): extra parameter giving length of data corresponding to the type's kind. (write_b): pass data length as extra parameter in calls to write_boz. (write_o): pass data length as extra parameter in calls to write_boz. (write_z): pass data length as extra parameter in calls to write_boz. (size_from_kind): also set size is default width is set. * io/write_float.def (build_float_string): new paramter inserted before result parameter. If default width use values passed instead of the values in fnode. (FORMAT_FLOAT): macro modified to check for default width and calls to build_float_string to pass in default width. (get_float_string): set width and precision to defaults when needed. From-SVN: r271511
2019-05-15Allow opening file on multiple unitsJanne Blomqvist1-1/+2
As of Fortran 2018 it's allowed to open the same file on multiple units. libgfortran/ChangeLog: 2019-05-15 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/90461 * io/open.c (new_unit): Don't check if the file is already open for F2018. testsuite/ChangeLog: 2019-05-15 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/90461 * gfortran.dg/open_errors_2.f90: Add -std=f2008, adjust line number. * gfortran.dg/open_errors_3.f90: New test. From-SVN: r271260
2019-03-25re PR libfortran/79540 (FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test)John David Anglin1-2/+3
PR libgfortran/79540 * io/write_float.def (build_float_string): Don't copy digits when ndigits is negative. From-SVN: r269911
2019-02-26transfer.c (transfer_array_inner): Do not cast charlen to index_type.Uros Bizjak1-1/+1
* io/transfer.c (transfer_array_inner): Do not cast charlen to index_type. From-SVN: r269224
2019-02-25re PR libfortran/89274 (Inconsistent list directed output of INTEGER(16))Dominique d'Humieres1-0/+4
2019-02-25 Dominique d'Humieres <dominiq@gcc.gnu.org> PR libfortran/89274 * gfortran.dg/list_directed_large.f90: New test. 2019-02-25 Dominique d'Humieres <dominiq@gcc.gnu.org> PR libfortran/89274 * io/write.c (write_integer): Add width for INTEGER(16). From-SVN: r269187
2019-01-28libgfortran: Use proper gthr.h APISebastian Huber1-1/+1
libgfortran/ * io/async.c (init_adv_cond): Use __GTHREAD_COND_INIT_FUNCTION(). From-SVN: r268331
2019-01-27re PR libfortran/89020 (close(status='DELETE') does not remove file)Jerry DeLisle1-4/+2
2019-01-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/89020 * io/close.c (st_close): Simplify text of error message to not presume a specific cause of failure to remove file. From-SVN: r268319
2019-01-27re PR libfortran/89020 (close(status='DELETE') does not remove file)Jerry DeLisle1-1/+1
2019-01-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/89020 * io/close.c (st_close): Fix typo. From-SVN: r268309
2019-01-26re PR libfortran/89020 (close(status='DELETE') does not remove file)Jerry DeLisle1-2/+9
2019-01-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/88020 * io/close.c (st_close): Generate error if calls to 'remove' return an error. From-SVN: r268301
2019-01-14re PR libfortran/88776 (Namelist read from stdin: loss of data)Jerry DeLisle1-4/+12
2019-01-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/88776 * io/open.c (newunit): Free format buffer if the unit specified is for stdin, stdout, or stderr. * gfortran.dg/namelist_96.f90: New test. From-SVN: r267910
2019-01-12re PR libfortran/88776 (Namelist read from stdin: loss of data)Jerry DeLisle1-5/+1
2019-01-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/88776 * io/list_read.c (namelist_read): Use nml_err_ret path on read error not based on stdin_unit. From-SVN: r267898
2019-01-09PR other/16615 [1/5]Sandra Loosemore1-1/+1
2019-01-09 Sandra Loosemore <sandra@codesourcery.com> PR other/16615 [1/5] contrib/ * mklog: Mechanically replace "can not" with "cannot". gcc/ * Makefile.in: Mechanically replace "can not" with "cannot". * alias.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * common/config/i386/i386-common.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/sync.md: Likewise. * config/arc/arc.c: Likewise. * config/arc/predicates.md: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/cortex-r4f.md: Likewise. * config/csky/csky.c: Likewise. * config/csky/csky.h: Likewise. * config/darwin-f.c: Likewise. * config/epiphany/epiphany.md: Likewise. * config/i386/i386.c: Likewise. * config/i386/sol2.h: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/mips/20kc.md: Likewise. * config/mips/sb1.md: Likewise. * config/nds32/nds32.c: Likewise. * config/nds32/predicates.md: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/e300c2c3.md: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.h: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh.md: Likewise. * config/spu/vmx2spu.h: Likewise. * cprop.c: Likewise. * dbxout.c: Likewise. * df-scan.c: Likewise. * doc/cfg.texi: Likewise. * doc/extend.texi: Likewise. * doc/fragments.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/lto.texi: Likewise. * doc/md.texi: Likewise. * doc/objc.texi: Likewise. * doc/rtl.texi: Likewise. * doc/tm.texi: Likewise. * dse.c: Likewise. * emit-rtl.c: Likewise. * emit-rtl.h: Likewise. * except.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * genautomata.c: Likewise. * gimple-fold.c: Likewise. * hard-reg-set.h: Likewise. * ifcvt.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-fnsummary.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * ira.h: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-streamer-out.c: Likewise. * postreload-gcse.c: Likewise. * predict.c: Likewise. * profile-count.h: Likewise. * profile.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * symtab.c: Likewise. * target.def: Likewise. * toplev.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-core.h: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-profile.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phionlycprop.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssanames.c: Likewise. * tree-streamer-out.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * vr-values.c: Likewise. gcc/ada/ * exp_ch9.adb: Mechanically replace "can not" with "cannot". * libgnat/s-regpat.ads: Likewise. * par-ch4.adb: Likewise. * set_targ.adb: Likewise. * types.ads: Likewise. gcc/cp/ * cp-tree.h: Mechanically replace "can not" with "cannot". * parser.c: Likewise. * pt.c: Likewise. gcc/fortran/ * class.c: Mechanically replace "can not" with "cannot". * decl.c: Likewise. * expr.c: Likewise. * gfc-internals.texi: Likewise. * intrinsic.texi: Likewise. * invoke.texi: Likewise. * io.c: Likewise. * match.c: Likewise. * parse.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * symbol.c: Likewise. * trans-array.c: Likewise. * trans-decl.c: Likewise. * trans-intrinsic.c: Likewise. * trans-stmt.c: Likewise. gcc/go/ * go-backend.c: Mechanically replace "can not" with "cannot". * go-gcc.cc: Likewise. gcc/lto/ * lto-partition.c: Mechanically replace "can not" with "cannot". * lto-symtab.c: Likewise. * lto.c: Likewise. gcc/objc/ * objc-act.c: Mechanically replace "can not" with "cannot". libbacktrace/ * backtrace.h: Mechanically replace "can not" with "cannot". libgcc/ * config/c6x/libunwind.S: Mechanically replace "can not" with "cannot". * config/tilepro/atomic.h: Likewise. * config/vxlib-tls.c: Likewise. * generic-morestack-thread.c: Likewise. * generic-morestack.c: Likewise. * mkmap-symver.awk: Likewise. libgfortran/ * caf/single.c: Mechanically replace "can not" with "cannot". * io/unit.c: Likewise. libobjc/ * class.c: Mechanically replace "can not" with "cannot". * objc/runtime.h: Likewise. * sendmsg.c: Likewise. liboffloadmic/ * include/coi/common/COIResult_common.h: Mechanically replace "can not" with "cannot". * include/coi/source/COIBuffer_source.h: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h: Mechanically replace "can not" with "cannot". From-SVN: r267783
2019-01-01Update copyright years.Jakub Jelinek23-23/+23
From-SVN: r267494
2018-12-09re PR libfortran/88411 (Random crashes for ASYNCHRONOUS writes (bad locking?))Thomas Koenig1-12/+8
2018-12-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88411 * io/transfer.c (dta_transfer_init): Do not treat as an asynchronous statement unless the statement has ASYNCHRONOUS="YES". (st_write_done): Likewise. (st_read_done): Do not perform async_wait for synchronous I/O on an async unit. (st_read_done): Likewise. 2018-12-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88411 * testsuite/libgomp.fortran/async_io_8.f90: New test. From-SVN: r266929
2018-11-22Replace sync builtins with atomic builtinsJanne Blomqvist1-6/+18
The old __sync builtins have been deprecated for a long time now in favor of the __atomic builtins following the C++11/C11 memory model. This patch converts libgfortran to use the modern __atomic builtins. At the same time I weakened the consistency to relaxed for incrementing and decrementing the counter, and acquire-release when decrementing to check whether the counter is 0 and the unit can be freed. This is similar to e.g. std::shared_ptr in C++. Regtested on x86_64-pc-linux-gnu. libgfortran/ChangeLog: 2018-11-22 Janne Blomqvist <jb@gcc.gnu.org> * acinclude.m4 (LIBGFOR_CHECK_ATOMIC_FETCH_ADD): Rename and test presence of atomic builtins instead of sync builtins. * configure.ac (LIBGFOR_CHECK_ATOMIC_FETCH_ADD): Call new test. * io/io.h (inc_waiting_locked): Use __atomic_fetch_add. (predec_waiting_locked): Use __atomic_add_fetch. (dec_waiting_unlocked): Use __atomic_fetch_add. * config.h.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. From-SVN: r266367
2018-11-09re PR fortran/78351 (comma not terminating READ of formatted input field - ↵Jerry DeLisle1-1/+0
ok in 4.1.7, not 4.4.7- maybe related to 25419?) 2018-11-09 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/78351 * io/transfer.c (read_sf_internal): Delete leftover debug code. From-SVN: r265979
2018-11-09re PR fortran/78351 (comma not terminating READ of formatted input field - ↵Jerry DeLisle1-23/+72
ok in 4.1.7, not 4.4.7- maybe related to 25419?) 2018-11-08 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/78351 * io/transfer.c (read_sf_internal): Add support for early comma termination of internal unit formatted reads. * gfortran.dg/read_legacy_comma.f90: New test. From-SVN: r265946
2018-10-06Use gfc_charlen_type instead of int for string lenghtsJanne Blomqvist2-17/+17
This patch cleans up a few places where I noticed the code was still using int instead gfc_charlen_type for string lengths. Regtested on x86_64-pc-linux-gnu, committed as obvious. libgfortran/ChangeLog: 2018-10-06 Janne Blomqvist <jb@gcc.gnu.org> * io/unix.c (compare_file_filename): Use gfc_charlen_type instead of int for string length. (inquire_sequential): Likewise. (inquire_direct): Likewise. (inquire_formatted): Likewise. (inquire_unformatted): Likewise. (inquire_access): Likewise. (inquire_read): Likewise. (inquire_write): Likewise. (inquire_readwrite): Likewise. * io/unix.h (compare_file_filename): Likewise. (inquire_sequential): Likewise. (inquire_direct): Likewise. (inquire_formatted): Likewise. (inquire_unformatted): Likewise. (inquire_read): Likewise. (inquire_write): Likewise. (inquire_readwrite): Likewise. From-SVN: r264901
2018-10-02* io/close.c [!HAVE_UNLINK_OPEN_FILE]: Include <string.h>.Gerald Pfeifer1-0/+3
From-SVN: r264800
2018-09-14[libgfortran] Fix uninitialized variable use in fallback_accessKyrylo Tkachov1-6/+14
I've been tracking down a bug in a Fortran program on a newlib target and it boils down to fallback_access doing something bad. The unconditional calls to close cause havoc when open doesn't get called due to the short-circuiting in the if-statement above because the fd is uninitialised. In my environment GCC ends up calling close on file descriptor 0, thus trying to close stdin. This patch tightens up the calling so that close is called only when the corresponding open call succeeded. With this my runtime failure disappears. Bootstrapped and tested on aarch64-none-linux-gnu. Though that doesn't exercise this call I hope it's an obviously correct change. * io/unix.c (fallback_access): Avoid calling close on uninitialized file descriptor. From-SVN: r264305
2018-09-05* io/async.h: Use __gthread_mutex_t, not pthread_mutex_t.Hans-Peter Nilsson1-2/+2
From-SVN: r264120
2018-09-02io.h: Change declaration of vlist type to gfc_full_array_i4 to eliminate ↵Jerry DeLisle3-3/+4
warning for... 2018-09-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> * io/io.h: Change declaration of vlist type to gfc_full_array_i4 to eliminate warning for mismatched type. * io/format.c ((parse_format_list): Use gfc_full_array_i4. * io/io.h: Use gfc_full_array_i4. From-SVN: r264043
2018-08-23* async.h (ASYNC_IO): Revert _AIX test.David Edelsohn1-1/+1
From-SVN: r263821
2018-08-22gfortran.texi: Mention that asynchronous I/O does not work on systems which ↵Thomas Koenig1-10/+13
lack condition... 2018-08-22 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.texi: Mention that asynchronous I/O does not work on systems which lack condition variables, such as AIX. 2018-08-22 Thomas Koenig <tkoenig@gcc.gnu.org> * async.h: Set ASYNC_IO to zero if _AIX is defined. (struct adv_cond): If ASYNC_IO is zero, the struct has no members. (async_unit): If ASYNC_IO is zero, remove unneeded members. From-SVN: r263788
2018-08-21re PR fortran/25829 ([F03] Asynchronous IO support)Nicolas Koenig11-119/+1412
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * gfortran.texi: Add description of asynchronous I/O. * trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables as volatile. * trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to st_wait_async and change argument spec from ".X" to ".w". (gfc_trans_wait): Pass ID argument via reference. 2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * gfortran.dg/f2003_inquire_1.f03: Add write statement. * gfortran.dg/f2003_io_1.f03: Add wait statement. 2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * Makefile.am: Add async.c to gfor_io_src. Add async.h to gfor_io_headers. * Makefile.in: Regenerated. * gfortran.map: Add _gfortran_st_wait_async. * io/async.c: New file. * io/async.h: New file. * io/close.c: Include async.h. (st_close): Call async_wait for an asynchronous unit. * io/file_pos.c (st_backspace): Likewise. (st_endfile): Likewise. (st_rewind): Likewise. (st_flush): Likewise. * io/inquire.c: Add handling for asynchronous PENDING and ID arguments. * io/io.h (st_parameter_dt): Add async bit. (st_parameter_wait): Correct. (gfc_unit): Add au pointer. (st_wait_async): Add prototype. (transfer_array_inner): Likewise. (st_write_done_worker): Likewise. * io/open.c: Include async.h. (new_unit): Initialize asynchronous unit. * io/transfer.c (async_opt): New struct. (wrap_scalar_transfer): New function. (transfer_integer): Call wrap_scalar_transfer to do the work. (transfer_real): Likewise. (transfer_real_write): Likewise. (transfer_character): Likewise. (transfer_character_wide): Likewise. (transfer_complex): Likewise. (transfer_array_inner): New function. (transfer_array): Call transfer_array_inner. (transfer_derived): Call wrap_scalar_transfer. (data_transfer_init): Check for asynchronous I/O. Perform a wait operation on any pending asynchronous I/O if the data transfer is synchronous. Copy PDT and enqueue thread for data transfer. (st_read_done_worker): New function. (st_read_done): Enqueue transfer or call st_read_done_worker. (st_write_done_worker): New function. (st_write_done): Enqueue transfer or call st_read_done_worker. (st_wait): Document as no-op for compatibility reasons. (st_wait_async): New function. * io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK; add NOTE where necessary. (get_gfc_unit): Likewise. (init_units): Likewise. (close_unit_1): Likewise. Call async_close if asynchronous. (close_unit): Use macros LOCK and UNLOCK. (finish_last_advance_record): Likewise. (newunit_alloc): Likewise. * io/unix.c (find_file): Likewise. (flush_all_units_1): Likewise. (flush_all_units): Likewise. * libgfortran.h (generate_error_common): Add prototype. * runtime/error.c: Include io.h and async.h. (generate_error_common): New function. 2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * testsuite/libgomp.fortran/async_io_1.f90: New test. * testsuite/libgomp.fortran/async_io_2.f90: New test. * testsuite/libgomp.fortran/async_io_3.f90: New test. * testsuite/libgomp.fortran/async_io_4.f90: New test. * testsuite/libgomp.fortran/async_io_5.f90: New test. * testsuite/libgomp.fortran/async_io_6.f90: New test. * testsuite/libgomp.fortran/async_io_7.f90: New test. Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org> From-SVN: r263750
2018-07-31Reverting 'AsyncI/O patch committed' as it is breaking bare-metal builds.Andre Vieira11-1304/+119
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed' 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * gfortran.texi: Add description of asynchronous I/O. * trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables as volatile. * trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to st_wait_async and change argument spec from ".X" to ".w". (gfc_trans_wait): Pass ID argument via reference. 2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed' 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * gfortran.dg/f2003_inquire_1.f03: Add write statement. * gfortran.dg/f2003_io_1.f03: Add wait statement. 2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed' 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * Makefile.am: Add async.c to gfor_io_src. Add async.h to gfor_io_headers. * Makefile.in: Regenerated. * gfortran.map: Add _gfortran_st_wait_async. * io/async.c: New file. * io/async.h: New file. * io/close.c: Include async.h. (st_close): Call async_wait for an asynchronous unit. * io/file_pos.c (st_backspace): Likewise. (st_endfile): Likewise. (st_rewind): Likewise. (st_flush): Likewise. * io/inquire.c: Add handling for asynchronous PENDING and ID arguments. * io/io.h (st_parameter_dt): Add async bit. (st_parameter_wait): Correct. (gfc_unit): Add au pointer. (st_wait_async): Add prototype. (transfer_array_inner): Likewise. (st_write_done_worker): Likewise. * io/open.c: Include async.h. (new_unit): Initialize asynchronous unit. * io/transfer.c (async_opt): New struct. (wrap_scalar_transfer): New function. (transfer_integer): Call wrap_scalar_transfer to do the work. (transfer_real): Likewise. (transfer_real_write): Likewise. (transfer_character): Likewise. (transfer_character_wide): Likewise. (transfer_complex): Likewise. (transfer_array_inner): New function. (transfer_array): Call transfer_array_inner. (transfer_derived): Call wrap_scalar_transfer. (data_transfer_init): Check for asynchronous I/O. Perform a wait operation on any pending asynchronous I/O if the data transfer is synchronous. Copy PDT and enqueue thread for data transfer. (st_read_done_worker): New function. (st_read_done): Enqueue transfer or call st_read_done_worker. (st_write_done_worker): New function. (st_write_done): Enqueue transfer or call st_read_done_worker. (st_wait): Document as no-op for compatibility reasons. (st_wait_async): New function. * io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK; add NOTE where necessary. (get_gfc_unit): Likewise. (init_units): Likewise. (close_unit_1): Likewise. Call async_close if asynchronous. (close_unit): Use macros LOCK and UNLOCK. (finish_last_advance_record): Likewise. (newunit_alloc): Likewise. * io/unix.c (find_file): Likewise. (flush_all_units_1): Likewise. (flush_all_units): Likewise. * libgfortran.h (generate_error_common): Add prototype. * runtime/error.c: Include io.h and async.h. (generate_error_common): New function. 2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed'. 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * testsuite/libgomp.fortran/async_io_1.f90: New test. * testsuite/libgomp.fortran/async_io_2.f90: New test. * testsuite/libgomp.fortran/async_io_3.f90: New test. * testsuite/libgomp.fortran/async_io_4.f90: New test. * testsuite/libgomp.fortran/async_io_5.f90: New test. * testsuite/libgomp.fortran/async_io_6.f90: New test. * testsuite/libgomp.fortran/async_io_7.f90: New test. From-SVN: r263082