aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorChao-ying Fu <fu@mips.com>2006-11-30 19:24:37 +0000
committerChao-ying Fu <fu@mips.com>2006-11-30 19:24:37 +0000
commita9641a8a6f15abce1082ec6dffc290682e8cac2a (patch)
treee8e81edba4d6e48299118da40d37621375a16e8f /libgfortran
parent229c0630f821215d0967e1b8879f4c917594fe2a (diff)
Merged revisions 118337-118377 via svnmerge from
svn+ssh://chaoyingfu@sources.redhat.com/svn/gcc/trunk ........ r118337 | charlet | 2006-10-31 12:11:46 -0800 (Tue, 31 Oct 2006) | 2 lines Resync. ........ r118338 | fxcoudert | 2006-10-31 12:15:22 -0800 (Tue, 31 Oct 2006) | 12 lines PR fortran/29067 * decl.c (gfc_set_constant_character_len): NULL-terminate the character constant string. * data.c (create_character_intializer): Likewise. * expr.c (gfc_simplify_expr): NULL-terminate the substring character constant. * primary.c (match_hollerith_constant): NULL-terminate the character constant string. * gfortran.dg/pr29067.f: New test. ........ r118339 | fxcoudert | 2006-10-31 12:17:11 -0800 (Tue, 31 Oct 2006) | 2 lines * ChangeLog: Forgotten ChangeLog entry for previous commit. ........ r118340 | charlet | 2006-10-31 12:43:39 -0800 (Tue, 31 Oct 2006) | 2 lines Fix typo. ........ r118341 | tkoenig | 2006-10-31 12:58:26 -0800 (Tue, 31 Oct 2006) | 18 lines 2006-10-31 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/29627 * libgfortran.h: Add ERROR_SHORT_RECORD * runtime/error.c (translate_error): Add case for ERROR_SHORT_RECORD. * io/transfer.c (read_block_direct): Separate codepaths for stream and record unformatted I/O. Remove unneeded tests for standard input, padding and formatted I/O. If the record is short, read in as much data as possible, then raise the error. 2006-10-31 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/29627 * gfortran.dg/unf_short_record_1.f90: New test. ........ r118343 | sje | 2006-10-31 14:28:18 -0800 (Tue, 31 Oct 2006) | 4 lines * inclhack.def (hpux11_extern_sendfile): New. (hpux11_extern_sendpath): New. * fixincl.x: Regenerate. ........ r118344 | ebotcazou | 2006-10-31 15:29:06 -0800 (Tue, 31 Oct 2006) | 3 lines * gcc.c-torture/execute/20061031-1.c: New test. ........ r118347 | aldot | 2006-10-31 15:38:58 -0800 (Tue, 31 Oct 2006) | 20 lines fortran/ChangeLog: 2006-11-01 Bernhard Fischer <aldot@gcc.gnu.org> PR fortran/29537 * trans-common.c (gfc_trans_common): If the blank common is in a procedure or program without a name then proc_name is null, so use the locus of the common. (gfc_sym_mangled_common_id): Fix whitespace. * match.c (gfc_match_common): Emit warning about blank common in block data. testsuite/ChangeLog: 2006-11-01 Bernhard Fischer <aldot@gcc.gnu.org> PR fortran/29537 * gfortran.dg/blockdata_1.f90: Add warning about blank common in block data. * gfortran.dg/blockdata_2.f90: New testcase. ........ r118353 | gccadmin | 2006-10-31 16:17:53 -0800 (Tue, 31 Oct 2006) | 1 line Daily bump. ........ r118355 | sayle | 2006-10-31 18:56:45 -0800 (Tue, 31 Oct 2006) | 10 lines PR middle-end/23470 * tree.h (tree_expr_nonnegative_p): Return "bool" instead of "int". * fold-const.c (tree_expr_nonnegative_p): Likewise. Consider pow(x,y) and powi(x,y) to be nonnegative if either x is nonnegative or y is an even integer. * gcc.dg/pr23470-1.c: New test case. ........ r118356 | geoffk | 2006-10-31 20:47:30 -0800 (Tue, 31 Oct 2006) | 27 lines * c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on inline static functions in c99 mode. PR 16622 * doc/extend.texi (Inline): Update. * c-tree.h (struct language_function): Remove field 'extern_inline'. * c-decl.c (current_extern_inline): Delete. (pop_scope): Adjust test for an undefined nested function. Add warning about undeclared inline function. (diagnose_mismatched_decls): Update comments. Disallow overriding of inline functions in a translation unit in C99. Allow inline declarations in C99 at any time. (merge_decls): Boolize variables. Handle C99 'extern inline' semantics. (grokdeclarator): Set DECL_EXTERNAL here for functions. Handle C99 inline semantics. (start_function): Don't clear current_extern_inline. Don't set DECL_EXTERNAL. (c_push_function_context): Don't push current_extern_inline. (c_pop_function_context): Don't restore current_extern_inline. PR 11377 * c-typeck.c (build_external_ref): Warn about static variables used in extern inline functions. * c-decl.c (start_decl): Warn about static variables declared in extern inline functions. ........ r118357 | geoffk | 2006-10-31 20:48:15 -0800 (Tue, 31 Oct 2006) | 27 lines * c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on inline static functions in c99 mode. PR 16622 * doc/extend.texi (Inline): Update. * c-tree.h (struct language_function): Remove field 'extern_inline'. * c-decl.c (current_extern_inline): Delete. (pop_scope): Adjust test for an undefined nested function. Add warning about undeclared inline function. (diagnose_mismatched_decls): Update comments. Disallow overriding of inline functions in a translation unit in C99. Allow inline declarations in C99 at any time. (merge_decls): Boolize variables. Handle C99 'extern inline' semantics. (grokdeclarator): Set DECL_EXTERNAL here for functions. Handle C99 inline semantics. (start_function): Don't clear current_extern_inline. Don't set DECL_EXTERNAL. (c_push_function_context): Don't push current_extern_inline. (c_pop_function_context): Don't restore current_extern_inline. PR 11377 * c-typeck.c (build_external_ref): Warn about static variables used in extern inline functions. * c-decl.c (start_decl): Warn about static variables declared in extern inline functions. ........ r118358 | geoffk | 2006-10-31 20:53:33 -0800 (Tue, 31 Oct 2006) | 3 lines PR 15834 * config/darwin.h (NO_IMPLICIT_EXTERN_C): Define. ........ r118359 | geoffk | 2006-10-31 20:55:19 -0800 (Tue, 31 Oct 2006) | 7 lines * config/i386/darwin.h (PREFERRED_DEBUGGING_TYPE): Remove. * config/darwin.h (PREFERRED_DEBUGGING_TYPE): Set to DWARF2_DEBUG. * config/darwin.h (LINK_COMMAND_SPEC): Don't do weird things with -@. Call dsymutil when compiling and linking one or more source files in one step. ........ r118360 | geoffk | 2006-10-31 21:06:12 -0800 (Tue, 31 Oct 2006) | 23 lines In gcc/: * coverage.c (coverage_checksum_string): Update comment. * dwarf2out.c (switch_to_eh_frame_section): Update for removal of get_file_function_name. * cgraphunit.c (cgraph_build_static_cdtor): Update for rename of get_file_function_name_long. * tree.c (get_file_function_name): Rename from get_file_function_name_long; improve comment; handle 'I' and 'D' specially when the target has ctor/dtor support; remove special handling for 'F'. (get_file_function_name): Remove. * tree.h (get_file_function_name): Rename from get_file_function_name_long. (get_file_function_name): Remove prototype. In gcc/cp/: * name-lookup.c (get_anonymous_namespace_name): New. (push_namespace_with_attribs): Use get_anonymous_namespace_name. * decl2.c (start_objects): Update for rename of get_file_function_name_long. In gcc/fortran/: * trans-decl.c (gfc_generate_constructors): Update for removal of get_file_function_name. ........ r118361 | geoffk | 2006-10-31 21:14:40 -0800 (Tue, 31 Oct 2006) | 49 lines 2006-09-07 Eric Christopher <echristo@apple.com> Falk Hueffner <falk@debian.org> * doc/extend.texi (__builtin_bswap32): Document. (__builtin_bswap64): Ditto. * doc/libgcc.texi (bswapsi2): Document. (bswapdi2): Ditto. * doc/rtl.texi (bswap): Document. * optabs.c (expand_unop): Don't widen a bswap. (init_optabs): Init bswap. Set libfuncs explicitly for bswapsi2 and bswapdi2. * optabs.h (OTI_bswap): New. (bswap_optab): Ditto. * genopinit.c (optabs): Handle bswap_optab. * tree.h (tree_index): Add TI_UINT32_TYPE and TI_UINT64_TYPE. (uint32_type_node): New. (uint64_type_node): Ditto. * tree.c (build_common_tree_nodes_2): Initialize uint32_type_node and uint64_type_node. * builtins.c (expand_builtin_bswap): New. (expand_builtin): Call. (fold_builtin_bswap): New. (fold_builtin_1): Call. * fold-const.c (tree_expr_nonnegative_p): Return true for bswap. * builtin-types.def (BT_UINT32): New. (BT_UINT64): Ditto. (BT_FN_UINT32_UINT32): Ditto. (BT_FN_UINT64_UINT64): Ditto. * builtins.def (BUILT_IN_BSWAP32): New. (BUILT_IN_BSWAP64): Ditto. * rtl.def (BSWAP): New. * genattrtab.c (check_attr_value): New. * libgcc2.c (__bswapSI2): New. (__bswapDI2): Ditto. * libgcc2.h (__bswapSI2): Declare. (__bswapDI2): Ditto. * mklibgcc.in (lib2funcs): Add _bswapsi2 and _bswapdi2. * simplify-rtx.c (simplify_const_unary_operation): Return 0 for BSWAP. * libgcc-std.ver (__bwapsi2): Add. (__bswapdi2): Ditto. * reload1.c (eliminate_regs_1): Add bswap. (elimination_effects): Ditto. * config/i386/i386.h (x86_bswap): New. (TARGET_BSWAP): Use. * config/i386/i386.c (x86_bswap): Set. ........ r118362 | geoffk | 2006-10-31 21:16:14 -0800 (Tue, 31 Oct 2006) | 12 lines In gcc/: * toplev.c (compile_file): Call final_write_globals even if there have been errors. In gcc/cp/: * decl2.c (cp_write_global_declarations): Rename from cp_finish_file. * cp-lang.c (finish_file): Don't call cp_finish_file. * cp-tree.h (cp_write_global_declarations): Rename from cp_finish_file. * cp-objcp-common.h (LANG_HOOKS_WRITE_GLOBALS): Define to cp_write_global_declarations. ........ r118363 | geoffk | 2006-10-31 21:17:14 -0800 (Tue, 31 Oct 2006) | 1 line Add missing genopinit.c change for revision 118361. ........ r118364 | geoffk | 2006-10-31 21:20:05 -0800 (Tue, 31 Oct 2006) | 10 lines 2006-10-31 Eric Christopher <echristo@apple.com> Falk Hueffner <falk@debian.org> * gcc.dg/builtin-bswap-1.c: New. * gcc.dg/builtin-bswap-2.c: New. * gcc.dg/builtin-bswap-3.c: New. * gcc.dg/builtin-bswap-4.c: New. * gcc.dg/builtin-bswap-5.c: New. * gcc.target/i386/builtin-bswap-1.c: New. ........ r118365 | geoffk | 2006-10-31 21:28:41 -0800 (Tue, 31 Oct 2006) | 28 lines In gcc/: PR 23067 * c-decl.c (start_struct): Don't create self-containing structures. * config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align): New. * config/rs6000/rs6000-protos.h (darwin_rs6000_special_round_type_align): New. * config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Rewrite. (ROUND_TYPE_ALIGN): Use darwin_rs6000_special_round_type_align. In gcc/testsuite/: PR 23067 * gcc.target/powerpc/darwin-abi-3.c: Remove XFAIL. * gcc.target/powerpc/darwin-abi-6.c: Remove XFAIL. * gcc.target/powerpc/darwin-abi-7.c: Remove XFAIL. * gcc.target/powerpc/darwin-abi-8.c: Remove XFAIL. * gcc.target/powerpc/darwin-abi-9.c: Remove XFAIL. * gcc.target/powerpc/darwin-abi-10.c: Remove XFAIL. * gcc.target/powerpc/darwin-abi-11.c: Remove XFAIL. In libobjc/: * encoding.c (darwin_rs6000_special_round_type_align): New. In libffi/: * src/powerpc/ffi_darwin.c (darwin_adjust_aggregate_sizes): New. (ffi_prep_cif_machdep): Call darwin_adjust_aggregate_sizes for Darwin. * testsuite/libffi.call/nested_struct4.c: Remove Darwin XFAIL. * testsuite/libffi.call/nested_struct6.c: Remove Darwin XFAIL. ........ r118366 | ghazi | 2006-10-31 21:38:21 -0800 (Tue, 31 Oct 2006) | 7 lines * builtins.def (gamma, lgamma): Use ATTR_MATHFN_FPROUNDING_STORE. testsuite: * gcc.dg/torture/builtin-attr-1.c: Don't test gamma/lgamma. * gcc.dg/torture/builtin-convert-1.c: Don't test lgamma. ........ r118367 | geoffk | 2006-10-31 21:42:01 -0800 (Tue, 31 Oct 2006) | 1 line Fix date on ChangeLog entry ........ r118371 | dannysmith | 2006-10-31 22:23:12 -0800 (Tue, 31 Oct 2006) | 22 lines * target.h (targetm.cxx.use_atexit_for_cxa_atexit): New target hook. * target-def.h: (TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT): Define default. * config/i386/mingw32.h (TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT): Override default. * doc/tm.texi (TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT): Document. * configure.ac (use_cxa_atexit): As a special case, don't test for libc definition of __cxa_atexit on mingw32 * configure: Regenerate. * config.gcc (i[34567]86-pc-mingw32): Default to enable__cxa_atexit=yes. cp * decl.c (get_atexit_node): Reference atexit, not __cxa_exit. if targetm.cxx.use_atexit_for cxa_atexit. (start_cleanup_fn): Likewise. (register_dtor_fn): Likewise. ........ r118372 | pinskia | 2006-10-31 23:28:53 -0800 (Tue, 31 Oct 2006) | 7 lines 2006-10-31 Andrew Pinski <pinskia@gmail.com> * doc/invoke.texi (-fkeep-inline-functions): Change "GNU C" to "GNU C89". ........ r118373 | rguenth | 2006-11-01 03:38:06 -0800 (Wed, 01 Nov 2006) | 10 lines 2006-11-01 Richard Guenther <rguenther@suse.de> * config/i386/i386.c (ix86_expand_rint): Fix issues with signed zeros. (ix86_expand_floorceildf_32): Likewise. (ix86_expand_floorceil): Likewise. (ix86_expand_trunc): Likewise. * testsuite/gcc.target/i386/fpprec-1.c: New testcase. ........ r118374 | ebotcazou | 2006-11-01 03:58:18 -0800 (Wed, 01 Nov 2006) | 1 line Fix asm string. ........ r118377 | ebotcazou | 2006-11-01 04:09:25 -0800 (Wed, 01 Nov 2006) | 3 lines * gcc.c-torture/execute/20061101-1.c: New test. ........ git-svn-id: https://gcc.gnu.org/svn/gcc/branches/fixed-point@119373 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog12
-rw-r--r--libgfortran/io/transfer.c90
-rw-r--r--libgfortran/libgfortran.h1
-rw-r--r--libgfortran/runtime/error.c4
4 files changed, 58 insertions, 49 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6dd8270db22..54849e08c93 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,15 @@
+2006-10-31 Thomas Koenig <Thomas.Koenig@online.de>
+
+ PR libfortran/29627
+ * libgfortran.h: Add ERROR_SHORT_RECORD
+ * runtime/error.c (translate_error): Add case
+ for ERROR_SHORT_RECORD.
+ * io/transfer.c (read_block_direct): Separate codepaths
+ for stream and record unformatted I/O. Remove unneeded
+ tests for standard input, padding and formatted I/O.
+ If the record is short, read in as much data as possible,
+ then raise the error.
+
2006-10-30 Tobias Burnus <burnus@net-b.de>
PR fortran/29452
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 46fae1b2a1d..b4c2bb65b0c 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -359,82 +359,73 @@ read_block (st_parameter_dt *dtp, int *length)
static void
read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes)
{
- int *length;
- void *data;
size_t nread;
+ int short_record;
- if (!is_stream_io (dtp))
+ if (is_stream_io (dtp))
{
- if (dtp->u.p.current_unit->bytes_left < (gfc_offset) *nbytes)
+ if (sseek (dtp->u.p.current_unit->s,
+ dtp->u.p.current_unit->strm_pos - 1) == FAILURE)
{
- /* For preconnected units with default record length, set
- bytes left to unit record length and proceed, otherwise
- error. */
- if (dtp->u.p.current_unit->unit_number == options.stdin_unit
- && dtp->u.p.current_unit->recl == DEFAULT_RECL)
- dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
- else
- {
- if (dtp->u.p.current_unit->flags.pad == PAD_NO)
- {
- /* Not enough data left. */
- generate_error (&dtp->common, ERROR_EOR, NULL);
- return;
- }
- }
-
- if (dtp->u.p.current_unit->bytes_left == 0)
- {
- dtp->u.p.current_unit->endfile = AT_ENDFILE;
- generate_error (&dtp->common, ERROR_END, NULL);
- return;
- }
-
- *nbytes = (size_t) dtp->u.p.current_unit->bytes_left;
+ generate_error (&dtp->common, ERROR_END, NULL);
+ return;
}
- if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED &&
- dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
+ nread = *nbytes;
+ if (sread (dtp->u.p.current_unit->s, buf, &nread) != 0)
{
- length = (int *) nbytes;
- data = read_sf (dtp, length, 0); /* Special case. */
- memcpy (buf, data, (size_t) *length);
+ generate_error (&dtp->common, ERROR_OS, NULL);
return;
}
- dtp->u.p.current_unit->bytes_left -= (gfc_offset) *nbytes;
+ dtp->u.p.current_unit->strm_pos += (gfc_offset) nread;
+
+ if (nread != *nbytes) /* Short read, e.g. if we hit EOF. */
+ generate_error (&dtp->common, ERROR_END, NULL);
+
+ return;
}
- else
+
+ /* Unformatted file with records */
+ if (dtp->u.p.current_unit->bytes_left < (gfc_offset) *nbytes)
{
- if (sseek (dtp->u.p.current_unit->s,
- dtp->u.p.current_unit->strm_pos - 1) == FAILURE)
+ short_record = 1;
+ nread = (size_t) dtp->u.p.current_unit->bytes_left;
+ *nbytes = nread;
+
+ if (dtp->u.p.current_unit->bytes_left == 0)
{
+ dtp->u.p.current_unit->endfile = AT_ENDFILE;
generate_error (&dtp->common, ERROR_END, NULL);
return;
}
}
- nread = *nbytes;
+ else
+ {
+ short_record = 0;
+ nread = *nbytes;
+ }
+
+ dtp->u.p.current_unit->bytes_left -= nread;
+
if (sread (dtp->u.p.current_unit->s, buf, &nread) != 0)
{
generate_error (&dtp->common, ERROR_OS, NULL);
return;
}
- if (!is_stream_io (dtp))
+ if (nread != *nbytes) /* Short read, e.g. if we hit EOF. */
{
- if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0)
- dtp->u.p.size_used += (gfc_offset) nread;
+ *nbytes = nread;
+ generate_error (&dtp->common, ERROR_END, NULL);
+ return;
}
- else
- dtp->u.p.current_unit->strm_pos += (gfc_offset) nread;
- if (nread != *nbytes) /* Short read, e.g. if we hit EOF. */
+ if (short_record)
{
- if (!is_stream_io (dtp))
- generate_error (&dtp->common, ERROR_EOR, NULL);
- else
- generate_error (&dtp->common, ERROR_END, NULL);
+ generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL);
+ return;
}
}
@@ -595,7 +586,8 @@ unformatted_read (st_parameter_dt *dtp, bt type,
/* By now, all complex variables have been split into their
constituent reals. For types with padding, we only need to
read kind bytes. We don't care about the contents
- of the padding. */
+ of the padding. If we hit a short record, then sz is
+ adjusted accordingly, making later reads no-ops. */
sz = kind;
for (i=0; i<nelems; i++)
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index e023f0ea26e..ff947655806 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -413,6 +413,7 @@ typedef enum
ERROR_INTERNAL_UNIT,
ERROR_ALLOCATION,
ERROR_DIRECT_EOR,
+ ERROR_SHORT_RECORD,
ERROR_LAST /* Not a real error, the last error # + 1. */
}
error_codes;
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index f8f76d3d26f..245e04e31c2 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -436,6 +436,10 @@ translate_error (int code)
p = "Write exceeds length of DIRECT access record";
break;
+ case ERROR_SHORT_RECORD:
+ p = "Short record on unformatted read";
+ break;
+
default:
p = "Unknown error code";
break;