aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/io.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-19re PR fortran/89103 (Allow blank format items in format strings)Jim MacArthur1-0/+9
2019-06-19 Jim MacArthur <jim.macarthur@codethink.co.uk> Mark Eggleston <mark.eggleston@codethink.com> PR fortran/89103 * gfortran.texi: Add -fdec-blank-format-item * invoke.texi: Add option to list of options. * invoke.texi: Add to section on Commas in FORMAT specifications. * io.c (check_format): At FMT_RPAREN goto finished if -fdec-blank-format-item otherwise set error string. * lang.opt: Add new option. * options.c (set_dec_flags): Add SET_BITFLAG for flag_dec_format_defaults. * gfortran.dg/dec_format_empty_item_1.f: New test. * gfortran.dg/dec_format_empty_item_2.f: New test. * gfortran.dg/dec_format_empty_item_3.f: New test. Co-Authored-By: Mark Eggleston <mark.eggleston@codethink.com> From-SVN: r272467
2019-06-13io.c (check_format): Use G_(...) instead of _(...) for error values...Jakub Jelinek1-26/+35
* io.c (check_format): Use G_(...) instead of _(...) for error values, append " in format string at %L" to all strings but unexpected_element, use error as gfc_error formating string instead of "%s in format string at %L". Formatting fixes. From-SVN: r272222
2019-05-22fortran/89100: Default widths with -fdec-format-defaultsJanne Blomqvist1-4/+27
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-02-22re PR fortran/83057 (OPEN without a filename and without STATUS='SCRATCH' ↵Harald Anlauf1-6/+5
could produce a warning) 2019-02-22 Harald Anlauf <anlauf@gmx.de> PR fortran/83057 * io.c (gfc_match_open): Fix logic in checks of OPEN statement when NEWUNIT= is specified. PR fortran/83057 * gfortran.dg/newunit_6.f90: New test. From-SVN: r269134
2019-01-31re PR fortran/52564 (Accepts invalid: Missing I/O list after comma)Jerry DeLisle1-0/+17
2019-01-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/52564 * io.c (match_io): Add check for comma after '*' without subsequent IO list. * gfortran.dg/print_2.f90: New test. From-SVN: r268412
2019-01-19re PR fortran/77960 (ICE in gfc_conv_ss_startstride, at ↵Steven G. Kargl1-0/+10
fortran/trans-array.c:3966) 2019-01-19 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77960 * io.c (match_io_element): input-item cannot be an external function. 2019-01-19 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77960 * gfortran.dg/pr77960.f90: New test. From-SVN: r268097
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 Jelinek1-1/+1
From-SVN: r267494
2018-12-23re PR fortran/88328 (ICE in resolve_tag_format, at fortran/io.c:1641)Steven G. Kargl1-1/+16
2018-12-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88328 * io.c (resolve_tag_format): Add error for zero-sized array. (gfc_resolve_dt): Manipulate gfc_current_locus to get sensible error message locus. 2018-12-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88328 * gfortran.dg/pr88328.f90: New test. From-SVN: r267367
2018-12-11re PR fortran/88249 (ICE in gfc_resolve_filepos, at fortran/io.c:2853)Steven G. Kargl1-7/+6
2018-12-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88249 * gfortran.h: Update prototype for gfc_resolve_filepos(). * io.c (gfc_resolve_filepos): Check for UNIT number if ERR= is present. Use passed in locus for error message. * resolve.c (gfc_resolve_code): Pass locus in gfc_resolve_filepos() call. 2018-12-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88249 * gfortran.dg/pr88249.f90: New test. From-SVN: r267035
2018-12-112018-12-10 Steven G. Kargl <kargl@gcc.gnu.org>Steven G. Kargl1-0/+30
PR fortran/97922 * io.c (gfc_match_open): Additional checks on ASYNCHRONOUS. 2018-12-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/97922 * gfortran.dg/io_constraints_8.f90: Update error message. * gfortran.dg/pr87922.f90: New test. From-SVN: r266968
2018-12-10re PR fortran/88269 (ICE in gfc_format_decoder, at fortran/error.c:947)Steven G. Kargl1-5/+11
2018-12-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88269 * io.c (io_constraint): Update macro. If locus line buffer is NULL, use gfc_current_locus in error messages. (check_io_constraints): Catch missing IO UNIT in write and read statements. io_constraint macro is incompatible here. 2018-12-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88269 * gfortran.dg/pr88269.f90: New test. From-SVN: r266959
2018-12-09re PR fortran/88205 (ICE in gfc_wide_strncasecmp, at fortran/scanner.c:249)Steven G. Kargl1-27/+27
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88205 * io.c (gfc_match_open): Move NEWUNIT checks to after STATUS checks. 2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88205 * gfortran.dg/pr88205.f90: New unit. From-SVN: r266936
2018-03-28gfortran.h (gfc_dt): Rename default_exp field to dec_ext.Jakub Jelinek1-2/+3
* gfortran.h (gfc_dt): Rename default_exp field to dec_ext. * ioparm.def (IOPARM_dt_default_exp): Rename to ... (IOPARM_dt_dec_ext): ... this. * trans-io.c (build_dt): Adjust for default_exp renaming to dec_ext and IOPARM_dt_default_exp renaming to IOPARM_dt_dec_ext. * io.c (match_io): Likewise. * io/io.h (IOPARM_DT_DEFAULT_EXP): Rename to ... (IOPARM_DT_DEC_EXT): ... this. * io/list_read.c (parse_real): Adjust for IOPARM_DT_DEFAULT_EXP renaming to IOPARM_DT_DEC_EXT. (read_real): Likewise. * io/read.c (read_f): Likewise. From-SVN: r258920
2018-03-26re PR fortran/66709 (ICE on formatted io with parameter array specifier fmt)Thomas Koenig1-1/+43
2018-03-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/66709 * io.c: Include constructor.h. (resolve_tag_format): For a constant character array, concatenate into a single character expression. 2018-03-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/66709 * gfortran.dg/parameter_array_format.f90: New test. From-SVN: r258850
2018-02-18re PR fortran/84389 (Defined output: unexpected compiler error with the use ↵Jerry DeLisle1-0/+3
of ":" edit descriptor) 2018-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/84389 * io.c (check_format): Allow FMT_COLON. * gfortran.dg/dtio_33.f90: New test. From-SVN: r257795
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-10-07gfortran.h (async_io_dt): Add external reference.Thomas Koenig1-3/+27
2017-10-07 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.h (async_io_dt): Add external reference. * io.c (async_io_dt): Add variable. (compare_to_allowed_values): Add prototyte. Add optional argument num. If present, set it to the number of the entry that was matched. (check_io_constraints): If this is for an asynchronous I/O statement, set async_io_dt and set the asynchronous flag for a SIZE tag. * resolve.c (resolve_transfer): If async_io_dt is set, set the asynchronous flag on the variable. (resolve_fl_namelist): If async_io_dt is set, set the asynchronous flag on all elements of the namelist. From-SVN: r253508
2017-10-03io.c (match_wait_element): Correctly match END and EOR tags.Thomas Koenig1-2/+2
2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org> * io.c (match_wait_element): Correctly match END and EOR tags. * dump-parse-tree.c (show_code_node): Handle EXEC_WAIT. From-SVN: r253381
2017-05-18re PR fortran/79968 (diagnostics: merge similar diagnostics containing ↵Fritz Reese1-6/+6
-fdec-structure) 2017-05-18 Fritz Reese <fritzoreese@gmail.com> PR fortran/79968 gcc/fortran/ChangeLog: PR fortran/79968 * decl.c (match_attr_spec, gfc_match_automatic, gfc_match_static, gfc_match_structure_decl): Unify diagnostic errors regarding -fdec options. * io.c (match_dec_etag, match_dec_vtag, match_dec_ftag): Ditto. From-SVN: r248188
2017-05-13io.c (gfc_resolve_dt): Fix returns to bool type.Jerry DeLisle1-3/+3
2017-05-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> * io.c (gfc_resolve_dt): Fix returns to bool type. From-SVN: r248008
2017-05-11re PR fortran/78659 ([F03] Spurious "requires DTIO" reported against ↵Jerry DeLisle1-10/+67
namelist statement) 2017-05-11 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/78659 * io.c (dtio_procs_present): Add new function to check for DTIO procedures relative to I/O statement READ or WRITE. (gfc_resolve_dt): Add namelist checks using the new function. * resolve.c (dtio_procs_present): Remove function and related namelist checks. (resolve_fl_namelist): Add check specific to Fortran 95 restriction on namelist objects. * gfortran.dg/namelist_91.f90: New test. * gfortran.dg/namelist_92.f90: New test. * gfortran.dg/namelist_93.f90: New test. * gfortran.dg/namelist_94.f90: New test. From-SVN: r247930
2017-04-23re PR fortran/80484 (Three syntax errors involving derived-type I/O)Jerry DeLisle1-48/+58
2017-04-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/80484 * io.c (format_lex): Check for '/' and set token to FMT_SLASH. (check_format): Move FMT_DT checking code to data_desc section. * module.c (gfc_match_use): Include the case of INTERFACE_DTIO. PR fortran/80484 * gfortran.dg/dtio_29.f03: New test. From-SVN: r247084
2017-03-22re PR fortran/79602 (translation: globally replace '%s' with %qs)Dominique d'Humieres1-1/+1
2017-03-22 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79602 * decl.c: Replace '%s' with %qs. * expr.c: Likewise. * interface.c: Likewise. * match.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. PR fortran/79844 PR fortran/80011 * io.c: Remove trailing spaces. * match.c: Likewise. * openmp.c: Likewise. * resolve.c: Likewise. * trans-intrinsic.c: Likewise. PR fortran/79853 * expr.c: Remove a double spaces. PR fortran/79859 * primary.c: Remove spurious quotes around %qs. From-SVN: r246391
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-16re PR fortran/78662 ([F03] Incorrect parsing of quotes in the ↵Jerry DeLisle1-1/+2
char-literal-constant of the DT data descriptor) 2016-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/78622 * io.c (format_lex): Continue of string delimiter seen. * io/transfer.c (get_dt_format): New static function to alloc and set the DT iotype string, handling doubled quotes. (formatted_transfer_scalar_read, formatted_transfer_scalar_write): Use new function. * gfortran.dg/dtio_20.f03: New test. From-SVN: r243765
2016-11-17re PR fortran/58001 (Make it possible to silence "Extension: Tab character ↵Steven G. Kargl1-26/+13
in format" warning) 2016-11-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/58001 * io.c (next_char_not_space): Update handling of a 'tab' in a FORMAT. (format_lex): Adjust invocations of next_char_not_space(). 2016-11-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/58001 * gfortran.dg/fmt_tab_1.f90: Adjust testcase. * gfortran.dg/fmt_tab_2.f90: Ditto. From-SVN: r242530
2016-11-03Default missing exponents to 0 with -fdec.Fritz Reese1-0/+4
gcc/fortran/ * gfortran.texi: Document. * gfortran.h (gfc_dt): New field default_exp. * primary.c (match_real_constant): Default exponent with -fdec. * io.c (match_io): Set dt.default_exp with -fdec. * ioparm.def (IOPARM_dt_default_exp): New. * trans-io.c (build_dt): Set IOPARM_dt_default_exp with -fdec. libgfortran/io/ * io.h (IOPARM_DT_DEFAULT_EXP): New flag bit. * list_read.c (parse_real, read_real): Allow omission of exponent with IOPARM_DT_DEFAULT_EXP. * read.c (read_f): Ditto. gcc/testsuite/gfortran.dg/ * dec_exp_1.f90, dec_exp_2.f90, dec_exp_3.f90: New testcases. From-SVN: r241828
2016-10-31re PR fortran/54679 (Erroneous "Expected P edit descriptor" in conjunction ↵Jerry DeLisle1-21/+25
with L descriptor) 2016-10-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/54679 * io.c (check_format): Adjust checks for FMT_L to treat a zero width as an extension, giving warnings or error as appropriate. Improve messages. PR libgfortran/54679 * io/format.c (parse_format_list): Adjust checks for FMT_L to treat a zero width as an extension, giving warnings or error as appropriate. Improve messages. PR fortran/54679 * gfortran.dg/fmt_l.f90: Update test. * gfortran.dg/fmt_l0.f90: New test. From-SVN: r241720
2016-10-26New I/O specifiers CARRIAGECONTROL, READONLY, SHARE with -fdec.Fritz Reese1-2/+175
gcc/fortran/ * gfortran.texi: Document. * frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL. * io.c (gfc_free_open, gfc_resolve_open, gfc_match_open): Ditto. * gfortran.h (gfc_open): Add SHARE, CARRIAGECONTROL, and READONLY. * io.c (io_tag, match_open_element): Ditto. * ioparm.def: Ditto. * trans-io.c (gfc_trans_open): Ditto. * io.c (match_dec_etag, match_dec_ftag): New functions. libgfortran/io/ * libgfortran.h (IOPARM_OPEN_HAS_READONLY, IOPARM_OPEN_HAS_SHARE, IOPARM_OPEN_HAS_CC): New for READONLY, SHARE, and CARRIAGECONTROL. * close.c (st_close): Support READONLY. * io.h (st_parameter_open, unit_flags): Support SHARE, CARRIAGECONTROL, and READONLY. * open.c (st_open): Ditto. * transfer.c (data_transfer_init): Ditto. * io.h (st_parameter_dt): New member 'cc' for CARRIAGECONTROL. * write.c (write_check_cc, write_cc): New functions for CARRIAGECONTROL. * transfer.c (next_record_cc): Ditto. * file_pos.c (st_endfile): Support SHARE and CARRIAGECONTROL. * io.h (st_parameter_inquire): Ditto. * open.c (edit_modes, new_unit): Ditto. * inquire.c (inquire_via_unit, inquire_via_filename): Ditto. * io.h (unit_share, unit_cc, cc_fortran, IOPARM_INQUIRE_HAS_SHARE, IOPARM_INQUIRE_HAS_CC): New for SHARE and CARRIAGECONTROL. * open.c (share_opt, cc_opt): Ditto. * read.c (read_x): Support CARRIAGECONTROL. * transfer.c (read_sf, next_record_r, next_record_w): Ditto. * write.c (list_formatted_write_scalar, write_a): Ditto. * unix.h (close_share): New prototype. * unix.c (open_share, close_share): New functions to handle SHARE. * unix.c (open_external): Handle READONLY. Call open_share. * close.c (st_close): Call close_share. gcc/testsuite/ * dec_io_1.f90: New test. * dec_io_2.f90: New test. * dec_io_3.f90: New test. * dec_io_4.f90: New test. * dec_io_5.f90: New test. * dec_io_6.f90: New test. From-SVN: r241550
2016-09-30re PR fortran/66643 (Missing compilation error for formatted data transfer ↵Jerry DeLisle1-0/+6
without format) 2016-09-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/66643 * io.c (match_dt_unit): Peek check for missing format. * gfortran.fortran-torture/compile/arrayio.f90: Update test. * gfortran.fortran-torture/compile/write.f90: Update test. From-SVN: r240686
2016-09-23re PR fortran/48298 ([F03] User-Defined Derived-Type IO (DTIO))Jerry DeLisle1-2/+4
2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/48298 * io/inquire.c (inquire_via_unit): Adjust error check for the two possible internal unit KINDs. * io/io.h: Adjust defines for is_internal_unit and is_char4_unit. (gfc_unit): Add internal unit data to structure. (get_internal_unit): Change declaration to set_internal_unit. (free_internal_unit): Change name to stash_internal_unit_number. (get_unique_unit_number): Adjust parameter argument. Define IOPARM_DT_HAS_UDTIO. (gfc_saved_unit): New structure. * io/list_read.c (next_char_internal): Use is_char4_unit. * io/open.c (st_open): Adjust call to get_unique_unit_number. * io/transfer.c (write_block): Use is_char4_unit. (data_transfer_init): Update check for unit numbers. (st_read_done): Free the various allocated memories used for the internal units and stash the negative unit number and pointer to unit structure to allow reuse. (st_write_done): Likewise stash the freed unit. * io/unit.c: Create a fixed size buffer of 16 gfc_saved_unit's to use as a stack to save newunit unit numbers and unit structure for reuse. (get_external_unit): Change name to get_gfc_unit to better reflect what it does. (find_unit): Change call to get_gfc_unit. (find_or_create_unit): Likewise. (get_internal_unit): Change name to set_internal_unit. Move internal unit from the dtp structure to the gfc_unit structure so that it can be passed to child I/O statements through the UNIT. (free_internal_unit): Change name to stash_internal_unit_number. Push the common.unit number onto the newunit stack, saving it for possible reuse later. (get_unit): Set the internal unit KIND. Use get_unique_unit_number to get a negative unit number for the internal unit. Use get_gfc_unit to get the unit structure and use set_internal_unit to initialize it. (init_units): Initialize the newunit stack. (get_unique_unit_number): Check the stack for an available unit number and use it. If none there get the next most negative number. (close_units): Free any unit structures pointed to from the save stack. 2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/48298 * gfortran.h (gfc_dt): Add *udtio. * ioparm.def: Add bit IOPARM_dt_f2003 to align with library use of bit 25. Add IOPARM_dt_dtio bit to common flags. * resolve.c (resolve_transfer): Set dt->udtio to expression. * io.c (gfc_match_inquire): Adjust error message for internal unit KIND. * libgfortran.h: Adjust defines for GFC_INTERNAL_UNIT4, GFC_INTERNAL_UNIT, and GFC_INVALID_UNIT. * trans-io.c (build_dt): Set common_unit to reflect the KIND of the internal unit. Set mask bit for presence of dt->udtio. 2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/48298 * gfortran.dg/negative_unit_check.f90: Update test. * gfortran.dg/dtio_14.f90: New test. From-SVN: r240456
2016-08-31[multiple changes]Paul Thomas1-1/+87
2016-08-31 Paul Thomas <pault@gcc.gnu.org> Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/48298 * decl.c (access_attr_decl): Include case INTERFACE_DTIO as appropriate. * gfortran.h : Add INTRINSIC_FORMATTED and INTRINSIC_UNFORMATTED to gfc_intrinsic_op. Add INTERFACE_DTIO to interface type. Add new enum 'dtio_codes'. Add bitfield 'has_dtio_procs' to symbol_attr. Add prototypes 'gfc_check_dtio_interfaces' and 'gfc_find_specific_dtio_proc'. * interface.c (dtio_op): New function. (gfc_match_generic_spec): Match generic DTIO interfaces. (gfc_match_interface): Treat DTIO interfaces in the same way as (gfc_current_interface_head): Add INTERFACE_DTIO appropriately. (check_dtio_arg_TKR_intent): New function. (check_dtio_interface1): New function. (gfc_check_dtio_interfaces): New function. (gfc_find_specific_dtio_proc): New function. * io.c : Add FMT_DT to format_token. (format_lex): Handle DTIO formatting. * match.c (gfc_op2string): Add DTIO operators. * resolve.c (derived_inaccessible): Ignore pointer components to enclosing derived type. (resolve_transfer): Resolve transfers that involve DTIO. procedures. Find the specific subroutine for the transfer and use its existence to over-ride some of the constraints on derived types. If the transfer is recursive, require that the subroutine be so qualified. (dtio_procs_present): New function. (resolve_fl_namelist): Remove inhibition of polymorphic objects in namelists if DTIO read and write subroutines exist. Likewise for derived types. (resolve_types): Invoke 'gfc_verify_dtio_procedures'. * symbol.c : Set 'dtio_procs' using 'minit'. * trans-decl.c (gfc_finish_var_decl): If a derived-type/class object is associated with DTIO procedures, make it TREE_STATIC. * trans-expr.c (gfc_get_vptr_from_expr): If the expression drills down to a PARM_DECL, extract the vptr correctly. (gfc_conv_derived_to_class): Check 'info' in the test for 'useflags'. If the se expression exists and is a pointer, use it as the class _data. * trans-io.c : Add IOCALL_X_DERIVED to iocall and the function prototype. Likewise for IOCALL_SET_NML_DTIO_VAL. (set_parameter_tree): Renamed from 'set_parameter_const', now returns void and has new tree argument. Calls modified to match new interface. (transfer_namelist_element): Transfer DTIO procedure pointer and vpointer using the new function IOCALL_SET_NML_DTIO_VAL. (get_dtio_proc): New function. (transfer_expr): Add new argument for the vptr field of class objects. Add the code to call the specific DTIO proc, convert derived types to class and call IOCALL_X_DERIVED. (trans_transfer): Add BT_CLASS to structures for treatment by the scalarizer. Obtain the vptr for the dynamic type, both for scalar and array transfer. 2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR libgfortran/48298 * gfortran.map : Flag _st_set_nml_dtio_var and _gfortran_transfer_derived. * io/format.c (format_lex): Detect DTIO formatting. (parse_format_list): Parse the DTIO format. (next_format): Include FMT_DT. * io/format.h : Likewise. Add structure 'udf' to structure 'fnode' to carry the IOTYPE string and the 'vlist'. * io/io.h : Add prototypes for the two types of DTIO subroutine and a typedef for gfc_class. Also, add to 'namelist_type' fields for the pointer to the DTIO procedure and the vtable. Add fields to struct st_parameter_dt for pointers to the two types of DTIO subroutine. Add to gfc_unit DTIO specific fields. (internal_proto): Add prototype for 'read_user_defined' and 'write_user_defined'. * io/list_read.c (check_buffers): Use the 'current_unit' field. (unget_char): Likewise. (eat_spaces): Likewise. (list_formatted_read_scalar): For case BT_CLASS, call the DTIO procedure. (nml_get_obj_data): Likewise when DTIO procedure is present,. * io/transfer.c : Export prototypes for 'transfer_derived' and 'transfer_derived_write'. (unformatted_read): For case BT_CLASS, call the DTIO procedure. (unformatted_write): Likewise. (formatted_transfer_scalar_read): Likewise. (formatted_transfer_scalar_write: Likewise. (transfer_derived): New function. (data_transfer_init): Set last_char if no child_dtio. (finalize_transfer): Return if child_dtio set. (st_write_done): Add condition for child_dtio not set. Add extra arguments for st_set_nml_var prototype. (set_nml_var): New function that contains the contents of the old version of st_set_nml_var. Also sets the 'dtio_sub' and 'vtable' fields of the 'nml' structure. (st_set_nml_var): Now just calls set_nml_var with 'dtio_sub' and 'vtable' NULL. (st_set_nml_dtio_var): New function that calls set_nml_var. * io/unit.c (get_external_unit): If the found unit child_dtio is non zero, don't do any mutex locking/unlocking. Just return the unit. * io/unix.c (tempfile_open): Revert to C style comment. * io/write.c (list_formatted_write_scalar): Do the DTIO call. (nml_write_obj): Add BT_CLASS and do the DTIO call. 2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/48298 * gfortran.dg/dtio_1.f90: New test. * gfortran.dg/dtio_2.f90: New test. * gfortran.dg/dtio_3.f90: New test. * gfortran.dg/dtio_4.f90: New test. * gfortran.dg/dtio_5.f90: New test. * gfortran.dg/dtio_6.f90: New test. * gfortran.dg/dtio_7.f90: New test. * gfortran.dg/dtio_8.f90: New test. * gfortran.dg/dtio_9.f90: New test. * gfortran.dg/dtio_10.f90: New test. From-SVN: r239880
2016-07-30re PR fortran/70006 (Duplicate errors "label not defined")Steven G. Kargl1-1/+1
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/70006 * io.c (gfc_resolve_dt): Use correct locus. * resolve.c (resolve_branch): Ditto. 2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/70006 * gfortran.dg/pr70006.f90: New test. From-SVN: r238905
2016-06-11re PR fortran/60751 (Extra comma in WRITE statement not diagnosed)Dominique d'Humieres1-1/+1
2016-06-11 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/60751 * io.c (gfc_resolve_dt): Replace GFC_STD_GNU with GFC_STD_LEGACY. * gfortran.dg/comma_IO_extension_1.f90: New test. * gfortran.dg/comma_IO_extension_2.f90: Likewise. * gfortran.dg/array_constructor_49.f90: Remove extra comma in WRITE statement. * gfortran.dg/graphite/pr38083.f90: Likewise. * gfortran.dg/integer_exponentiation_6.F90: Likewise and add missing format. --This line M fortran/ChangeLog M fortran/io.c M testsuite/ChangeLog M testsuite/gfortran.dg/array_constructor_49.f90 M testsuite/gfortran.dg/graphite/pr38083.f90 M testsuite/gfortran.dg/integer_exponentiation_6.F90 From-SVN: r237329
2016-06-05re PR fortran/71404 (416.gamess in SPEC CPU 2006 failed to build)Jerry DeLisle1-0/+3
2016-06-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/71404 * io.c (match_io): For READ, commit in pending symbols in the current statement before trying to match an expression so that if the match fails and we undo symbols we dont toss good symbols. From-SVN: r237108
2016-06-01re PR fortran/52393 (I/O: "READ format" statement with parenthesed ↵Jerry DeLisle1-14/+49
default-char-expr) 2016-06-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/52393 * io.c (match_io): For READ, try to match a default character expression. If found, set the dt format expression to this, otherwise go back and try control list. PR fortran/52393 * gfortran.dg/fmt_read_3.f90: New test. From-SVN: r237003
2016-02-27re PR fortran/69910 (ICE with NEWUNIT)Jerry DeLisle1-7/+10
2016-02-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69110 * io.c (gfc_match_open): Check that open status is an expression constant before comparing string to 'scratch' with NEWUNIT. * gfortran.dg/newunit_4.f90: New test. Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org> From-SVN: r233782
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-12-10Fix misleading indentation in gcc/fortran/io.cDavid Malcolm1-2/+2
Fix this warning: ../../../src/gcc/fortran/io.c: In function ‘match gfc_match_open()’: ../../../src/gcc/fortran/io.c:2003:4: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation] if (!compare_to_allowed_values ("DELIM", delim, NULL, NULL, ^ ../../../src/gcc/fortran/io.c:2000:2: note: ...this ‘if’ clause, but it is not if (!is_char_type ("DELIM", open->delim)) ^ gcc/fortran/ChangeLog: * io.c (gfc_match_open): Fix indentation. From-SVN: r231519
2015-12-09re PR fortran/68815 (Error/warning diagnostic: '%s' should be converted to ↵Tobias Burnus1-1/+1
%qs-like or %<%s%>-like string strings) 2015-12-09 Tobias Burnus <burnus@net-b.de> PR fortran/68815 * decl.c (gfc_verify_c_interop_param, variable_decl): Use %< ... %> for quoting in diagnostics. * io.c (check_format): Ditto. * resolve.c (resolve_operator): Ditto. * symbol.c (check_conflict): Ditto. * trans-common.c (translate_common): Ditto. From-SVN: r231472
2015-11-13re PR fortran/68319 (ICE on using interface with included entry)Steven G. Kargl1-0/+9
2015-11-13 Steven G. Kargl <kargl@gccc.gnu.org> PR fortran/68319 * decl.c (gfc_match_data, gfc_match_entry): Enforce F2008:C1206. * io.c (gfc_match_format): Ditto. * match.c (gfc_match_st_function): Ditto. 2015-11-13 Steven G. Kargl <kargl@gccc.gnu.org> PR fortran/68319 * gfortran.dg/pr68319.f90: New test. From-SVN: r230351
2015-10-26re PR fortran/66056 (ICEs and endless compilation for lonely labels/numbers ↵Louis Krupp1-1/+1
in type) 2015-10-26 Louis Krupp <louis.krupp@zoho.com> PR fortran/66056 * fortran.h: Include namespace pointer in statement label structure. * symbol.c (gfc_get_st_label): Store pointer to namespace that owns the statement label tree in each label. (gfc_free_st_label): Use namespace owning statement label tree when deleting statement label. * io.c: Initialize format_asterisk with NULL namespace pointer. 2015-10-26 Louis Krupp <louis.krupp@zoho.com> PR fortran/66056 * gfortran.dg/empty_label_typedecl.f90: New test From-SVN: r229390
2015-10-02re PR fortran/66979 (gfortran internal compiler error with malformed FLUSH ↵Steven G. Kargl1-0/+9
statement) 2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66979 * io.c (gfc_resolve_filepos): Check for a UNIT number. Add a nearby missing 'return false'. 2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66979 gfortran.dg/pr66979.f90: new test. From-SVN: r228364
2015-08-19remove more useless typedefsTrevor Saunders1-3/+2
gcc/c-family/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, c-objc.h, c-ppoutput.c, c-pragma.c, c-pragma.h: Remove useless typedefs. gcc/c/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. gcc/cp/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * call.c, class.c, cp-tree.h, decl.c, except.c, mangle.c, method.c, name-lookup.h, parser.c, parser.h, rtti.c, semantics.c, typeck2.c: Remove useless typedefs. gcc/fortran/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * dependency.c, dependency.h, gfortran.h, io.c, module.c, parse.h, resolve.c, trans-types.h, trans.h: remove useless typedefs. gcc/lto/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * lto.h: Remove useless typedefs. gcc/objc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * objc-act.h, objc-next-runtime-abi-02.c, objc-runtime-hooks.h: Remove useless typedefs. gcc/ChangeLog: 2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> * bb-reorder.c, cfgloop.h, collect2.c, combine.c, dse.c, dwarf2cfi.c, gcse-common.h, genopinit.c, ggc-page.c, machmode.h, mcf.c, modulo-sched.c, omp-low.c, read-rtl.c, sched-rgn.c, signop.h, tree-call-cdce.c, tree-dfa.c, tree-diagnostic.c, tree-inline.h, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-loop-niter.c, tree-ssa-loop.h, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.h, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-ssa.h, tree-vect-loop-manip.c, tree-vectorizer.h, tree-vrp.c, var-tracking.c: Remove useless typedefs. From-SVN: r227001
2015-07-17re PR fortran/66724 (ICE on input/output statements with wrong specifier data)Steven G. Kargl1-0/+8
2015-07-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66724 PR fortran/66724 * io.c (is_char_type): Call gfc_resolve_expr (). (match_open_element, match_dt_element, match_inquire_element): Fix ASYNCHRONOUS case. From-SVN: r225913
2015-07-09flags.h: Don't include flag-types.h or options.h.Andrew MacLeod1-1/+1
2015-07-09 Andrew MacLeod <amacleod@redhat.com> * flags.h: Don't include flag-types.h or options.h. * opts-common.c: Adjust includes. * opts-global.c: Likewise. * common/config/epiphany/epiphany-common.c: Likewise. c * c-array-notation.c: Adjust includes for flags.h changes. * c-objc-common.c: Likewise. c-family * c-common.h: Adjust includes for flags.h changes. * stub-objc.c: Likewise. fortran * arith.c: Adjust includes for flags.h changes. * array.c: Likewise. * check.c: Likewise. * decl.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * frontend-passes.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * io.c: Likewise. * match.c: Likewise. * openmp.c: Likewise. * parse.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * symbol.c: Likewise. * target-memory.c: Likewise. jit * dummy-frontend.c: Adjust includes for flags.h changes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto * lto-lang.c: Adjust includes for flags.h changes. From-SVN: r225608
2015-07-06io.c (check_char_variable): New function.Steven G. Kargl1-7/+34
2015-07-06 Steven G. Kargl <kargl@gcc.gnu.org> * io.c (check_char_variable): New function. (match_open_element, match_close_element, match_file_element, match_dt_element, match_inquire_element, match_wait_element): Use it. 2015-07-06 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/iomsg_2.f90: New test. From-SVN: r225462
2015-07-04[multiple changes]Steven G. Kargl1-1/+80
2015-07-04 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66725 * io.c (is_char_type): New function to test for BT_CHARACTER (gfc_match_open, gfc_match_close, match_dt_element): Use it. 2015-07-03 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66725 * gfortran.dg/pr66725.f90: New test. From-SVN: r225415
2015-05-18re PR fortran/66039 (ICE on incomplete parentheses at rewind, flush, ↵Steven G. Kargl1-3/+1
endfile, backspace) 2015-05-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66039 * io.c (match_filepos): Check for incomplete/mangled REWIND, FLUSH, BACKSPACE, and ENDFILE statements 2015-05-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66039 * gfortran.dg/filepos1.f90: New test From-SVN: r223315