2004-05-13 02:41:07 -04:00
|
|
|
/* IO Code translation/library interface
|
arith.c, [...]: Update copyright.
* arith.c, array.c, check.c, decl.c, expr.c, f95-lang.c,
gfortran.h, interface.c, intrinsic.c, io.c, iresolve.c,
match.c, matchexp.c, misc.c, module.c, options.c, parse.c,
scanner.c, simplify.c, symbol.c, trans-array.c, trans-expr.c,
trans-io.c, trans-stmt.c, trans.c: Update copyright.
From-SVN: r93830
2005-01-18 12:11:56 +00:00
|
|
|
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
2004-05-13 02:41:07 -04:00
|
|
|
Contributed by Paul Brook
|
|
|
|
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
This file is part of GCC.
|
2004-05-13 02:41:07 -04:00
|
|
|
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 2, or (at your option) any later
|
|
|
|
version.
|
2004-05-13 02:41:07 -04:00
|
|
|
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
2005-06-25 00:40:37 +00:00
|
|
|
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tree.h"
|
tree-gimple.c: Rename from tree-simple.c.
* tree-gimple.c: Rename from tree-simple.c.
* tree-gimple.h: Rename from tree-simple.h.
* c-gimplify.c: Rename from c-simplify.c
* Makefile.in, c-decl.c, gimple-low.c, gimplify.c,
langhooks.c, tree-alias-ander.c, tree-alias-common.c,
tree-complex.c, tree-dfa.c, tree-flow.h, tree-inline.c,
tree-into-ssa.c, tree-iterator.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-outof-ssa.c, tree-sra.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-live.c, tree-ssa-pre.c, tree-ssa.c:
Update.
cp/ChangeLog
* cp-gimplify.c: Rename from cp-simplify.c.
* Make-lang.in, optimize.c: Update.
fortran/ChangeLog
* Make-lang.in, f95-lang.c, trans-array.c, trans-decl.c,
trans-expr.c, trans-intrinsic.c, trans-io.c, trans-stmt.c,
trans.c: Rename tree-simple.[ch] to tree-gimple.[ch].
java/ChangeLog
* Make-lang.in, expr.c, java-gimplify.c: Rename
tree-simple.[ch] to tree-gimple.[ch].
From-SVN: r81829
2004-05-14 02:29:32 +00:00
|
|
|
#include "tree-gimple.h"
|
2004-05-13 02:41:07 -04:00
|
|
|
#include "ggc.h"
|
|
|
|
#include "toplev.h"
|
|
|
|
#include "real.h"
|
|
|
|
#include "gfortran.h"
|
|
|
|
#include "trans.h"
|
|
|
|
#include "trans-stmt.h"
|
|
|
|
#include "trans-array.h"
|
|
|
|
#include "trans-types.h"
|
|
|
|
#include "trans-const.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Members of the ioparm structure. */
|
|
|
|
|
|
|
|
static GTY(()) tree ioparm_unit;
|
|
|
|
static GTY(()) tree ioparm_err;
|
|
|
|
static GTY(()) tree ioparm_end;
|
|
|
|
static GTY(()) tree ioparm_eor;
|
|
|
|
static GTY(()) tree ioparm_list_format;
|
|
|
|
static GTY(()) tree ioparm_library_return;
|
|
|
|
static GTY(()) tree ioparm_iostat;
|
|
|
|
static GTY(()) tree ioparm_exist;
|
|
|
|
static GTY(()) tree ioparm_opened;
|
|
|
|
static GTY(()) tree ioparm_number;
|
|
|
|
static GTY(()) tree ioparm_named;
|
|
|
|
static GTY(()) tree ioparm_rec;
|
|
|
|
static GTY(()) tree ioparm_nextrec;
|
|
|
|
static GTY(()) tree ioparm_size;
|
|
|
|
static GTY(()) tree ioparm_recl_in;
|
|
|
|
static GTY(()) tree ioparm_recl_out;
|
2004-06-22 03:43:55 +03:00
|
|
|
static GTY(()) tree ioparm_iolength;
|
2004-05-13 02:41:07 -04:00
|
|
|
static GTY(()) tree ioparm_file;
|
|
|
|
static GTY(()) tree ioparm_file_len;
|
|
|
|
static GTY(()) tree ioparm_status;
|
|
|
|
static GTY(()) tree ioparm_status_len;
|
|
|
|
static GTY(()) tree ioparm_access;
|
|
|
|
static GTY(()) tree ioparm_access_len;
|
|
|
|
static GTY(()) tree ioparm_form;
|
|
|
|
static GTY(()) tree ioparm_form_len;
|
|
|
|
static GTY(()) tree ioparm_blank;
|
|
|
|
static GTY(()) tree ioparm_blank_len;
|
|
|
|
static GTY(()) tree ioparm_position;
|
|
|
|
static GTY(()) tree ioparm_position_len;
|
|
|
|
static GTY(()) tree ioparm_action;
|
|
|
|
static GTY(()) tree ioparm_action_len;
|
|
|
|
static GTY(()) tree ioparm_delim;
|
|
|
|
static GTY(()) tree ioparm_delim_len;
|
|
|
|
static GTY(()) tree ioparm_pad;
|
|
|
|
static GTY(()) tree ioparm_pad_len;
|
|
|
|
static GTY(()) tree ioparm_format;
|
|
|
|
static GTY(()) tree ioparm_format_len;
|
|
|
|
static GTY(()) tree ioparm_advance;
|
|
|
|
static GTY(()) tree ioparm_advance_len;
|
|
|
|
static GTY(()) tree ioparm_name;
|
|
|
|
static GTY(()) tree ioparm_name_len;
|
|
|
|
static GTY(()) tree ioparm_internal_unit;
|
|
|
|
static GTY(()) tree ioparm_internal_unit_len;
|
2005-09-14 20:19:37 +00:00
|
|
|
static GTY(()) tree ioparm_internal_unit_desc;
|
2004-05-13 02:41:07 -04:00
|
|
|
static GTY(()) tree ioparm_sequential;
|
|
|
|
static GTY(()) tree ioparm_sequential_len;
|
|
|
|
static GTY(()) tree ioparm_direct;
|
|
|
|
static GTY(()) tree ioparm_direct_len;
|
|
|
|
static GTY(()) tree ioparm_formatted;
|
|
|
|
static GTY(()) tree ioparm_formatted_len;
|
|
|
|
static GTY(()) tree ioparm_unformatted;
|
|
|
|
static GTY(()) tree ioparm_unformatted_len;
|
|
|
|
static GTY(()) tree ioparm_read;
|
|
|
|
static GTY(()) tree ioparm_read_len;
|
|
|
|
static GTY(()) tree ioparm_write;
|
|
|
|
static GTY(()) tree ioparm_write_len;
|
|
|
|
static GTY(()) tree ioparm_readwrite;
|
|
|
|
static GTY(()) tree ioparm_readwrite_len;
|
|
|
|
static GTY(()) tree ioparm_namelist_name;
|
|
|
|
static GTY(()) tree ioparm_namelist_name_len;
|
|
|
|
static GTY(()) tree ioparm_namelist_read_mode;
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
static GTY(()) tree ioparm_iomsg;
|
|
|
|
static GTY(()) tree ioparm_iomsg_len;
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
/* The global I/O variables */
|
|
|
|
|
|
|
|
static GTY(()) tree ioparm_var;
|
|
|
|
static GTY(()) tree locus_file;
|
|
|
|
static GTY(()) tree locus_line;
|
|
|
|
|
|
|
|
|
|
|
|
/* Library I/O subroutines */
|
|
|
|
|
|
|
|
static GTY(()) tree iocall_read;
|
|
|
|
static GTY(()) tree iocall_read_done;
|
|
|
|
static GTY(()) tree iocall_write;
|
|
|
|
static GTY(()) tree iocall_write_done;
|
|
|
|
static GTY(()) tree iocall_x_integer;
|
|
|
|
static GTY(()) tree iocall_x_logical;
|
|
|
|
static GTY(()) tree iocall_x_character;
|
|
|
|
static GTY(()) tree iocall_x_real;
|
|
|
|
static GTY(()) tree iocall_x_complex;
|
2005-09-26 23:24:45 +03:00
|
|
|
static GTY(()) tree iocall_x_array;
|
2004-05-13 02:41:07 -04:00
|
|
|
static GTY(()) tree iocall_open;
|
|
|
|
static GTY(()) tree iocall_close;
|
|
|
|
static GTY(()) tree iocall_inquire;
|
2004-06-22 03:43:55 +03:00
|
|
|
static GTY(()) tree iocall_iolength;
|
|
|
|
static GTY(()) tree iocall_iolength_done;
|
2004-05-13 02:41:07 -04:00
|
|
|
static GTY(()) tree iocall_rewind;
|
|
|
|
static GTY(()) tree iocall_backspace;
|
|
|
|
static GTY(()) tree iocall_endfile;
|
2005-08-08 01:56:19 +03:00
|
|
|
static GTY(()) tree iocall_flush;
|
2005-04-17 20:09:37 +00:00
|
|
|
static GTY(()) tree iocall_set_nml_val;
|
|
|
|
static GTY(()) tree iocall_set_nml_val_dim;
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
/* Variable for keeping track of what the last data transfer statement
|
|
|
|
was. Used for deciding which subroutine to call when the data
|
arith.c, [...]: Fix comment formatting.
* arith.c, array.c, decl.c, expr.c, f95-lang.c, gfortran.h,
gfortranspec.c, interface.c, intrinsic.c, iresolve.c, match.c,
module.c, parse.c, parse.h, primary.c, resolve.c, scanner.c,
trans-array.c, trans-array.h, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans.h: Fix comment formatting.
From-SVN: r90266
2004-11-08 14:56:41 +00:00
|
|
|
transfer is complete. */
|
2004-06-22 03:43:55 +03:00
|
|
|
static enum { READ, WRITE, IOLENGTH } last_dt;
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
#define ADD_FIELD(name, type) \
|
|
|
|
ioparm_ ## name = gfc_add_field_to_struct \
|
|
|
|
(&(TYPE_FIELDS (ioparm_type)), ioparm_type, \
|
|
|
|
get_identifier (stringize(name)), type)
|
|
|
|
|
|
|
|
#define ADD_STRING(name) \
|
|
|
|
ioparm_ ## name = gfc_add_field_to_struct \
|
|
|
|
(&(TYPE_FIELDS (ioparm_type)), ioparm_type, \
|
|
|
|
get_identifier (stringize(name)), pchar_type_node); \
|
|
|
|
ioparm_ ## name ## _len = gfc_add_field_to_struct \
|
|
|
|
(&(TYPE_FIELDS (ioparm_type)), ioparm_type, \
|
2005-01-22 15:37:39 +01:00
|
|
|
get_identifier (stringize(name) "_len"), gfc_charlen_type_node)
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
/* Create function decls for IO library functions. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gfc_build_io_library_fndecls (void)
|
|
|
|
{
|
Make-lang.in (fortran/f95-lang.o): Update dependencies.
* Make-lang.in (fortran/f95-lang.o): Update dependencies.
(fortran/trans-decl.o, fortran/trans-types.o): Likewise.
* gfortran.h (gfc_integer_info): Add c_char, c_short, c_int,
c_long, c_long_long.
(gfc_logical_info): Add c_bool.
(gfc_real_info): Add mode_precision, c_float, c_double, c_long_double.
* trans-array.c (gfc_array_allocate): Use TYPE_PRECISION
rather than gfc_int[48]_type_node for allocate choice.
* trans-decl.c (gfc_build_intrinsic_function_decls): Cache
local copies of some kind type nodes.
(gfc_build_builtin_function_decls): Likewise.
* trans-expr.c (gfc_conv_power_op): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_index,
gfc_conv_intrinsic_scan, gfc_conv_intrinsic_verify,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat): Likewise.
* trans-stmt.c (gfc_trans_pause, gfc_trans_stop,
gfc_trans_character_select, gfc_trans_allocate): Likewise.
* trans-io.c (gfc_pint4_type_node): Move into ...
(gfc_build_io_library_fndecls): ... here. Cache local copies of
some kind type nodes.
* trans-types.c (gfc_type_nodes): Remove.
(gfc_character1_type_node, gfc_strlen_type_node): New.
(gfc_integer_types, gfc_logical_types): New.
(gfc_real_types, gfc_complex_types): New.
(gfc_init_kinds): Fill in real mode_precision.
(gfc_build_int_type, gfc_build_real_type): New.
(gfc_build_complex_type, gfc_build_logical_type): New.
(c_size_t_size): New.
(gfc_init_types): Loop over kinds.
(gfc_get_int_type, gfc_get_real_type): Use gfc_validate_kind.
(gfc_get_complex_type, gfc_get_logical_type): Likewise.
(gfc_get_character_type_len): Likewise.
(gfc_type_for_size): Loop over kinds; use a reduced set of
unsigned type nodes.
(gfc_type_for_mode): Loop over kinds.
(gfc_signed_or_unsigned_type): Use gfc_type_for_size.
(gfc_unsigned_type, gfc_signed_type): Use gfc_signed_or_unsigned_type.
* trans-types.h (F95_INT1_TYPE, F95_INT2_TYPE, F95_INT4_TYPE,
F95_INT8_TYPE, F95_INT16_TYPE, F95_REAL4_TYPE, F95_REAL8_TYPE,
F95_REAl16_TYPE, F95_COMPLEX4_TYPE, F95_COMPLEX8_TYPE,
F95_COMPLEX16_TYPE, F95_LOGICAL1_TYPE, F95_LOGICAL2_TYPE,
F95_LOGICAL4_TYPE, F95_LOGICAL8_TYPE, F95_LOGICAL16_TYPE,
F95_CHARACTER1_TYPE, NUM_F95_TYPES, gfc_type_nodes,
gfc_int1_type_node, gfc_int2_type_node, gfc_int4_type_node,
gfc_int8_type_node, gfc_int16_type_node, gfc_real4_type_node,
gfc_real8_type_node, gfc_real16_type_node, gfc_complex4_type_node,
gfc_complex8_type_node, gfc_complex16_type_node,
gfc_logical1_type_node, gfc_logical2_type_node,
gfc_logical4_type_node, gfc_logical8_type_node,
gfc_logical16_type_node, gfc_strlen_kind): Remove.
(gfc_character1_type_node): Turn in to a variable.
(gfc_strlen_type_node): Likewise.
From-SVN: r86806
2004-08-30 14:59:08 -07:00
|
|
|
tree gfc_int4_type_node;
|
|
|
|
tree gfc_pint4_type_node;
|
2005-11-06 20:28:22 +02:00
|
|
|
tree gfc_c_int_type_node;
|
2004-05-13 02:41:07 -04:00
|
|
|
tree ioparm_type;
|
|
|
|
|
Make-lang.in (fortran/f95-lang.o): Update dependencies.
* Make-lang.in (fortran/f95-lang.o): Update dependencies.
(fortran/trans-decl.o, fortran/trans-types.o): Likewise.
* gfortran.h (gfc_integer_info): Add c_char, c_short, c_int,
c_long, c_long_long.
(gfc_logical_info): Add c_bool.
(gfc_real_info): Add mode_precision, c_float, c_double, c_long_double.
* trans-array.c (gfc_array_allocate): Use TYPE_PRECISION
rather than gfc_int[48]_type_node for allocate choice.
* trans-decl.c (gfc_build_intrinsic_function_decls): Cache
local copies of some kind type nodes.
(gfc_build_builtin_function_decls): Likewise.
* trans-expr.c (gfc_conv_power_op): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_index,
gfc_conv_intrinsic_scan, gfc_conv_intrinsic_verify,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat): Likewise.
* trans-stmt.c (gfc_trans_pause, gfc_trans_stop,
gfc_trans_character_select, gfc_trans_allocate): Likewise.
* trans-io.c (gfc_pint4_type_node): Move into ...
(gfc_build_io_library_fndecls): ... here. Cache local copies of
some kind type nodes.
* trans-types.c (gfc_type_nodes): Remove.
(gfc_character1_type_node, gfc_strlen_type_node): New.
(gfc_integer_types, gfc_logical_types): New.
(gfc_real_types, gfc_complex_types): New.
(gfc_init_kinds): Fill in real mode_precision.
(gfc_build_int_type, gfc_build_real_type): New.
(gfc_build_complex_type, gfc_build_logical_type): New.
(c_size_t_size): New.
(gfc_init_types): Loop over kinds.
(gfc_get_int_type, gfc_get_real_type): Use gfc_validate_kind.
(gfc_get_complex_type, gfc_get_logical_type): Likewise.
(gfc_get_character_type_len): Likewise.
(gfc_type_for_size): Loop over kinds; use a reduced set of
unsigned type nodes.
(gfc_type_for_mode): Loop over kinds.
(gfc_signed_or_unsigned_type): Use gfc_type_for_size.
(gfc_unsigned_type, gfc_signed_type): Use gfc_signed_or_unsigned_type.
* trans-types.h (F95_INT1_TYPE, F95_INT2_TYPE, F95_INT4_TYPE,
F95_INT8_TYPE, F95_INT16_TYPE, F95_REAL4_TYPE, F95_REAL8_TYPE,
F95_REAl16_TYPE, F95_COMPLEX4_TYPE, F95_COMPLEX8_TYPE,
F95_COMPLEX16_TYPE, F95_LOGICAL1_TYPE, F95_LOGICAL2_TYPE,
F95_LOGICAL4_TYPE, F95_LOGICAL8_TYPE, F95_LOGICAL16_TYPE,
F95_CHARACTER1_TYPE, NUM_F95_TYPES, gfc_type_nodes,
gfc_int1_type_node, gfc_int2_type_node, gfc_int4_type_node,
gfc_int8_type_node, gfc_int16_type_node, gfc_real4_type_node,
gfc_real8_type_node, gfc_real16_type_node, gfc_complex4_type_node,
gfc_complex8_type_node, gfc_complex16_type_node,
gfc_logical1_type_node, gfc_logical2_type_node,
gfc_logical4_type_node, gfc_logical8_type_node,
gfc_logical16_type_node, gfc_strlen_kind): Remove.
(gfc_character1_type_node): Turn in to a variable.
(gfc_strlen_type_node): Likewise.
From-SVN: r86806
2004-08-30 14:59:08 -07:00
|
|
|
gfc_int4_type_node = gfc_get_int_type (4);
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
|
2005-11-06 20:28:22 +02:00
|
|
|
gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
Make-lang.in (fortran/f95-lang.o): Update dependencies.
* Make-lang.in (fortran/f95-lang.o): Update dependencies.
(fortran/trans-decl.o, fortran/trans-types.o): Likewise.
* gfortran.h (gfc_integer_info): Add c_char, c_short, c_int,
c_long, c_long_long.
(gfc_logical_info): Add c_bool.
(gfc_real_info): Add mode_precision, c_float, c_double, c_long_double.
* trans-array.c (gfc_array_allocate): Use TYPE_PRECISION
rather than gfc_int[48]_type_node for allocate choice.
* trans-decl.c (gfc_build_intrinsic_function_decls): Cache
local copies of some kind type nodes.
(gfc_build_builtin_function_decls): Likewise.
* trans-expr.c (gfc_conv_power_op): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_index,
gfc_conv_intrinsic_scan, gfc_conv_intrinsic_verify,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat): Likewise.
* trans-stmt.c (gfc_trans_pause, gfc_trans_stop,
gfc_trans_character_select, gfc_trans_allocate): Likewise.
* trans-io.c (gfc_pint4_type_node): Move into ...
(gfc_build_io_library_fndecls): ... here. Cache local copies of
some kind type nodes.
* trans-types.c (gfc_type_nodes): Remove.
(gfc_character1_type_node, gfc_strlen_type_node): New.
(gfc_integer_types, gfc_logical_types): New.
(gfc_real_types, gfc_complex_types): New.
(gfc_init_kinds): Fill in real mode_precision.
(gfc_build_int_type, gfc_build_real_type): New.
(gfc_build_complex_type, gfc_build_logical_type): New.
(c_size_t_size): New.
(gfc_init_types): Loop over kinds.
(gfc_get_int_type, gfc_get_real_type): Use gfc_validate_kind.
(gfc_get_complex_type, gfc_get_logical_type): Likewise.
(gfc_get_character_type_len): Likewise.
(gfc_type_for_size): Loop over kinds; use a reduced set of
unsigned type nodes.
(gfc_type_for_mode): Loop over kinds.
(gfc_signed_or_unsigned_type): Use gfc_type_for_size.
(gfc_unsigned_type, gfc_signed_type): Use gfc_signed_or_unsigned_type.
* trans-types.h (F95_INT1_TYPE, F95_INT2_TYPE, F95_INT4_TYPE,
F95_INT8_TYPE, F95_INT16_TYPE, F95_REAL4_TYPE, F95_REAL8_TYPE,
F95_REAl16_TYPE, F95_COMPLEX4_TYPE, F95_COMPLEX8_TYPE,
F95_COMPLEX16_TYPE, F95_LOGICAL1_TYPE, F95_LOGICAL2_TYPE,
F95_LOGICAL4_TYPE, F95_LOGICAL8_TYPE, F95_LOGICAL16_TYPE,
F95_CHARACTER1_TYPE, NUM_F95_TYPES, gfc_type_nodes,
gfc_int1_type_node, gfc_int2_type_node, gfc_int4_type_node,
gfc_int8_type_node, gfc_int16_type_node, gfc_real4_type_node,
gfc_real8_type_node, gfc_real16_type_node, gfc_complex4_type_node,
gfc_complex8_type_node, gfc_complex16_type_node,
gfc_logical1_type_node, gfc_logical2_type_node,
gfc_logical4_type_node, gfc_logical8_type_node,
gfc_logical16_type_node, gfc_strlen_kind): Remove.
(gfc_character1_type_node): Turn in to a variable.
(gfc_strlen_type_node): Likewise.
From-SVN: r86806
2004-08-30 14:59:08 -07:00
|
|
|
/* Build the st_parameter structure. Information associated with I/O
|
|
|
|
calls are transferred here. This must match the one defined in the
|
arith.c, [...]: Fix comment formatting.
* arith.c, array.c, decl.c, expr.c, f95-lang.c, gfortran.h,
gfortranspec.c, interface.c, intrinsic.c, iresolve.c, match.c,
module.c, parse.c, parse.h, primary.c, resolve.c, scanner.c,
trans-array.c, trans-array.h, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans.h: Fix comment formatting.
From-SVN: r90266
2004-11-08 14:56:41 +00:00
|
|
|
library exactly. */
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
ioparm_type = make_node (RECORD_TYPE);
|
|
|
|
TYPE_NAME (ioparm_type) = get_identifier ("_gfc_ioparm");
|
|
|
|
|
|
|
|
ADD_FIELD (unit, gfc_int4_type_node);
|
|
|
|
ADD_FIELD (err, gfc_int4_type_node);
|
|
|
|
ADD_FIELD (end, gfc_int4_type_node);
|
|
|
|
ADD_FIELD (eor, gfc_int4_type_node);
|
|
|
|
ADD_FIELD (list_format, gfc_int4_type_node);
|
|
|
|
ADD_FIELD (library_return, gfc_int4_type_node);
|
|
|
|
|
|
|
|
ADD_FIELD (iostat, gfc_pint4_type_node);
|
|
|
|
ADD_FIELD (exist, gfc_pint4_type_node);
|
|
|
|
ADD_FIELD (opened, gfc_pint4_type_node);
|
|
|
|
ADD_FIELD (number, gfc_pint4_type_node);
|
|
|
|
ADD_FIELD (named, gfc_pint4_type_node);
|
2005-01-22 15:37:39 +01:00
|
|
|
ADD_FIELD (rec, gfc_int4_type_node);
|
2004-05-13 02:41:07 -04:00
|
|
|
ADD_FIELD (nextrec, gfc_pint4_type_node);
|
|
|
|
ADD_FIELD (size, gfc_pint4_type_node);
|
|
|
|
|
2005-01-22 15:37:39 +01:00
|
|
|
ADD_FIELD (recl_in, gfc_int4_type_node);
|
2004-05-13 02:41:07 -04:00
|
|
|
ADD_FIELD (recl_out, gfc_pint4_type_node);
|
|
|
|
|
2004-06-22 03:43:55 +03:00
|
|
|
ADD_FIELD (iolength, gfc_pint4_type_node);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
ADD_STRING (file);
|
|
|
|
ADD_STRING (status);
|
|
|
|
|
|
|
|
ADD_STRING (access);
|
|
|
|
ADD_STRING (form);
|
|
|
|
ADD_STRING (blank);
|
|
|
|
ADD_STRING (position);
|
|
|
|
ADD_STRING (action);
|
|
|
|
ADD_STRING (delim);
|
|
|
|
ADD_STRING (pad);
|
|
|
|
ADD_STRING (format);
|
|
|
|
ADD_STRING (advance);
|
|
|
|
ADD_STRING (name);
|
|
|
|
ADD_STRING (internal_unit);
|
2005-09-14 20:19:37 +00:00
|
|
|
ADD_FIELD (internal_unit_desc, pchar_type_node);
|
2004-05-13 02:41:07 -04:00
|
|
|
ADD_STRING (sequential);
|
|
|
|
|
|
|
|
ADD_STRING (direct);
|
|
|
|
ADD_STRING (formatted);
|
|
|
|
ADD_STRING (unformatted);
|
|
|
|
ADD_STRING (read);
|
|
|
|
ADD_STRING (write);
|
|
|
|
ADD_STRING (readwrite);
|
|
|
|
|
|
|
|
ADD_STRING (namelist_name);
|
|
|
|
ADD_FIELD (namelist_read_mode, gfc_int4_type_node);
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
ADD_STRING (iomsg);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
gfc_finish_type (ioparm_type);
|
|
|
|
|
|
|
|
ioparm_var = build_decl (VAR_DECL, get_identifier (PREFIX("ioparm")),
|
|
|
|
ioparm_type);
|
|
|
|
DECL_EXTERNAL (ioparm_var) = 1;
|
|
|
|
TREE_PUBLIC (ioparm_var) = 1;
|
|
|
|
|
|
|
|
locus_line = build_decl (VAR_DECL, get_identifier (PREFIX("line")),
|
|
|
|
gfc_int4_type_node);
|
|
|
|
DECL_EXTERNAL (locus_line) = 1;
|
|
|
|
TREE_PUBLIC (locus_line) = 1;
|
|
|
|
|
|
|
|
locus_file = build_decl (VAR_DECL, get_identifier (PREFIX("filename")),
|
|
|
|
pchar_type_node);
|
|
|
|
DECL_EXTERNAL (locus_file) = 1;
|
|
|
|
TREE_PUBLIC (locus_file) = 1;
|
|
|
|
|
|
|
|
/* Define the transfer functions. */
|
|
|
|
|
|
|
|
iocall_x_integer =
|
|
|
|
gfc_build_library_function_decl (get_identifier
|
|
|
|
(PREFIX("transfer_integer")),
|
|
|
|
void_type_node, 2, pvoid_type_node,
|
|
|
|
gfc_int4_type_node);
|
|
|
|
|
|
|
|
iocall_x_logical =
|
|
|
|
gfc_build_library_function_decl (get_identifier
|
|
|
|
(PREFIX("transfer_logical")),
|
|
|
|
void_type_node, 2, pvoid_type_node,
|
|
|
|
gfc_int4_type_node);
|
|
|
|
|
|
|
|
iocall_x_character =
|
|
|
|
gfc_build_library_function_decl (get_identifier
|
|
|
|
(PREFIX("transfer_character")),
|
|
|
|
void_type_node, 2, pvoid_type_node,
|
|
|
|
gfc_int4_type_node);
|
|
|
|
|
|
|
|
iocall_x_real =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("transfer_real")),
|
|
|
|
void_type_node, 2,
|
|
|
|
pvoid_type_node, gfc_int4_type_node);
|
|
|
|
|
|
|
|
iocall_x_complex =
|
|
|
|
gfc_build_library_function_decl (get_identifier
|
|
|
|
(PREFIX("transfer_complex")),
|
|
|
|
void_type_node, 2, pvoid_type_node,
|
|
|
|
gfc_int4_type_node);
|
|
|
|
|
2005-09-26 23:24:45 +03:00
|
|
|
iocall_x_array =
|
|
|
|
gfc_build_library_function_decl (get_identifier
|
|
|
|
(PREFIX("transfer_array")),
|
2005-11-06 20:28:22 +02:00
|
|
|
void_type_node, 3, pvoid_type_node,
|
|
|
|
gfc_c_int_type_node,
|
2005-09-26 23:24:45 +03:00
|
|
|
gfc_charlen_type_node);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Library entry points */
|
|
|
|
|
|
|
|
iocall_read =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_read")),
|
|
|
|
void_type_node, 0);
|
|
|
|
|
|
|
|
iocall_write =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_write")),
|
|
|
|
void_type_node, 0);
|
|
|
|
iocall_open =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_open")),
|
|
|
|
void_type_node, 0);
|
|
|
|
|
|
|
|
iocall_close =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_close")),
|
|
|
|
void_type_node, 0);
|
|
|
|
|
|
|
|
iocall_inquire =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_inquire")),
|
|
|
|
gfc_int4_type_node, 0);
|
|
|
|
|
2004-06-22 03:43:55 +03:00
|
|
|
iocall_iolength =
|
|
|
|
gfc_build_library_function_decl(get_identifier (PREFIX("st_iolength")),
|
|
|
|
void_type_node, 0);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
iocall_rewind =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_rewind")),
|
|
|
|
gfc_int4_type_node, 0);
|
|
|
|
|
|
|
|
iocall_backspace =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_backspace")),
|
|
|
|
gfc_int4_type_node, 0);
|
|
|
|
|
|
|
|
iocall_endfile =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_endfile")),
|
|
|
|
gfc_int4_type_node, 0);
|
2005-08-08 01:56:19 +03:00
|
|
|
|
|
|
|
iocall_flush =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_flush")),
|
|
|
|
gfc_int4_type_node, 0);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Library helpers */
|
|
|
|
|
|
|
|
iocall_read_done =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_read_done")),
|
|
|
|
gfc_int4_type_node, 0);
|
|
|
|
|
|
|
|
iocall_write_done =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_write_done")),
|
|
|
|
gfc_int4_type_node, 0);
|
2004-06-22 03:43:55 +03:00
|
|
|
|
|
|
|
iocall_iolength_done =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_iolength_done")),
|
|
|
|
gfc_int4_type_node, 0);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
iocall_set_nml_val =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_set_nml_var")),
|
2004-08-18 01:20:06 +00:00
|
|
|
void_type_node, 5,
|
2004-05-13 02:41:07 -04:00
|
|
|
pvoid_type_node, pvoid_type_node,
|
2005-04-17 20:09:37 +00:00
|
|
|
gfc_int4_type_node, gfc_charlen_type_node,
|
|
|
|
gfc_int4_type_node);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
iocall_set_nml_val_dim =
|
|
|
|
gfc_build_library_function_decl (get_identifier (PREFIX("st_set_nml_var_dim")),
|
|
|
|
void_type_node, 4,
|
|
|
|
gfc_int4_type_node, gfc_int4_type_node,
|
|
|
|
gfc_int4_type_node, gfc_int4_type_node);
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
decl.c, [...]: Fix comment/doc typos.
* decl.c, dump-parse-tree.c, gfortran.texi, intrinsic.texi,
invoke.texi, resolve.c, trans-array.c, trans-array.h,
trans-common.c, trans-expr.c, trans-io.c, trans.h: Fix
comment/doc typos. Follow spelling conventions.
From-SVN: r102806
2005-08-06 12:56:19 +00:00
|
|
|
/* Generate code to store a non-string I/O parameter into the
|
2004-05-13 02:41:07 -04:00
|
|
|
ioparm structure. This is a pass by value. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_parameter_value (stmtblock_t * block, tree var, gfc_expr * e)
|
|
|
|
{
|
|
|
|
gfc_se se;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_init_se (&se, NULL);
|
|
|
|
gfc_conv_expr_type (&se, e, TREE_TYPE (var));
|
|
|
|
gfc_add_block_to_block (block, &se.pre);
|
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_add_modify_expr (block, tmp, se.expr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
decl.c, [...]: Fix comment/doc typos.
* decl.c, dump-parse-tree.c, gfortran.texi, intrinsic.texi,
invoke.texi, resolve.c, trans-array.c, trans-array.h,
trans-common.c, trans-expr.c, trans-io.c, trans.h: Fix
comment/doc typos. Follow spelling conventions.
From-SVN: r102806
2005-08-06 12:56:19 +00:00
|
|
|
/* Generate code to store a non-string I/O parameter into the
|
2004-05-13 02:41:07 -04:00
|
|
|
ioparm structure. This is pass by reference. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_parameter_ref (stmtblock_t * block, tree var, gfc_expr * e)
|
|
|
|
{
|
|
|
|
gfc_se se;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_init_se (&se, NULL);
|
|
|
|
se.want_pointer = 1;
|
|
|
|
|
|
|
|
gfc_conv_expr_type (&se, e, TREE_TYPE (var));
|
|
|
|
gfc_add_block_to_block (block, &se.pre);
|
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_add_modify_expr (block, tmp, se.expr);
|
|
|
|
}
|
|
|
|
|
2005-07-07 07:54:58 +00:00
|
|
|
/* Given an array expr, find its address and length to get a string. If the
|
|
|
|
array is full, the string's address is the address of array's first element
|
|
|
|
and the length is the size of the whole array. If it is an element, the
|
|
|
|
string's address is the element's address and the length is the rest size of
|
|
|
|
the array.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
gfc_convert_array_to_string (gfc_se * se, gfc_expr * e)
|
|
|
|
{
|
|
|
|
tree tmp;
|
|
|
|
tree array;
|
|
|
|
tree type;
|
|
|
|
tree size;
|
|
|
|
int rank;
|
|
|
|
gfc_symbol *sym;
|
|
|
|
|
|
|
|
sym = e->symtree->n.sym;
|
|
|
|
rank = sym->as->rank - 1;
|
|
|
|
|
|
|
|
if (e->ref->u.ar.type == AR_FULL)
|
|
|
|
{
|
|
|
|
se->expr = gfc_get_symbol_decl (sym);
|
|
|
|
se->expr = gfc_conv_array_data (se->expr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gfc_conv_expr (se, e);
|
|
|
|
}
|
|
|
|
|
|
|
|
array = sym->backend_decl;
|
|
|
|
type = TREE_TYPE (array);
|
|
|
|
|
|
|
|
if (GFC_ARRAY_TYPE_P (type))
|
|
|
|
size = GFC_TYPE_ARRAY_SIZE (type);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
|
|
|
|
size = gfc_conv_array_stride (array, rank);
|
|
|
|
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
|
|
|
|
gfc_conv_array_ubound (array, rank),
|
|
|
|
gfc_conv_array_lbound (array, rank));
|
|
|
|
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp,
|
|
|
|
gfc_index_one_node);
|
|
|
|
size = fold_build2 (MULT_EXPR, gfc_array_index_type, tmp, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
gcc_assert (size);
|
|
|
|
|
|
|
|
/* If it is an element, we need the its address and size of the rest. */
|
|
|
|
if (e->ref->u.ar.type == AR_ELEMENT)
|
|
|
|
{
|
|
|
|
size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size,
|
|
|
|
TREE_OPERAND (se->expr, 1));
|
|
|
|
se->expr = gfc_build_addr_expr (NULL, se->expr);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type));
|
|
|
|
size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp);
|
|
|
|
|
|
|
|
se->string_length = fold_convert (gfc_charlen_type_node, size);
|
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
|
2005-09-14 20:19:37 +00:00
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Generate code to store a string and its length into the
|
|
|
|
ioparm structure. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
|
|
|
|
tree var_len, gfc_expr * e)
|
|
|
|
{
|
|
|
|
gfc_se se;
|
|
|
|
tree tmp;
|
|
|
|
tree msg;
|
|
|
|
tree io;
|
|
|
|
tree len;
|
|
|
|
|
|
|
|
gfc_init_se (&se, NULL);
|
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
io = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
|
|
|
|
len = build3 (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len,
|
|
|
|
NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
Make sure types in assignments are compatible.
2004-06-29 Steven Bosscher <stevenb@suse.de>
Make sure types in assignments are compatible. Mostly mechanical.
* trans-const.h (gfc_index_one_node): New define.
* trans-array.c (gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array, gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_trans_array_constructor,
gfc_conv_array_ubound, gfc_conv_array_ref,
gfc_trans_scalarized_loop_end, gfc_conv_section_startstride,
gfc_conv_ss_startstride, gfc_conv_loop_setup, gfc_array_init_size,
gfc_trans_array_bounds, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_trans_deferred_array): Use the correct
types in assignments, conversions and conditionals for expressions.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_unary_op, gfc_conv_cst_int_power, gfc_conv_string_tmp,
gfc_conv_function_call, gfc_trans_pointer_assignment,
gfc_trans_scalar_assign): Likewise.
* trans-intrinsic.c (build_fixbound_expr, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_singlebitop, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated,
gfc_conv_intrinsic_rrspacing, gfc_conv_intrinsic_trim): Likewise.
* trans-io.c (set_string): Likewise.
* trans-stmt.c (gfc_trans_do, gfc_trans_forall_loop,
gfc_do_allocate, generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp, compute_inner_temp_size,
compute_overall_iter_number, gfc_trans_assign_need_temp,
gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1,
gfc_evaluate_where_mask, gfc_trans_where_assign,
gfc_trans_where_2): Likewise.
* trans-types.c (gfc_get_character_type, gfc_build_array_type,
gfc_get_nodesc_array_type, gfc_get_array_type_bounds): Likewise.
* trans.c (gfc_add_modify_expr): Add sanity check that types
for the lhs and rhs are the same for scalar assignments.
From-SVN: r83877
2004-06-29 22:01:35 +00:00
|
|
|
/* Integer variable assigned a format label. */
|
2004-05-13 02:41:07 -04:00
|
|
|
if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
|
|
|
|
{
|
2005-03-15 02:52:38 +00:00
|
|
|
gfc_conv_label_variable (&se, e);
|
2004-05-13 02:41:07 -04:00
|
|
|
msg =
|
2004-10-04 22:55:49 +02:00
|
|
|
gfc_build_cstring_const ("Assigned label is not a format label");
|
2004-05-13 02:41:07 -04:00
|
|
|
tmp = GFC_DECL_STRING_LEN (se.expr);
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build2 (LE_EXPR, boolean_type_node,
|
|
|
|
tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_trans_runtime_check (tmp, msg, &se.pre);
|
2005-05-15 02:45:29 +00:00
|
|
|
gfc_add_modify_expr (&se.pre, io,
|
|
|
|
fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr)));
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-07 07:54:58 +00:00
|
|
|
/* General character. */
|
|
|
|
if (e->ts.type == BT_CHARACTER && e->rank == 0)
|
|
|
|
gfc_conv_expr (&se, e);
|
|
|
|
/* Array assigned Hollerith constant or character array. */
|
|
|
|
else if (e->symtree && (e->symtree->n.sym->as->rank > 0))
|
|
|
|
gfc_convert_array_to_string (&se, e);
|
|
|
|
else
|
|
|
|
gcc_unreachable ();
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_conv_string_parameter (&se);
|
Make sure types in assignments are compatible.
2004-06-29 Steven Bosscher <stevenb@suse.de>
Make sure types in assignments are compatible. Mostly mechanical.
* trans-const.h (gfc_index_one_node): New define.
* trans-array.c (gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array, gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_trans_array_constructor,
gfc_conv_array_ubound, gfc_conv_array_ref,
gfc_trans_scalarized_loop_end, gfc_conv_section_startstride,
gfc_conv_ss_startstride, gfc_conv_loop_setup, gfc_array_init_size,
gfc_trans_array_bounds, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_trans_deferred_array): Use the correct
types in assignments, conversions and conditionals for expressions.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_unary_op, gfc_conv_cst_int_power, gfc_conv_string_tmp,
gfc_conv_function_call, gfc_trans_pointer_assignment,
gfc_trans_scalar_assign): Likewise.
* trans-intrinsic.c (build_fixbound_expr, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_singlebitop, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated,
gfc_conv_intrinsic_rrspacing, gfc_conv_intrinsic_trim): Likewise.
* trans-io.c (set_string): Likewise.
* trans-stmt.c (gfc_trans_do, gfc_trans_forall_loop,
gfc_do_allocate, generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp, compute_inner_temp_size,
compute_overall_iter_number, gfc_trans_assign_need_temp,
gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1,
gfc_evaluate_where_mask, gfc_trans_where_assign,
gfc_trans_where_2): Likewise.
* trans-types.c (gfc_get_character_type, gfc_build_array_type,
gfc_get_nodesc_array_type, gfc_get_array_type_bounds): Likewise.
* trans.c (gfc_add_modify_expr): Add sanity check that types
for the lhs and rhs are the same for scalar assignments.
From-SVN: r83877
2004-06-29 22:01:35 +00:00
|
|
|
gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_add_modify_expr (&se.pre, len, se.string_length);
|
|
|
|
}
|
|
|
|
|
|
|
|
gfc_add_block_to_block (block, &se.pre);
|
|
|
|
gfc_add_block_to_block (postblock, &se.post);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-14 20:19:37 +00:00
|
|
|
/* Generate code to store the character (array) and the character length
|
|
|
|
for an internal unit. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_internal_unit (stmtblock_t * block, tree iunit, tree iunit_len,
|
|
|
|
tree iunit_desc, gfc_expr * e)
|
|
|
|
{
|
|
|
|
gfc_se se;
|
|
|
|
tree io;
|
|
|
|
tree len;
|
|
|
|
tree desc;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_init_se (&se, NULL);
|
|
|
|
|
|
|
|
io = build3 (COMPONENT_REF, TREE_TYPE (iunit), ioparm_var, iunit, NULL_TREE);
|
|
|
|
len = build3 (COMPONENT_REF, TREE_TYPE (iunit_len), ioparm_var, iunit_len,
|
|
|
|
NULL_TREE);
|
|
|
|
desc = build3 (COMPONENT_REF, TREE_TYPE (iunit_desc), ioparm_var, iunit_desc,
|
|
|
|
NULL_TREE);
|
|
|
|
|
|
|
|
gcc_assert (e->ts.type == BT_CHARACTER);
|
|
|
|
|
|
|
|
/* Character scalars. */
|
|
|
|
if (e->rank == 0)
|
|
|
|
{
|
|
|
|
gfc_conv_expr (&se, e);
|
|
|
|
gfc_conv_string_parameter (&se);
|
|
|
|
tmp = se.expr;
|
|
|
|
se.expr = fold_convert (pchar_type_node, integer_zero_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Character array. */
|
|
|
|
else if (e->symtree && (e->symtree->n.sym->as->rank > 0))
|
|
|
|
{
|
|
|
|
se.ss = gfc_walk_expr (e);
|
|
|
|
|
|
|
|
/* Return the data pointer and rank from the descriptor. */
|
|
|
|
gfc_conv_expr_descriptor (&se, e, se.ss);
|
|
|
|
tmp = gfc_conv_descriptor_data_get (se.expr);
|
|
|
|
se.expr = gfc_build_addr_expr (pchar_type_node, se.expr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gcc_unreachable ();
|
|
|
|
|
|
|
|
/* The cast is needed for character substrings and the descriptor
|
|
|
|
data. */
|
|
|
|
gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), tmp));
|
|
|
|
gfc_add_modify_expr (&se.pre, len, se.string_length);
|
|
|
|
gfc_add_modify_expr (&se.pre, desc, se.expr);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (block, &se.pre);
|
|
|
|
}
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Set a member of the ioparm structure to one. */
|
|
|
|
static void
|
|
|
|
set_flag (stmtblock_t *block, tree var)
|
|
|
|
{
|
Make sure types in assignments are compatible.
2004-06-29 Steven Bosscher <stevenb@suse.de>
Make sure types in assignments are compatible. Mostly mechanical.
* trans-const.h (gfc_index_one_node): New define.
* trans-array.c (gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array, gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_trans_array_constructor,
gfc_conv_array_ubound, gfc_conv_array_ref,
gfc_trans_scalarized_loop_end, gfc_conv_section_startstride,
gfc_conv_ss_startstride, gfc_conv_loop_setup, gfc_array_init_size,
gfc_trans_array_bounds, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_trans_deferred_array): Use the correct
types in assignments, conversions and conditionals for expressions.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_unary_op, gfc_conv_cst_int_power, gfc_conv_string_tmp,
gfc_conv_function_call, gfc_trans_pointer_assignment,
gfc_trans_scalar_assign): Likewise.
* trans-intrinsic.c (build_fixbound_expr, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_singlebitop, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated,
gfc_conv_intrinsic_rrspacing, gfc_conv_intrinsic_trim): Likewise.
* trans-io.c (set_string): Likewise.
* trans-stmt.c (gfc_trans_do, gfc_trans_forall_loop,
gfc_do_allocate, generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp, compute_inner_temp_size,
compute_overall_iter_number, gfc_trans_assign_need_temp,
gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1,
gfc_evaluate_where_mask, gfc_trans_where_assign,
gfc_trans_where_2): Likewise.
* trans-types.c (gfc_get_character_type, gfc_build_array_type,
gfc_get_nodesc_array_type, gfc_get_array_type_bounds): Likewise.
* trans.c (gfc_add_modify_expr): Add sanity check that types
for the lhs and rhs are the same for scalar assignments.
From-SVN: r83877
2004-06-29 22:01:35 +00:00
|
|
|
tree tmp, type = TREE_TYPE (var);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build3 (COMPONENT_REF, type, ioparm_var, var, NULL_TREE);
|
Make sure types in assignments are compatible.
2004-06-29 Steven Bosscher <stevenb@suse.de>
Make sure types in assignments are compatible. Mostly mechanical.
* trans-const.h (gfc_index_one_node): New define.
* trans-array.c (gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array, gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_trans_array_constructor,
gfc_conv_array_ubound, gfc_conv_array_ref,
gfc_trans_scalarized_loop_end, gfc_conv_section_startstride,
gfc_conv_ss_startstride, gfc_conv_loop_setup, gfc_array_init_size,
gfc_trans_array_bounds, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_trans_deferred_array): Use the correct
types in assignments, conversions and conditionals for expressions.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_unary_op, gfc_conv_cst_int_power, gfc_conv_string_tmp,
gfc_conv_function_call, gfc_trans_pointer_assignment,
gfc_trans_scalar_assign): Likewise.
* trans-intrinsic.c (build_fixbound_expr, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_singlebitop, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated,
gfc_conv_intrinsic_rrspacing, gfc_conv_intrinsic_trim): Likewise.
* trans-io.c (set_string): Likewise.
* trans-stmt.c (gfc_trans_do, gfc_trans_forall_loop,
gfc_do_allocate, generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp, compute_inner_temp_size,
compute_overall_iter_number, gfc_trans_assign_need_temp,
gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1,
gfc_evaluate_where_mask, gfc_trans_where_assign,
gfc_trans_where_2): Likewise.
* trans-types.c (gfc_get_character_type, gfc_build_array_type,
gfc_get_nodesc_array_type, gfc_get_array_type_bounds): Likewise.
* trans.c (gfc_add_modify_expr): Add sanity check that types
for the lhs and rhs are the same for scalar assignments.
From-SVN: r83877
2004-06-29 22:01:35 +00:00
|
|
|
gfc_add_modify_expr (block, tmp, convert (type, integer_one_node));
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a case to a IO-result switch. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_case (int label_value, gfc_st_label * label, stmtblock_t * body)
|
|
|
|
{
|
|
|
|
tree tmp, value;
|
|
|
|
|
|
|
|
if (label == NULL)
|
|
|
|
return; /* No label, no case */
|
|
|
|
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 09:52:54 +00:00
|
|
|
value = build_int_cst (NULL_TREE, label_value);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
/* Make a backend label for this case. */
|
2005-01-27 00:58:11 +00:00
|
|
|
tmp = gfc_build_label_decl (NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
/* And the case itself. */
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build3_v (CASE_LABEL_EXPR, value, NULL_TREE, tmp);
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_add_expr_to_block (body, tmp);
|
|
|
|
|
|
|
|
/* Jump to the label. */
|
|
|
|
tmp = build1_v (GOTO_EXPR, gfc_get_label_decl (label));
|
|
|
|
gfc_add_expr_to_block (body, tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Generate a switch statement that branches to the correct I/O
|
|
|
|
result label. The last statement of an I/O call stores the
|
|
|
|
result into a variable because there is often cleanup that
|
|
|
|
must be done before the switch, so a temporary would have to
|
|
|
|
be created anyway. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
io_result (stmtblock_t * block, gfc_st_label * err_label,
|
|
|
|
gfc_st_label * end_label, gfc_st_label * eor_label)
|
|
|
|
{
|
|
|
|
stmtblock_t body;
|
|
|
|
tree tmp, rc;
|
|
|
|
|
|
|
|
/* If no labels are specified, ignore the result instead
|
|
|
|
of building an empty switch. */
|
|
|
|
if (err_label == NULL
|
|
|
|
&& end_label == NULL
|
|
|
|
&& eor_label == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Build a switch statement. */
|
|
|
|
gfc_start_block (&body);
|
|
|
|
|
|
|
|
/* The label values here must be the same as the values
|
|
|
|
in the library_return enum in the runtime library */
|
|
|
|
add_case (1, err_label, &body);
|
|
|
|
add_case (2, end_label, &body);
|
|
|
|
add_case (3, eor_label, &body);
|
|
|
|
|
|
|
|
tmp = gfc_finish_block (&body);
|
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
rc = build3 (COMPONENT_REF, TREE_TYPE (ioparm_library_return), ioparm_var,
|
|
|
|
ioparm_library_return, NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build3_v (SWITCH_EXPR, rc, tmp, NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
gfc_add_expr_to_block (block, tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Store the current file and line number to variables so that if a
|
|
|
|
library call goes awry, we can tell the user where the problem is. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_error_locus (stmtblock_t * block, locus * where)
|
|
|
|
{
|
|
|
|
gfc_file *f;
|
|
|
|
tree tmp;
|
|
|
|
int line;
|
|
|
|
|
re PR fortran/13702 (When preprocessing Fortran files (.F, .F90 and .F95) cpp should emit line numbers.)
PR fortran/13702
(Port from g95)
* gfortran.h (gfc_linebuf): New typedef.
(linebuf): Remove.
(gfc_file): Revamped, use new gfc_linebuf.
(locus): Revamped, use new types.
(gfc_current_file): Remove.
(gfc_current_form, gfc_source_file): New global variables.
* match.c (gfc_match_space, gfc_match_strings): Use
gfc_current_form to find source form.
* module.c (gfc_dump_module): Use gfc_source_file when printing
module header.
* error.c (show_locus, show_loci) Use new data structures to print
locus.
* scanner.c (first_file, first_duplicated_file, gfc_current_file):
Remove.
(file_head, current_file, gfc_current_form, line_head, line_tail,
gfc_current_locus1, gfc_source_file): New global variables.
(gfc_scanner_init1): Set new global variables.
(gfc_scanner_done1): Free new data structures.
(gfc_current_locus): Return pointer to gfc_current_locus1.
(gfc_set_locus): Set gfc_current_locus1.
(gfc_at_eof): Set new variables.
(gfc_at_bol, gfc_at_eol, gfc_advance_line, gfc_next_char): Adapt
to new locus structure.
(gfc_check_include): Remove.
(skip_free_comments, skip_fixed_comments): Use gfc_current_locus1.
(gfc_skip_comments): Use gfc_current_form, find locus with
gfc_current_locus1.
(gfc_next_char): Use gfc_current_form.
(gfc_peek_char, gfc_gobble_whitespace): Use gfc_current_locus1.
(load_line): Use gfc_current_form. Recognize ^Z as EOF. Fix
comment formatting.
(get_file): New function.
(preprocessor_line, include_line): New functions.
(load_file): Move down, rewrite to match new data structures.
(gfc_new_file): Rewrite to match new data structures.
* parse.c (next_statement): Remove code which is now useless. Use
gfc_source_form and gfc_source_file where appropriate.
* trans-decl.c (gfc_get_label_decl): adapt to new data structures
when determining locus of frontend code.
* trans-io.c (set_error_locus): Same.
* trans.c (gfc_get_backend_locus, gfc_set_backend_locus): Likewise.
* lang-specs.h (@f77-cpp-input, @f95-cpp-input): Remove '-P' from
preprocessor flags.
(all): Add missing initializers.
From-SVN: r81888
2004-05-15 19:31:32 +02:00
|
|
|
f = where->lb->file;
|
2004-10-04 22:55:49 +02:00
|
|
|
tmp = gfc_build_cstring_const (f->filename);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
tmp = gfc_build_addr_expr (pchar_type_node, tmp);
|
|
|
|
gfc_add_modify_expr (block, locus_file, tmp);
|
|
|
|
|
2004-09-07 07:43:37 -07:00
|
|
|
#ifdef USE_MAPPED_LOCATION
|
|
|
|
line = LOCATION_LINE (where->lb->location);
|
|
|
|
#else
|
re PR fortran/13702 (When preprocessing Fortran files (.F, .F90 and .F95) cpp should emit line numbers.)
PR fortran/13702
(Port from g95)
* gfortran.h (gfc_linebuf): New typedef.
(linebuf): Remove.
(gfc_file): Revamped, use new gfc_linebuf.
(locus): Revamped, use new types.
(gfc_current_file): Remove.
(gfc_current_form, gfc_source_file): New global variables.
* match.c (gfc_match_space, gfc_match_strings): Use
gfc_current_form to find source form.
* module.c (gfc_dump_module): Use gfc_source_file when printing
module header.
* error.c (show_locus, show_loci) Use new data structures to print
locus.
* scanner.c (first_file, first_duplicated_file, gfc_current_file):
Remove.
(file_head, current_file, gfc_current_form, line_head, line_tail,
gfc_current_locus1, gfc_source_file): New global variables.
(gfc_scanner_init1): Set new global variables.
(gfc_scanner_done1): Free new data structures.
(gfc_current_locus): Return pointer to gfc_current_locus1.
(gfc_set_locus): Set gfc_current_locus1.
(gfc_at_eof): Set new variables.
(gfc_at_bol, gfc_at_eol, gfc_advance_line, gfc_next_char): Adapt
to new locus structure.
(gfc_check_include): Remove.
(skip_free_comments, skip_fixed_comments): Use gfc_current_locus1.
(gfc_skip_comments): Use gfc_current_form, find locus with
gfc_current_locus1.
(gfc_next_char): Use gfc_current_form.
(gfc_peek_char, gfc_gobble_whitespace): Use gfc_current_locus1.
(load_line): Use gfc_current_form. Recognize ^Z as EOF. Fix
comment formatting.
(get_file): New function.
(preprocessor_line, include_line): New functions.
(load_file): Move down, rewrite to match new data structures.
(gfc_new_file): Rewrite to match new data structures.
* parse.c (next_statement): Remove code which is now useless. Use
gfc_source_form and gfc_source_file where appropriate.
* trans-decl.c (gfc_get_label_decl): adapt to new data structures
when determining locus of frontend code.
* trans-io.c (set_error_locus): Same.
* trans.c (gfc_get_backend_locus, gfc_set_backend_locus): Likewise.
* lang-specs.h (@f77-cpp-input, @f95-cpp-input): Remove '-P' from
preprocessor flags.
(all): Add missing initializers.
From-SVN: r81888
2004-05-15 19:31:32 +02:00
|
|
|
line = where->lb->linenum;
|
2004-09-07 07:43:37 -07:00
|
|
|
#endif
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 09:52:54 +00:00
|
|
|
gfc_add_modify_expr (block, locus_line, build_int_cst (NULL_TREE, line));
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate an OPEN statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_open (gfc_code * code)
|
|
|
|
{
|
|
|
|
stmtblock_t block, post_block;
|
|
|
|
gfc_open *p;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_init_block (&block);
|
|
|
|
gfc_init_block (&post_block);
|
|
|
|
|
|
|
|
set_error_locus (&block, &code->loc);
|
|
|
|
p = code->ext.open;
|
|
|
|
|
|
|
|
if (p->unit)
|
|
|
|
set_parameter_value (&block, ioparm_unit, p->unit);
|
|
|
|
|
|
|
|
if (p->file)
|
|
|
|
set_string (&block, &post_block, ioparm_file, ioparm_file_len, p->file);
|
|
|
|
|
|
|
|
if (p->status)
|
|
|
|
set_string (&block, &post_block, ioparm_status,
|
|
|
|
ioparm_status_len, p->status);
|
|
|
|
|
|
|
|
if (p->access)
|
|
|
|
set_string (&block, &post_block, ioparm_access,
|
|
|
|
ioparm_access_len, p->access);
|
|
|
|
|
|
|
|
if (p->form)
|
|
|
|
set_string (&block, &post_block, ioparm_form, ioparm_form_len, p->form);
|
|
|
|
|
|
|
|
if (p->recl)
|
|
|
|
set_parameter_value (&block, ioparm_recl_in, p->recl);
|
|
|
|
|
|
|
|
if (p->blank)
|
|
|
|
set_string (&block, &post_block, ioparm_blank, ioparm_blank_len,
|
|
|
|
p->blank);
|
|
|
|
|
|
|
|
if (p->position)
|
|
|
|
set_string (&block, &post_block, ioparm_position,
|
|
|
|
ioparm_position_len, p->position);
|
|
|
|
|
|
|
|
if (p->action)
|
|
|
|
set_string (&block, &post_block, ioparm_action,
|
|
|
|
ioparm_action_len, p->action);
|
|
|
|
|
|
|
|
if (p->delim)
|
|
|
|
set_string (&block, &post_block, ioparm_delim, ioparm_delim_len,
|
|
|
|
p->delim);
|
|
|
|
|
|
|
|
if (p->pad)
|
|
|
|
set_string (&block, &post_block, ioparm_pad, ioparm_pad_len, p->pad);
|
|
|
|
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
if (p->iomsg)
|
|
|
|
set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
|
|
|
|
p->iomsg);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (p->iostat)
|
|
|
|
set_parameter_ref (&block, ioparm_iostat, p->iostat);
|
|
|
|
|
|
|
|
if (p->err)
|
|
|
|
set_flag (&block, ioparm_err);
|
|
|
|
|
|
|
|
tmp = gfc_build_function_call (iocall_open, NULL_TREE);
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (&block, &post_block);
|
|
|
|
|
|
|
|
io_result (&block, p->err, NULL, NULL);
|
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate a CLOSE statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_close (gfc_code * code)
|
|
|
|
{
|
|
|
|
stmtblock_t block, post_block;
|
|
|
|
gfc_close *p;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_init_block (&block);
|
|
|
|
gfc_init_block (&post_block);
|
|
|
|
|
|
|
|
set_error_locus (&block, &code->loc);
|
|
|
|
p = code->ext.close;
|
|
|
|
|
|
|
|
if (p->unit)
|
|
|
|
set_parameter_value (&block, ioparm_unit, p->unit);
|
|
|
|
|
|
|
|
if (p->status)
|
|
|
|
set_string (&block, &post_block, ioparm_status,
|
|
|
|
ioparm_status_len, p->status);
|
|
|
|
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
if (p->iomsg)
|
|
|
|
set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
|
|
|
|
p->iomsg);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (p->iostat)
|
|
|
|
set_parameter_ref (&block, ioparm_iostat, p->iostat);
|
|
|
|
|
|
|
|
if (p->err)
|
|
|
|
set_flag (&block, ioparm_err);
|
|
|
|
|
|
|
|
tmp = gfc_build_function_call (iocall_close, NULL_TREE);
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (&block, &post_block);
|
|
|
|
|
|
|
|
io_result (&block, p->err, NULL, NULL);
|
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Common subroutine for building a file positioning statement. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
build_filepos (tree function, gfc_code * code)
|
|
|
|
{
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
stmtblock_t block, post_block;
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_filepos *p;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
p = code->ext.filepos;
|
|
|
|
|
|
|
|
gfc_init_block (&block);
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
gfc_init_block (&post_block);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
set_error_locus (&block, &code->loc);
|
|
|
|
|
|
|
|
if (p->unit)
|
|
|
|
set_parameter_value (&block, ioparm_unit, p->unit);
|
|
|
|
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
if (p->iomsg)
|
|
|
|
set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
|
|
|
|
p->iomsg);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (p->iostat)
|
|
|
|
set_parameter_ref (&block, ioparm_iostat, p->iostat);
|
|
|
|
|
|
|
|
if (p->err)
|
|
|
|
set_flag (&block, ioparm_err);
|
|
|
|
|
|
|
|
tmp = gfc_build_function_call (function, NULL);
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
gfc_add_block_to_block (&block, &post_block);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
io_result (&block, p->err, NULL, NULL);
|
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate a BACKSPACE statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_backspace (gfc_code * code)
|
|
|
|
{
|
|
|
|
|
|
|
|
return build_filepos (iocall_backspace, code);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate an ENDFILE statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_endfile (gfc_code * code)
|
|
|
|
{
|
|
|
|
|
|
|
|
return build_filepos (iocall_endfile, code);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate a REWIND statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_rewind (gfc_code * code)
|
|
|
|
{
|
|
|
|
|
|
|
|
return build_filepos (iocall_rewind, code);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-08 01:56:19 +03:00
|
|
|
/* Translate a FLUSH statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_flush (gfc_code * code)
|
|
|
|
{
|
|
|
|
|
|
|
|
return build_filepos (iocall_flush, code);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Translate the non-IOLENGTH form of an INQUIRE statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_inquire (gfc_code * code)
|
|
|
|
{
|
|
|
|
stmtblock_t block, post_block;
|
|
|
|
gfc_inquire *p;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_init_block (&block);
|
|
|
|
gfc_init_block (&post_block);
|
|
|
|
|
|
|
|
set_error_locus (&block, &code->loc);
|
|
|
|
p = code->ext.inquire;
|
|
|
|
|
2005-08-08 01:56:19 +03:00
|
|
|
/* Sanity check. */
|
|
|
|
if (p->unit && p->file)
|
|
|
|
gfc_error ("INQUIRE statement at %L cannot contain both FILE and UNIT specifiers.", &code->loc);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (p->unit)
|
|
|
|
set_parameter_value (&block, ioparm_unit, p->unit);
|
|
|
|
|
|
|
|
if (p->file)
|
|
|
|
set_string (&block, &post_block, ioparm_file, ioparm_file_len, p->file);
|
|
|
|
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
if (p->iomsg)
|
|
|
|
set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
|
|
|
|
p->iomsg);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (p->iostat)
|
|
|
|
set_parameter_ref (&block, ioparm_iostat, p->iostat);
|
|
|
|
|
|
|
|
if (p->exist)
|
|
|
|
set_parameter_ref (&block, ioparm_exist, p->exist);
|
|
|
|
|
|
|
|
if (p->opened)
|
|
|
|
set_parameter_ref (&block, ioparm_opened, p->opened);
|
|
|
|
|
|
|
|
if (p->number)
|
|
|
|
set_parameter_ref (&block, ioparm_number, p->number);
|
|
|
|
|
|
|
|
if (p->named)
|
|
|
|
set_parameter_ref (&block, ioparm_named, p->named);
|
|
|
|
|
|
|
|
if (p->name)
|
|
|
|
set_string (&block, &post_block, ioparm_name, ioparm_name_len, p->name);
|
|
|
|
|
|
|
|
if (p->access)
|
|
|
|
set_string (&block, &post_block, ioparm_access,
|
|
|
|
ioparm_access_len, p->access);
|
|
|
|
|
|
|
|
if (p->sequential)
|
|
|
|
set_string (&block, &post_block, ioparm_sequential,
|
|
|
|
ioparm_sequential_len, p->sequential);
|
|
|
|
|
|
|
|
if (p->direct)
|
|
|
|
set_string (&block, &post_block, ioparm_direct,
|
|
|
|
ioparm_direct_len, p->direct);
|
|
|
|
|
|
|
|
if (p->form)
|
|
|
|
set_string (&block, &post_block, ioparm_form, ioparm_form_len, p->form);
|
|
|
|
|
|
|
|
if (p->formatted)
|
|
|
|
set_string (&block, &post_block, ioparm_formatted,
|
|
|
|
ioparm_formatted_len, p->formatted);
|
|
|
|
|
|
|
|
if (p->unformatted)
|
|
|
|
set_string (&block, &post_block, ioparm_unformatted,
|
|
|
|
ioparm_unformatted_len, p->unformatted);
|
|
|
|
|
|
|
|
if (p->recl)
|
|
|
|
set_parameter_ref (&block, ioparm_recl_out, p->recl);
|
|
|
|
|
|
|
|
if (p->nextrec)
|
|
|
|
set_parameter_ref (&block, ioparm_nextrec, p->nextrec);
|
|
|
|
|
|
|
|
if (p->blank)
|
|
|
|
set_string (&block, &post_block, ioparm_blank, ioparm_blank_len,
|
|
|
|
p->blank);
|
|
|
|
|
|
|
|
if (p->position)
|
|
|
|
set_string (&block, &post_block, ioparm_position,
|
|
|
|
ioparm_position_len, p->position);
|
|
|
|
|
|
|
|
if (p->action)
|
|
|
|
set_string (&block, &post_block, ioparm_action,
|
|
|
|
ioparm_action_len, p->action);
|
|
|
|
|
|
|
|
if (p->read)
|
|
|
|
set_string (&block, &post_block, ioparm_read, ioparm_read_len, p->read);
|
|
|
|
|
|
|
|
if (p->write)
|
|
|
|
set_string (&block, &post_block, ioparm_write,
|
|
|
|
ioparm_write_len, p->write);
|
|
|
|
|
|
|
|
if (p->readwrite)
|
|
|
|
set_string (&block, &post_block, ioparm_readwrite,
|
|
|
|
ioparm_readwrite_len, p->readwrite);
|
|
|
|
|
|
|
|
if (p->delim)
|
|
|
|
set_string (&block, &post_block, ioparm_delim, ioparm_delim_len,
|
|
|
|
p->delim);
|
|
|
|
|
2005-01-23 14:19:54 +00:00
|
|
|
if (p->pad)
|
|
|
|
set_string (&block, &post_block, ioparm_pad, ioparm_pad_len,
|
|
|
|
p->pad);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (p->err)
|
|
|
|
set_flag (&block, ioparm_err);
|
|
|
|
|
|
|
|
tmp = gfc_build_function_call (iocall_inquire, NULL);
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (&block, &post_block);
|
|
|
|
|
|
|
|
io_result (&block, p->err, NULL, NULL);
|
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gfc_expr *
|
2005-02-24 19:26:27 +01:00
|
|
|
gfc_new_nml_name_expr (const char * name)
|
2004-05-13 02:41:07 -04:00
|
|
|
{
|
|
|
|
gfc_expr * nml_name;
|
2005-04-17 20:09:37 +00:00
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
nml_name = gfc_get_expr();
|
|
|
|
nml_name->ref = NULL;
|
|
|
|
nml_name->expr_type = EXPR_CONSTANT;
|
gfortran.h (gfc_default_*_kind): Remove prototypes, add extern variable declaration of same name.
* gfortran.h (gfc_default_*_kind): Remove prototypes, add extern
variable declaration of same name.
* arith.c, check.c, decl.c, dump_parse_tree.c, expr.c,
intrinsic.c, io.c, iresolve.c, match.c, options.c, primary.c,
resolve.c, simplify.c, symbol.c, trans-const.c, trans-io.c:
Replace all calls to gfc_default_*_kind with variable accesses.
* trans-types.c: Same as above.
(gfc_default_*_kind_1): Rename to gfc_default_*_kind, remove
static qualifier. Replace all occurences.
(gfc_default_*_kind): Remove functions.
From-SVN: r86662
2004-08-27 16:49:35 +02:00
|
|
|
nml_name->ts.kind = gfc_default_character_kind;
|
2004-05-13 02:41:07 -04:00
|
|
|
nml_name->ts.type = BT_CHARACTER;
|
|
|
|
nml_name->value.character.length = strlen(name);
|
2005-02-24 19:26:27 +01:00
|
|
|
nml_name->value.character.string = gfc_getmem (strlen (name) + 1);
|
|
|
|
strcpy (nml_name->value.character.string, name);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
return nml_name;
|
|
|
|
}
|
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
/* nml_full_name builds up the fully qualified name of a
|
|
|
|
derived type component. */
|
|
|
|
|
|
|
|
static char*
|
|
|
|
nml_full_name (const char* var_name, const char* cmp_name)
|
2004-05-13 02:41:07 -04:00
|
|
|
{
|
2005-04-17 20:09:37 +00:00
|
|
|
int full_name_length;
|
|
|
|
char * full_name;
|
|
|
|
|
|
|
|
full_name_length = strlen (var_name) + strlen (cmp_name) + 1;
|
|
|
|
full_name = (char*)gfc_getmem (full_name_length + 1);
|
|
|
|
strcpy (full_name, var_name);
|
|
|
|
full_name = strcat (full_name, "%");
|
|
|
|
full_name = strcat (full_name, cmp_name);
|
|
|
|
return full_name;
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
/* nml_get_addr_expr builds an address expression from the
|
|
|
|
gfc_symbol or gfc_component backend_decl's. An offset is
|
|
|
|
provided so that the address of an element of an array of
|
|
|
|
derived types is returned. This is used in the runtime to
|
|
|
|
determine that span of the derived type. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
|
|
|
|
tree base_addr)
|
|
|
|
{
|
|
|
|
tree decl = NULL_TREE;
|
|
|
|
tree tmp;
|
|
|
|
tree itmp;
|
|
|
|
int array_flagged;
|
|
|
|
int dummy_arg_flagged;
|
|
|
|
|
|
|
|
if (sym)
|
|
|
|
{
|
|
|
|
sym->attr.referenced = 1;
|
|
|
|
decl = gfc_get_symbol_decl (sym);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
decl = c->backend_decl;
|
|
|
|
|
|
|
|
gcc_assert (decl && ((TREE_CODE (decl) == FIELD_DECL
|
|
|
|
|| TREE_CODE (decl) == VAR_DECL
|
|
|
|
|| TREE_CODE (decl) == PARM_DECL)
|
|
|
|
|| TREE_CODE (decl) == COMPONENT_REF));
|
|
|
|
|
|
|
|
tmp = decl;
|
|
|
|
|
|
|
|
/* Build indirect reference, if dummy argument. */
|
|
|
|
|
|
|
|
dummy_arg_flagged = POINTER_TYPE_P (TREE_TYPE(tmp));
|
|
|
|
|
|
|
|
itmp = (dummy_arg_flagged) ? gfc_build_indirect_ref (tmp) : tmp;
|
|
|
|
|
|
|
|
/* If an array, set flag and use indirect ref. if built. */
|
|
|
|
|
|
|
|
array_flagged = (TREE_CODE (TREE_TYPE (itmp)) == ARRAY_TYPE
|
|
|
|
&& !TYPE_STRING_FLAG (TREE_TYPE (itmp)));
|
|
|
|
|
|
|
|
if (array_flagged)
|
|
|
|
tmp = itmp;
|
|
|
|
|
|
|
|
/* Treat the component of a derived type, using base_addr for
|
|
|
|
the derived type. */
|
|
|
|
|
|
|
|
if (TREE_CODE (decl) == FIELD_DECL)
|
|
|
|
tmp = build3 (COMPONENT_REF, TREE_TYPE (tmp),
|
|
|
|
base_addr, tmp, NULL_TREE);
|
|
|
|
|
|
|
|
/* If we have a derived type component, a reference to the first
|
|
|
|
element of the array is built. This is done so that base_addr,
|
|
|
|
used in the build of the component reference, always points to
|
|
|
|
a RECORD_TYPE. */
|
|
|
|
|
|
|
|
if (array_flagged)
|
|
|
|
tmp = gfc_build_array_ref (tmp, gfc_index_zero_node);
|
|
|
|
|
|
|
|
/* Now build the address expression. */
|
|
|
|
|
|
|
|
tmp = gfc_build_addr_expr (NULL, tmp);
|
|
|
|
|
|
|
|
/* If scalar dummy, resolve indirect reference now. */
|
|
|
|
|
|
|
|
if (dummy_arg_flagged && !array_flagged)
|
|
|
|
tmp = gfc_build_indirect_ref (tmp);
|
|
|
|
|
|
|
|
gcc_assert (tmp && POINTER_TYPE_P (TREE_TYPE (tmp)));
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
2004-08-18 01:20:06 +00:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
/* For an object VAR_NAME whose base address is BASE_ADDR, generate a
|
|
|
|
call to iocall_set_nml_val. For derived type variable, recursively
|
|
|
|
generate calls to iocall_set_nml_val for each component. */
|
2004-08-18 01:20:06 +00:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
#define NML_FIRST_ARG(a) args = gfc_chainon_list (NULL_TREE, a)
|
|
|
|
#define NML_ADD_ARG(a) args = gfc_chainon_list (args, a)
|
|
|
|
#define IARG(i) build_int_cst (gfc_array_index_type, i)
|
2004-08-18 01:20:06 +00:00
|
|
|
|
|
|
|
static void
|
2005-04-17 20:09:37 +00:00
|
|
|
transfer_namelist_element (stmtblock_t * block, const char * var_name,
|
|
|
|
gfc_symbol * sym, gfc_component * c,
|
|
|
|
tree base_addr)
|
2004-08-18 01:20:06 +00:00
|
|
|
{
|
2005-04-17 20:09:37 +00:00
|
|
|
gfc_typespec * ts = NULL;
|
|
|
|
gfc_array_spec * as = NULL;
|
|
|
|
tree addr_expr = NULL;
|
|
|
|
tree dt = NULL;
|
|
|
|
tree string;
|
|
|
|
tree tmp;
|
|
|
|
tree args;
|
|
|
|
tree dtype;
|
|
|
|
int n_dim;
|
|
|
|
int itype;
|
|
|
|
int rank = 0;
|
2004-08-18 01:20:06 +00:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
gcc_assert (sym || c);
|
2004-08-18 01:20:06 +00:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
/* Build the namelist object name. */
|
|
|
|
|
|
|
|
string = gfc_build_cstring_const (var_name);
|
|
|
|
string = gfc_build_addr_expr (pchar_type_node, string);
|
|
|
|
|
|
|
|
/* Build ts, as and data address using symbol or component. */
|
|
|
|
|
|
|
|
ts = (sym) ? &sym->ts : &c->ts;
|
|
|
|
as = (sym) ? sym->as : c->as;
|
|
|
|
|
|
|
|
addr_expr = nml_get_addr_expr (sym, c, base_addr);
|
|
|
|
|
|
|
|
if (as)
|
|
|
|
rank = as->rank;
|
|
|
|
|
|
|
|
if (rank)
|
2004-08-18 01:20:06 +00:00
|
|
|
{
|
2005-04-17 20:09:37 +00:00
|
|
|
dt = TREE_TYPE ((sym) ? sym->backend_decl : c->backend_decl);
|
|
|
|
dtype = gfc_get_dtype (dt);
|
2004-08-18 01:20:06 +00:00
|
|
|
}
|
2005-04-17 20:09:37 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
itype = GFC_DTYPE_UNKNOWN;
|
2004-08-18 01:20:06 +00:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
switch (ts->type)
|
2004-08-18 01:20:06 +00:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
{
|
|
|
|
case BT_INTEGER:
|
|
|
|
itype = GFC_DTYPE_INTEGER;
|
|
|
|
break;
|
|
|
|
case BT_LOGICAL:
|
|
|
|
itype = GFC_DTYPE_LOGICAL;
|
|
|
|
break;
|
|
|
|
case BT_REAL:
|
|
|
|
itype = GFC_DTYPE_REAL;
|
|
|
|
break;
|
|
|
|
case BT_COMPLEX:
|
|
|
|
itype = GFC_DTYPE_COMPLEX;
|
|
|
|
break;
|
|
|
|
case BT_DERIVED:
|
|
|
|
itype = GFC_DTYPE_DERIVED;
|
|
|
|
break;
|
|
|
|
case BT_CHARACTER:
|
|
|
|
itype = GFC_DTYPE_CHARACTER;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gcc_unreachable ();
|
|
|
|
}
|
|
|
|
|
|
|
|
dtype = IARG (itype << GFC_DTYPE_TYPE_SHIFT);
|
2004-08-18 01:20:06 +00:00
|
|
|
}
|
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
/* Build up the arguments for the transfer call.
|
|
|
|
The call for the scalar part transfers:
|
|
|
|
(address, name, type, kind or string_length, dtype) */
|
|
|
|
|
|
|
|
NML_FIRST_ARG (addr_expr);
|
|
|
|
NML_ADD_ARG (string);
|
|
|
|
NML_ADD_ARG (IARG (ts->kind));
|
|
|
|
|
|
|
|
if (ts->type == BT_CHARACTER)
|
|
|
|
NML_ADD_ARG (ts->cl->backend_decl);
|
|
|
|
else
|
|
|
|
NML_ADD_ARG (convert (gfc_charlen_type_node, integer_zero_node));
|
|
|
|
|
|
|
|
NML_ADD_ARG (dtype);
|
|
|
|
tmp = gfc_build_function_call (iocall_set_nml_val, args);
|
2004-08-18 01:20:06 +00:00
|
|
|
gfc_add_expr_to_block (block, tmp);
|
2005-04-17 20:09:37 +00:00
|
|
|
|
|
|
|
/* If the object is an array, transfer rank times:
|
|
|
|
(null pointer, name, stride, lbound, ubound) */
|
|
|
|
|
|
|
|
for ( n_dim = 0 ; n_dim < rank ; n_dim++ )
|
|
|
|
{
|
|
|
|
NML_FIRST_ARG (IARG (n_dim));
|
|
|
|
NML_ADD_ARG (GFC_TYPE_ARRAY_STRIDE (dt, n_dim));
|
|
|
|
NML_ADD_ARG (GFC_TYPE_ARRAY_LBOUND (dt, n_dim));
|
|
|
|
NML_ADD_ARG (GFC_TYPE_ARRAY_UBOUND (dt, n_dim));
|
|
|
|
tmp = gfc_build_function_call (iocall_set_nml_val_dim, args);
|
|
|
|
gfc_add_expr_to_block (block, tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ts->type == BT_DERIVED)
|
|
|
|
{
|
|
|
|
gfc_component *cmp;
|
|
|
|
|
|
|
|
/* Provide the RECORD_TYPE to build component references. */
|
|
|
|
|
|
|
|
tree expr = gfc_build_indirect_ref (addr_expr);
|
|
|
|
|
|
|
|
for (cmp = ts->derived->components; cmp; cmp = cmp->next)
|
|
|
|
{
|
|
|
|
char *full_name = nml_full_name (var_name, cmp->name);
|
|
|
|
transfer_namelist_element (block,
|
|
|
|
full_name,
|
|
|
|
NULL, cmp, expr);
|
|
|
|
gfc_free (full_name);
|
|
|
|
}
|
|
|
|
}
|
2004-08-18 01:20:06 +00:00
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
|
2005-04-17 20:09:37 +00:00
|
|
|
#undef IARG
|
|
|
|
#undef NML_ADD_ARG
|
|
|
|
#undef NML_FIRST_ARG
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Create a data transfer statement. Not all of the fields are valid
|
|
|
|
for both reading and writing, but improper use has been filtered
|
|
|
|
out by now. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
build_dt (tree * function, gfc_code * code)
|
|
|
|
{
|
|
|
|
stmtblock_t block, post_block;
|
|
|
|
gfc_dt *dt;
|
2004-08-18 01:20:06 +00:00
|
|
|
tree tmp;
|
2005-04-17 20:09:37 +00:00
|
|
|
gfc_expr *nmlname;
|
2004-08-18 01:20:06 +00:00
|
|
|
gfc_namelist *nml;
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
gfc_init_block (&block);
|
|
|
|
gfc_init_block (&post_block);
|
|
|
|
|
|
|
|
set_error_locus (&block, &code->loc);
|
|
|
|
dt = code->ext.dt;
|
|
|
|
|
2004-09-08 14:33:03 +00:00
|
|
|
gcc_assert (dt != NULL);
|
2004-06-22 03:43:55 +03:00
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (dt->io_unit)
|
|
|
|
{
|
|
|
|
if (dt->io_unit->ts.type == BT_CHARACTER)
|
|
|
|
{
|
2005-09-14 20:19:37 +00:00
|
|
|
set_internal_unit (&block,
|
|
|
|
ioparm_internal_unit,
|
|
|
|
ioparm_internal_unit_len,
|
|
|
|
ioparm_internal_unit_desc,
|
|
|
|
dt->io_unit);
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
set_parameter_value (&block, ioparm_unit, dt->io_unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dt->rec)
|
|
|
|
set_parameter_value (&block, ioparm_rec, dt->rec);
|
|
|
|
|
|
|
|
if (dt->advance)
|
|
|
|
set_string (&block, &post_block, ioparm_advance, ioparm_advance_len,
|
|
|
|
dt->advance);
|
|
|
|
|
|
|
|
if (dt->format_expr)
|
|
|
|
set_string (&block, &post_block, ioparm_format, ioparm_format_len,
|
|
|
|
dt->format_expr);
|
|
|
|
|
|
|
|
if (dt->format_label)
|
|
|
|
{
|
|
|
|
if (dt->format_label == &format_asterisk)
|
|
|
|
set_flag (&block, ioparm_list_format);
|
|
|
|
else
|
|
|
|
set_string (&block, &post_block, ioparm_format,
|
|
|
|
ioparm_format_len, dt->format_label->format);
|
|
|
|
}
|
|
|
|
|
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos,
gfc_inquire and gfc_dt.
* dump-parse-tree.c (gfc_show_code_node): Add iomsg
for open, close, file positioning, inquire and namelist.
* io.c (io_tag): Add tag_iomsg.
(resolve_tag): Add standards warning for iomsg.
(match_open_element): Add iomsg.
(gfc_free_open): Add iomsg.
(gfc_resolve_open): Add iomsg.
(gfc_free_close): Add iomsg.
(match_close_element): Add iomsg.
(gfc_resolve_close): Add iomsg.
(gfc_free_filepos): Add iomsg.
(match_file_element): Add iomsg.
(gfc_resolve_filepos): Add iostat and iomsg.
(match-dt_element): Add iomsg.
(gfc_free_dt): Add iomsg.
(gfc_resolve_dt): Add iomsg.
(gfc_free_inquire): Add iomsg.
(match_inquire_element): Add iomsg.
(gfc_resolve_inquire): Add iomsg.
* trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len.
(gfc_build_io_library_fndecls): Add iomsg as last field.
(gfc_trans_open): Add iomsg.
(gfc_trans_close): Add iomsg.
(build_fileos): Call set_string for iomsg.
(gfc_trans_inquire): Add iomsg.
(build_dt): Add iomsg.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* io/io.h: Add iomsg as last field of st_parameter.
* runtime/error.c (generate_error): If iomsg is present, copy
the message there.
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/iomsg_1.f90: New test case.
From-SVN: r104102
2005-09-09 18:21:45 +00:00
|
|
|
if (dt->iomsg)
|
|
|
|
set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
|
|
|
|
dt->iomsg);
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
if (dt->iostat)
|
|
|
|
set_parameter_ref (&block, ioparm_iostat, dt->iostat);
|
|
|
|
|
|
|
|
if (dt->size)
|
|
|
|
set_parameter_ref (&block, ioparm_size, dt->size);
|
|
|
|
|
|
|
|
if (dt->err)
|
|
|
|
set_flag (&block, ioparm_err);
|
|
|
|
|
|
|
|
if (dt->eor)
|
|
|
|
set_flag(&block, ioparm_eor);
|
|
|
|
|
|
|
|
if (dt->end)
|
|
|
|
set_flag(&block, ioparm_end);
|
|
|
|
|
|
|
|
if (dt->namelist)
|
|
|
|
{
|
2005-04-17 20:09:37 +00:00
|
|
|
if (dt->format_expr || dt->format_label)
|
|
|
|
gfc_internal_error ("build_dt: format with namelist");
|
|
|
|
|
|
|
|
nmlname = gfc_new_nml_name_expr(dt->namelist->name);
|
|
|
|
|
|
|
|
set_string (&block, &post_block, ioparm_namelist_name,
|
|
|
|
ioparm_namelist_name_len, nmlname);
|
|
|
|
|
|
|
|
if (last_dt == READ)
|
|
|
|
set_flag (&block, ioparm_namelist_read_mode);
|
|
|
|
|
|
|
|
for (nml = dt->namelist->namelist; nml; nml = nml->next)
|
|
|
|
transfer_namelist_element (&block, nml->sym->name, nml->sym,
|
|
|
|
NULL, NULL);
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tmp = gfc_build_function_call (*function, NULL_TREE);
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (&block, &post_block);
|
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-22 03:43:55 +03:00
|
|
|
/* Translate the IOLENGTH form of an INQUIRE statement. We treat
|
|
|
|
this as a third sort of data transfer statement, except that
|
data.c, [...]: Fix comment typos.
* data.c, dependency.c, f95-lang.c, io.c, trans-array.c,
trans-decl.c, trans-expr.c, trans-intrinsic.c, trans-io.c,
trans-stmt.c, trans-types.c, trans.h: Fix comment typos.
Follow spelling conventions.
From-SVN: r94111
2005-01-23 14:36:26 +00:00
|
|
|
lengths are summed instead of actually transferring any data. */
|
2004-06-22 03:43:55 +03:00
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_iolength (gfc_code * code)
|
|
|
|
{
|
|
|
|
stmtblock_t block;
|
|
|
|
gfc_inquire *inq;
|
|
|
|
tree dt;
|
|
|
|
|
|
|
|
gfc_init_block (&block);
|
|
|
|
|
|
|
|
set_error_locus (&block, &code->loc);
|
|
|
|
|
|
|
|
inq = code->ext.inquire;
|
|
|
|
|
|
|
|
/* First check that preconditions are met. */
|
2004-09-08 14:33:03 +00:00
|
|
|
gcc_assert (inq != NULL);
|
|
|
|
gcc_assert (inq->iolength != NULL);
|
2004-06-22 03:43:55 +03:00
|
|
|
|
|
|
|
/* Connect to the iolength variable. */
|
|
|
|
if (inq->iolength)
|
|
|
|
set_parameter_ref (&block, ioparm_iolength, inq->iolength);
|
|
|
|
|
|
|
|
/* Actual logic. */
|
|
|
|
last_dt = IOLENGTH;
|
|
|
|
dt = build_dt(&iocall_iolength, code);
|
|
|
|
|
|
|
|
gfc_add_expr_to_block (&block, dt);
|
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* Translate a READ statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_read (gfc_code * code)
|
|
|
|
{
|
|
|
|
|
|
|
|
last_dt = READ;
|
|
|
|
return build_dt (&iocall_read, code);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate a WRITE statement */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_write (gfc_code * code)
|
|
|
|
{
|
|
|
|
|
|
|
|
last_dt = WRITE;
|
|
|
|
return build_dt (&iocall_write, code);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Finish a data transfer statement. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_dt_end (gfc_code * code)
|
|
|
|
{
|
|
|
|
tree function, tmp;
|
|
|
|
stmtblock_t block;
|
|
|
|
|
|
|
|
gfc_init_block (&block);
|
|
|
|
|
2004-06-22 03:43:55 +03:00
|
|
|
switch (last_dt)
|
|
|
|
{
|
|
|
|
case READ:
|
|
|
|
function = iocall_read_done;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WRITE:
|
|
|
|
function = iocall_write_done;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IOLENGTH:
|
|
|
|
function = iocall_iolength_done;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2004-09-08 14:33:03 +00:00
|
|
|
gcc_unreachable ();
|
2004-06-22 03:43:55 +03:00
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
tmp = gfc_build_function_call (function, NULL);
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
2004-06-22 03:43:55 +03:00
|
|
|
if (last_dt != IOLENGTH)
|
|
|
|
{
|
2004-09-08 14:33:03 +00:00
|
|
|
gcc_assert (code->ext.dt != NULL);
|
2004-06-22 03:43:55 +03:00
|
|
|
io_result (&block, code->ext.dt->err,
|
|
|
|
code->ext.dt->end, code->ext.dt->eor);
|
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
|
|
|
|
2004-09-16 13:29:56 +00:00
|
|
|
static void
|
|
|
|
transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr);
|
|
|
|
|
|
|
|
/* Given an array field in a derived type variable, generate the code
|
|
|
|
for the loop that iterates over array elements, and the code that
|
|
|
|
accesses those array elements. Use transfer_expr to generate code
|
|
|
|
for transferring that element. Because elements may also be
|
|
|
|
derived types, transfer_expr and transfer_array_component are mutually
|
|
|
|
recursive. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
transfer_array_component (tree expr, gfc_component * cm)
|
|
|
|
{
|
|
|
|
tree tmp;
|
|
|
|
stmtblock_t body;
|
|
|
|
stmtblock_t block;
|
|
|
|
gfc_loopinfo loop;
|
|
|
|
int n;
|
|
|
|
gfc_ss *ss;
|
|
|
|
gfc_se se;
|
|
|
|
|
|
|
|
gfc_start_block (&block);
|
|
|
|
gfc_init_se (&se, NULL);
|
|
|
|
|
|
|
|
/* Create and initialize Scalarization Status. Unlike in
|
|
|
|
gfc_trans_transfer, we can't simply use gfc_walk_expr to take
|
|
|
|
care of this task, because we don't have a gfc_expr at hand.
|
|
|
|
Build one manually, as in gfc_trans_subarray_assign. */
|
|
|
|
|
|
|
|
ss = gfc_get_ss ();
|
|
|
|
ss->type = GFC_SS_COMPONENT;
|
|
|
|
ss->expr = NULL;
|
|
|
|
ss->shape = gfc_get_shape (cm->as->rank);
|
|
|
|
ss->next = gfc_ss_terminator;
|
|
|
|
ss->data.info.dimen = cm->as->rank;
|
|
|
|
ss->data.info.descriptor = expr;
|
|
|
|
ss->data.info.data = gfc_conv_array_data (expr);
|
|
|
|
ss->data.info.offset = gfc_conv_array_offset (expr);
|
|
|
|
for (n = 0; n < cm->as->rank; n++)
|
|
|
|
{
|
|
|
|
ss->data.info.dim[n] = n;
|
|
|
|
ss->data.info.start[n] = gfc_conv_array_lbound (expr, n);
|
|
|
|
ss->data.info.stride[n] = gfc_index_one_node;
|
|
|
|
|
|
|
|
mpz_init (ss->shape[n]);
|
|
|
|
mpz_sub (ss->shape[n], cm->as->upper[n]->value.integer,
|
|
|
|
cm->as->lower[n]->value.integer);
|
|
|
|
mpz_add_ui (ss->shape[n], ss->shape[n], 1);
|
|
|
|
}
|
|
|
|
|
arith.c, [...]: Fix comment formatting.
* arith.c, array.c, decl.c, expr.c, f95-lang.c, gfortran.h,
gfortranspec.c, interface.c, intrinsic.c, iresolve.c, match.c,
module.c, parse.c, parse.h, primary.c, resolve.c, scanner.c,
trans-array.c, trans-array.h, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans.h: Fix comment formatting.
From-SVN: r90266
2004-11-08 14:56:41 +00:00
|
|
|
/* Once we got ss, we use scalarizer to create the loop. */
|
2004-09-16 13:29:56 +00:00
|
|
|
|
|
|
|
gfc_init_loopinfo (&loop);
|
|
|
|
gfc_add_ss_to_loop (&loop, ss);
|
|
|
|
gfc_conv_ss_startstride (&loop);
|
|
|
|
gfc_conv_loop_setup (&loop);
|
|
|
|
gfc_mark_ss_chain_used (ss, 1);
|
|
|
|
gfc_start_scalarized_body (&loop, &body);
|
|
|
|
|
|
|
|
gfc_copy_loopinfo_to_se (&se, &loop);
|
|
|
|
se.ss = ss;
|
|
|
|
|
|
|
|
/* gfc_conv_tmp_array_ref assumes that se.expr contains the array. */
|
|
|
|
se.expr = expr;
|
|
|
|
gfc_conv_tmp_array_ref (&se);
|
|
|
|
|
|
|
|
/* Now se.expr contains an element of the array. Take the address and pass
|
|
|
|
it to the IO routines. */
|
|
|
|
tmp = gfc_build_addr_expr (NULL, se.expr);
|
|
|
|
transfer_expr (&se, &cm->ts, tmp);
|
|
|
|
|
|
|
|
/* We are done now with the loop body. Wrap up the scalarizer and
|
arith.c, [...]: Fix comment formatting.
* arith.c, array.c, decl.c, expr.c, f95-lang.c, gfortran.h,
gfortranspec.c, interface.c, intrinsic.c, iresolve.c, match.c,
module.c, parse.c, parse.h, primary.c, resolve.c, scanner.c,
trans-array.c, trans-array.h, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans.h: Fix comment formatting.
From-SVN: r90266
2004-11-08 14:56:41 +00:00
|
|
|
return. */
|
2004-09-16 13:29:56 +00:00
|
|
|
|
|
|
|
gfc_add_block_to_block (&body, &se.pre);
|
|
|
|
gfc_add_block_to_block (&body, &se.post);
|
|
|
|
|
|
|
|
gfc_trans_scalarizing_loops (&loop, &body);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (&block, &loop.pre);
|
|
|
|
gfc_add_block_to_block (&block, &loop.post);
|
|
|
|
|
|
|
|
for (n = 0; n < cm->as->rank; n++)
|
|
|
|
mpz_clear (ss->shape[n]);
|
|
|
|
gfc_free (ss->shape);
|
|
|
|
|
2004-11-10 20:03:21 +00:00
|
|
|
gfc_cleanup_loop (&loop);
|
|
|
|
|
2004-09-16 13:29:56 +00:00
|
|
|
return gfc_finish_block (&block);
|
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
/* Generate the call for a scalar transfer node. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
|
|
|
{
|
|
|
|
tree args, tmp, function, arg2, field, expr;
|
|
|
|
gfc_component *c;
|
|
|
|
int kind;
|
|
|
|
|
|
|
|
kind = ts->kind;
|
|
|
|
function = NULL;
|
|
|
|
arg2 = NULL;
|
|
|
|
|
|
|
|
switch (ts->type)
|
|
|
|
{
|
|
|
|
case BT_INTEGER:
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 09:52:54 +00:00
|
|
|
arg2 = build_int_cst (NULL_TREE, kind);
|
2004-05-13 02:41:07 -04:00
|
|
|
function = iocall_x_integer;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BT_REAL:
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 09:52:54 +00:00
|
|
|
arg2 = build_int_cst (NULL_TREE, kind);
|
2004-05-13 02:41:07 -04:00
|
|
|
function = iocall_x_real;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BT_COMPLEX:
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 09:52:54 +00:00
|
|
|
arg2 = build_int_cst (NULL_TREE, kind);
|
2004-05-13 02:41:07 -04:00
|
|
|
function = iocall_x_complex;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BT_LOGICAL:
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 09:52:54 +00:00
|
|
|
arg2 = build_int_cst (NULL_TREE, kind);
|
2004-05-13 02:41:07 -04:00
|
|
|
function = iocall_x_logical;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BT_CHARACTER:
|
2004-09-16 13:29:56 +00:00
|
|
|
if (se->string_length)
|
|
|
|
arg2 = se->string_length;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmp = gfc_build_indirect_ref (addr_expr);
|
|
|
|
gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE);
|
|
|
|
arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
|
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
function = iocall_x_character;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BT_DERIVED:
|
2004-09-16 13:29:56 +00:00
|
|
|
/* Recurse into the elements of the derived type. */
|
2004-05-13 02:41:07 -04:00
|
|
|
expr = gfc_evaluate_now (addr_expr, &se->pre);
|
|
|
|
expr = gfc_build_indirect_ref (expr);
|
|
|
|
|
|
|
|
for (c = ts->derived->components; c; c = c->next)
|
|
|
|
{
|
|
|
|
field = c->backend_decl;
|
2004-09-08 14:33:03 +00:00
|
|
|
gcc_assert (field && TREE_CODE (field) == FIELD_DECL);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
trans.h (build2_v, build3_v): New macros.
* trans.h (build2_v, build3_v): New macros.
(build_v): Remove.
* f95-lang.c (gfc_truthvalue_conversion): Use build2 instead of
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
gfc_trans_array_constructor_value, gfc_conv_array_index_ref,
gfc_trans_array_bound_check, gfc_conv_array_index_offset,
gfc_conv_scalarized_array_ref, gfc_conv_array_ref,
gfc_conv_array_ref, gfc_trans_preloop_setup,
gfc_trans_scalarized_loop_end, gfc_conv_ss_startstride,
gfc_conv_loop_setup, gfc_array_init_size,
gfc_conv_array_initializer, gfc_trans_array_bounds,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_expr_descriptor, gfc_conv_array_parameter,
gfc_trans_deferred_array): Use buildN and buildN_v macros instead
of build and build_v as appropriate.
* trans-common.c (create_common): Same.
* trans-decl.c (gfc_trans_auto_character_variable,
gfc_trans_entry_master_switch, gfc_generate_function_code): Same.
* trans-expr.c (gfc_conv_expr_present, gfc_conv_substring,
gfc_conv_component_ref, gfc_conv_unary_op, gfc_conv_powi,
gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_concat_op,
gfc_conv_expr_op, gfc_conv_function_call,
gfc_trans_structure_assign): Same.
* trans-intrinsic.c (build_fixbound_expr, build_round_expr,
gfc_conv_intrinsic_aint, gfc_conv_intrinsic_bound,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_dim, gfc_conv_intrinsic_sign,
gfc_conv_intrinsic_dprod, gfc_conv_intrinsic_minmax,
gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count,
gfc_conv_intrinsic_arith, gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_bitop, gfc_conv_intrinsic_singlebitop,
gfc_conv_intrinsic_ibits, gfc_conv_intrinsic_ishft,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_strcmp,
gfc_conv_allocated, gfc_conv_associated, prepare_arg_info,
gfc_conv_intrinsic_spacing, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_repeat,
gfc_conv_intrinsic_iargc): Same.
* trans-io.c (set_parameter_value, set_parameter_ref, set_string,
set_flag, add_case, io_result, transfer_namelist_element,
transfer_expr): Same.
* trans-stmt.c (gfc_trans_goto, gfc_trans_return, gfc_trans_if_1,
gfc_trans_arithmetic_if, gfc_trans_do, gfc_trans_do_while,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_character_select, gfc_trans_forall_loop,
gfc_trans_nested_forall_loop, gfc_do_allocate,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
compute_inner_temp_size, compute_overall_iter_number,
allocate_temp_for_forall_nest, gfc_trans_pointer_assign_need_temp,
gfc_trans_forall_1, gfc_evaluate_where_mask,
gfc_trans_where_assign, gfc_trans_allocate): Same.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Same.
* trans.c (gfc_add_modify_expr, gfc_finish_block,
gfc_build_array_ref, gfc_build_function_call,
gfc_trans_runtime_check): Same.
From-SVN: r86554
2004-08-25 17:50:36 +02:00
|
|
|
tmp = build3 (COMPONENT_REF, TREE_TYPE (field), expr, field,
|
|
|
|
NULL_TREE);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
2004-09-16 13:29:56 +00:00
|
|
|
if (c->dimension)
|
|
|
|
{
|
|
|
|
tmp = transfer_array_component (tmp, c);
|
|
|
|
gfc_add_expr_to_block (&se->pre, tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!c->pointer)
|
|
|
|
tmp = gfc_build_addr_expr (NULL, tmp);
|
|
|
|
transfer_expr (se, &c->ts, tmp);
|
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
internal_error ("Bad IO basetype (%d)", ts->type);
|
|
|
|
}
|
|
|
|
|
|
|
|
args = gfc_chainon_list (NULL_TREE, addr_expr);
|
|
|
|
args = gfc_chainon_list (args, arg2);
|
|
|
|
|
|
|
|
tmp = gfc_build_function_call (function, args);
|
|
|
|
gfc_add_expr_to_block (&se->pre, tmp);
|
|
|
|
gfc_add_block_to_block (&se->pre, &se->post);
|
2004-06-22 03:43:55 +03:00
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-26 23:24:45 +03:00
|
|
|
/* Generate a call to pass an array descriptor to the IO library. The
|
|
|
|
array should be of one of the intrinsic types. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
|
|
|
{
|
2005-11-06 20:28:22 +02:00
|
|
|
tree args, tmp, charlen_arg, kind_arg;
|
2005-09-26 23:24:45 +03:00
|
|
|
|
|
|
|
if (ts->type == BT_CHARACTER)
|
|
|
|
charlen_arg = se->string_length;
|
|
|
|
else
|
|
|
|
charlen_arg = build_int_cstu (NULL_TREE, 0);
|
|
|
|
|
2005-11-06 20:28:22 +02:00
|
|
|
kind_arg = build_int_cst (NULL_TREE, ts->kind);
|
|
|
|
|
2005-09-26 23:24:45 +03:00
|
|
|
args = gfc_chainon_list (NULL_TREE, addr_expr);
|
2005-11-06 20:28:22 +02:00
|
|
|
args = gfc_chainon_list (args, kind_arg);
|
2005-09-26 23:24:45 +03:00
|
|
|
args = gfc_chainon_list (args, charlen_arg);
|
|
|
|
tmp = gfc_build_function_call (iocall_x_array, args);
|
|
|
|
gfc_add_expr_to_block (&se->pre, tmp);
|
|
|
|
gfc_add_block_to_block (&se->pre, &se->post);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-13 02:41:07 -04:00
|
|
|
/* gfc_trans_transfer()-- Translate a TRANSFER code node */
|
|
|
|
|
|
|
|
tree
|
|
|
|
gfc_trans_transfer (gfc_code * code)
|
|
|
|
{
|
|
|
|
stmtblock_t block, body;
|
|
|
|
gfc_loopinfo loop;
|
|
|
|
gfc_expr *expr;
|
|
|
|
gfc_ss *ss;
|
|
|
|
gfc_se se;
|
|
|
|
tree tmp;
|
|
|
|
|
|
|
|
gfc_start_block (&block);
|
2005-09-26 23:24:45 +03:00
|
|
|
gfc_init_block (&body);
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
expr = code->expr;
|
|
|
|
ss = gfc_walk_expr (expr);
|
|
|
|
|
|
|
|
gfc_init_se (&se, NULL);
|
|
|
|
|
|
|
|
if (ss == gfc_ss_terminator)
|
2005-09-26 23:24:45 +03:00
|
|
|
{
|
|
|
|
gfc_conv_expr_reference (&se, expr);
|
|
|
|
transfer_expr (&se, &expr->ts, se.expr);
|
|
|
|
}
|
|
|
|
else if (expr->ts.type == BT_DERIVED)
|
2004-05-13 02:41:07 -04:00
|
|
|
{
|
|
|
|
/* Initialize the scalarizer. */
|
|
|
|
gfc_init_loopinfo (&loop);
|
|
|
|
gfc_add_ss_to_loop (&loop, ss);
|
|
|
|
|
|
|
|
/* Initialize the loop. */
|
|
|
|
gfc_conv_ss_startstride (&loop);
|
|
|
|
gfc_conv_loop_setup (&loop);
|
|
|
|
|
|
|
|
/* The main loop body. */
|
|
|
|
gfc_mark_ss_chain_used (ss, 1);
|
|
|
|
gfc_start_scalarized_body (&loop, &body);
|
|
|
|
|
|
|
|
gfc_copy_loopinfo_to_se (&se, &loop);
|
|
|
|
se.ss = ss;
|
|
|
|
|
2005-09-26 23:24:45 +03:00
|
|
|
gfc_conv_expr_reference (&se, expr);
|
|
|
|
transfer_expr (&se, &expr->ts, se.expr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Pass the array descriptor to the library. */
|
|
|
|
gfc_conv_expr_descriptor (&se, expr, ss);
|
|
|
|
tmp = gfc_build_addr_expr (NULL, se.expr);
|
|
|
|
transfer_array_desc (&se, &expr->ts, tmp);
|
|
|
|
}
|
2004-05-13 02:41:07 -04:00
|
|
|
|
|
|
|
gfc_add_block_to_block (&body, &se.pre);
|
|
|
|
gfc_add_block_to_block (&body, &se.post);
|
|
|
|
|
|
|
|
if (se.ss == NULL)
|
|
|
|
tmp = gfc_finish_block (&body);
|
|
|
|
else
|
|
|
|
{
|
2004-09-08 14:33:03 +00:00
|
|
|
gcc_assert (se.ss == gfc_ss_terminator);
|
2004-05-13 02:41:07 -04:00
|
|
|
gfc_trans_scalarizing_loops (&loop, &body);
|
|
|
|
|
|
|
|
gfc_add_block_to_block (&loop.pre, &loop.post);
|
|
|
|
tmp = gfc_finish_block (&loop.pre);
|
|
|
|
gfc_cleanup_loop (&loop);
|
|
|
|
}
|
|
|
|
|
|
|
|
gfc_add_expr_to_block (&block, tmp);
|
|
|
|
|
2004-09-16 13:29:56 +00:00
|
|
|
return gfc_finish_block (&block);
|
2004-05-13 02:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "gt-fortran-trans-io.h"
|
|
|
|
|