Commit Graph

664 Commits

Author SHA1 Message Date
Jerry DeLisle 2bb6de3a7e re PR libfortran/32611 (Print sign of negative zero)
2007-07-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR fortran/32611
	* runtime/compile_options.c (set_std): Remove.
	(set_options): New function.
	(init_compile_options): Add initialization for -fsign-zero option.
	* gfortran.map (GFORTRAN_1.0): Rename _gfortran_set_std into
	_gfortran_set_options.
	* libgfortran.h (compile_options_t): Add sign_zero field.
	* io/write.c (output_float): Use the sign bit of the value to determine
	if a negative sign should be emitted for zero values.  Do not emit the
	negative sign for zero if -fno-sign-zero was set during compile.

Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>

From-SVN: r126654
2007-07-15 16:26:22 +00:00
Jerry DeLisle d40150cc3c re PR libfortran/32752 (Segfault on WRITE with modified unix_stream structure)
2007-07-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32752
	* io/unix.c (unix_stream): Move buffer pointer adjacent to small_buffer.
	* io/transfer.c (formatted_transfer_scalar): If stream I/O, set
	bytes_used to zero. Fix off by one error in calculation of pos and
	skips. Eliminate duplicate pending_spaces check.

From-SVN: r126652
2007-07-15 05:29:29 +00:00
Francois-Xavier Coudert 3705841503 re PR fortran/32357 (MVBITS gives wrong-code on big-endian with -fdefault-integer-8)
PR fortran/32357

	* iresolve.c (gfc_resolve_mvbits): Convert FROMPOS, LEN and TOPOS
	to C int.

	* intrinsics/mvbits.c: Change prototype so that FROMPOS, LEN and
	TOPOS arguments are C int.

	* gfortran.dg/mvbits_2.f90: New test.

From-SVN: r126646
2007-07-14 23:11:04 +00:00
Jerry DeLisle 899583cb40 re PR libfortran/32702 (crash when printing big character variable)
2007-07-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32702
	* io/unix.c (unix_stream): Restore buffer pointer and small_buffer.
	(fd_alloc): If the number of bytes needed is greater than the default
	BUFFER_SIZE, allocate a new buffer large enough.  Free the old buffer if
	necessary. (fd_sfree): Restore use of buffer pointer.
	(fd_close): Likewise. (fd_open): Likewise.
	(init_error_stream): Likewise.

From-SVN: r126510
2007-07-10 05:37:29 +00:00
Thomas Koenig 18c492a994 re PR libfortran/32336 (matmul: flag runtime- instead of assertation error)
2007-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32336
	* m4/matmul.m4:  When the dimension of b is incorrect,
	raise a runtime error instead of a failed assertion.
	* generated/matmul_i1.c:  Regenerated.
	* generated/matmul_i2.c:  Regenerated.
	* generated/matmul_i4.c:  Regenerated.
	* generated/matmul_i8.c:  Regenerated.
	* generated/matmul_i16.c:  Regenerated.
	* generated/matmul_r4.c:  Regenerated.
	* generated/matmul_r8.c:  Regenerated.
	* generated/matmul_r10.c:  Regenerated.
	* generated/matmul_r16.c:  Regenerated.

2007-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32336
	* gfortran.dg/matmul_5.f90:  New test case.

From-SVN: r126498
2007-07-09 22:34:43 +00:00
Jerry DeLisle 8d917a24a7 re PR fortran/32678 ([4.2, 4.1]GFortan works incorrectly when writing with FORMAT Tx)
2007-07-08  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32678
	* io/transfer.c (formatted_transfer_scalar): Don't allow pending_spaces
	to go negative.

From-SVN: r126473
2007-07-09 00:15:15 +00:00
Thomas Koenig fb263f821c re PR fortran/32217 (segfaults (at runtime) on UNPACK with zero-sized arrays)
2007-07-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32217
	* intrinsics/unpack_generic.c:  If the destination array is
	empty, return early.

2007-07-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32217
	* gfortran.dg/unpack_zerosize_1.f90:  New test case.

From-SVN: r126469
2007-07-08 22:20:04 +00:00
H.J. Lu 12a27363b0 Regenerate aclocal.m4 in boehm-gc, libffi, libgfortran, libgomp,
libjava, libmudflap, libobjc, libssp and zlib.

From-SVN: r126373
2007-07-05 10:54:10 -07:00
David Edelsohn 3d22e00109 configure.ac: SUBST CFLAGS.
* configure.ac: SUBST CFLAGS.
        * configure: Regenerate.

From-SVN: r126324
2007-07-04 12:20:13 -04:00
Janne Blomqvist db430f6a2a Fortran frontend:
2007-07-03  Janne Blomqvist  <jb@gcc.gnu.org>

	* trans-decl.c (gfc_build_builtin_function_decls): Mark
	internal_realloc as a malloc function.

libgfortran:

2007-07-03  Janne Blomqvist  <jb@gcc.gnu.org>

	* libgfortran.h: Mark internal_malloc_size as a malloc function.
	* runtime/memory.c (internal_realloc_size): Remove.
	(internal_realloc): Call realloc directly instead of
	internal_realloc_size.
	(allocate_size): Remove.
	(allocate): Call malloc directly instead of allocate_size, mark as
	malloc function.

From-SVN: r126264
2007-07-03 19:50:05 +03:00
Steven G. Kargl 8eacc23d94 [multiple changes]
2007-07-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	Restore collateral damage from ISO C Binding merge.

        2007-06-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32456
	* io/unit.c (filename_from_unit): Don't use find_unit, instead search
	for unit directly.

From-SVN: r126238
2007-07-02 23:29:27 +00:00
Steven G. Kargl f4e9e7fa00 Makefile.in: Regenerated with automake 1.9.6.
2007-07-02  Steven G. Kargl  <kargl@gcc.gnu.org>

        * Makefile.in:  Regenerated with automake 1.9.6.

From-SVN: r126232
2007-07-02 19:46:19 +00:00
Steven G. Kargl 0afff512bb Makefile.in: Remove extraneous kill.lo rule.
2007-07-02  Steven G. Kargl  <kargl@gcc.gnu.org>

        * Makefile.in:  Remove extraneous kill.lo rule.

From-SVN: r126220
2007-07-02 18:01:09 +00:00
Janne Blomqvist f6b55636d8 Forgot to delete these during yesterdays commit.
2007-07-02  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* generated/pow_r*_i4.c: Removed.

From-SVN: r126215
2007-07-02 19:21:37 +03:00
Christopher D. Rickett a8b3b0b633 [multiple changes]
2007-07-01  Christopher D. Rickett  <crickett@lanl.gov>

	* interface.c (gfc_compare_derived_types): Special case for comparing
	derived types across namespaces.
	(gfc_compare_types): Deal with BT_VOID.
	(compare_parameter): Use BT_VOID to accept ISO C Binding pointers.
	* trans-expr.c (gfc_conv_function_call): Remove setting parm_kind
	to SCALAR
	(gfc_conv_initializer): Deal with ISO C Binding NULL_PTR and 
	NULL_FUNPTR.
	(gfc_conv_expr): Convert expressions for ISO C Binding derived types.
	* symbol.c (gfc_set_default_type): BIND(C) variables should not be
	implicitly declared.
	(check_conflict): Add BIND(C) and check for conflicts.
	(gfc_add_explicit_interface): Whitespace.	
	(gfc_add_is_bind_c): New function.  
	(gfc_copy_attr): Use it.
	(gfc_new_symbol): Initialize ISO C Binding objects.
	(get_iso_c_binding_dt):  New function.
	(verify_bind_c_derived_type): Ditto.
	(gen_special_c_interop_ptr): Ditto.
	(add_formal_arg): Ditto.
	(gen_cptr_param): Ditto.
	(gen_fptr_param): Ditto.
	(gen_shape_param): Ditto.
	(add_proc_interface): Ditto.
	(build_formal_args): Ditto.
	(generate_isocbinding_symbol):  Ditto.
	(get_iso_c_sym):  Ditto.
	* decl.c (num_idents_on_line, has_name_equals): New variables.
	(verify_c_interop_param): New function.
	(build_sym): Finish binding labels and deal with COMMON blocks.
	(add_init_expr_to_sym): Check if the initialized expression is
	an iso_c_binding named constants
	(variable_decl): Set ISO C Binding type_spec components.
	(gfc_match_kind_spec): Check match for C interoperable kind.
	(match_char_spec): Fix comment. Chnage gfc_match_small_int
	to gfc_match_small_int_expr.  Check for C interoperable kind.
	(match_type_spec): Clear the current binding label.
	(match_attr_spec): Add DECL_IS_BIND_C.  If BIND(C) is found, use it
	to set attributes.
	(set_binding_label): New function.
	(set_com_block_bind_c): Ditto.
	(verify_c_interop): Ditto.
	(verify_com_block_vars_c_interop): Ditto.
	(verify_bind_c_sym): Ditto.
	(set_verify_bind_c_sym): Ditto.
	(set_verify_bind_c_com_block): Ditto.
	(get_bind_c_idents): Ditto.
	(gfc_match_bind_c_stmt): Ditto.
	(gfc_match_data_decl): Use num_idents_on_line.
	(match_result): Deal with right paren in BIND(C).
	(gfc_match_suffix): New function.
	(gfc_match_function_decl): Use it.  Code is re-arranged to deal with
	ISO C Binding result clauses.
	(gfc_match_subroutine):  Deal with BIND(C).
 	(gfc_match_bind_c): New function.
	(gfc_get_type_attr_spec): New function.  Code is re-arranged in and
	taken from gfc_match_derived_decl.
	(gfc_match_derived_decl): Add check for BIND(C).
	* trans-common.c: Forward declare gfc_get_common.
	(gfc_sym_mangled_common_id): Change arg from 'const char *name' to
	'gfc_common_head *com'.  Check for ISO C Binding of the common block.
	(build_common_decl): 'com->name' to 'com in SET_DECL_ASSEMBLER_NAME.
	* gfortran.h: Add GFC_MAX_BINDING_LABEL_LEN
	(bt): Add BT_VOID
	(sym_flavor): Add FL_VOID.
 	(iso_fortran_env_symbol, iso_c_binding_symbol, intmod_id): New enum
	(CInteropKind_t): New struct.
	(c_interop_kinds_table): Use it.  Declare an array of structs.
	(symbol_attribute): Add is_bind_c, is_c_interop, and is_iso_c
	bitfields.
	(gfc_typespec): Add is_c_interop; is_iso_c, and f90_type members.
	(gfc_symbol): Add from_intmod, intmod_sym_id, binding_label, and
	common_block members.
	(gfc_common_head): Add binding_label and is_bind_c members.
	(gfc_gsymbol): Add sym_name, mod_name, and binding_label members.
	Add prototypes for get_c_kind, gfc_validate_c_kind, 
	gfc_check_any_c_kind, gfc_add_is_bind_c, gfc_add_value,
	verify_c_interop, verify_c_interop_param, verify_bind_c_sym,
	verify_bind_c_derived_type, verify_com_block_vars_c_interop,
	generate_isocbinding_symbol, get_iso_c_sym, gfc_iso_c_sub_interface
	* iso-c-binding.def: New file. This file contains the definitions
	of the types provided by the Fortran 2003 ISO_C_BINDING intrinsic
	module.
	* trans-const.c (gfc_conv_constant_to_tree): Deal with C_NULL_PTR
	 or C_NULL_FUNPTR expressions.
	* expr.c (gfc_copy_expr): Add BT_VOID case.  For BT_CHARACTER, the
	ISO C Binding requires a minimum string length of 1 for '\0'.  
	* module.c (intmod_sym): New struct.
	(pointer_info): Add binding_label member.
	(write_atom): Set len to 0 for NULL pointers. Check for NULL p and *p.
	(ab_attribute): Add AB_IS_BIND_C, AB_IS_C_INTEROP and AB_IS_ISO_C.
	(attr_bits): Add "IS_BIND_C", "IS_C_INTEROP", and "IS_ISO_C".
	(mio_symbol_attribute): Deal with ISO C Binding attributes.
	(bt_types): Add "VOID".
	(mio_typespec): Deal with ISO C Binding components.
	(mio_namespace_ref): Add intmod variable. 
	(mio_symbol): Check for symbols from an intrinsic module.
	(load_commons): Check for BIND(C) common block.
	(read_module): Read binding_label and use it.
	(write_common): Add label.  Write BIND(C) info.
	(write_blank_common): Blank commons are not BIND(C).  Explicitly
	set is_bind_c=0.
	(write_symbol): Deal with binding_label.
	(sort_iso_c_rename_list): New function.
	(import_iso_c_binding_module): Ditto.
	(create_int_parameter): Add to args.
	(use_iso_fortran_env_module): Adjust to deal with iso_c_binding
	intrinsic module.
	* trans-types.c (c_interop_kinds_table): new array of structs. 
	(gfc_validate_c_kind): New function.
	(gfc_check_any_c_kind): Ditto.
	(get_real_kind_from_node): Ditto.
	(get_int_kind_from_node): Ditto.
	(get_int_kind_from_width): Ditto.
	(get_int_kind_from_minimal_width): Ditto.
	(init_c_interop_kinds): Ditto.
	(gfc_init_kinds): call init_c_interop_kinds.
	(gfc_typenode_for_spec): Adjust for BT_VOID and ISO C Binding pointers.
	Adjust handling of BT_DERIVED.
	(gfc_sym_type): Whitespace.
	(gfc_get_derived_type):  Account for iso_c_binding derived types
	* resolve.c (is_scalar_expr_ptr): New function.
	(gfc_iso_c_func_interface): Ditto.
	(resolve_function): Use gfc_iso_c_func_interface. 
	(set_name_and_label): New function.
	(gfc_iso_c_sub_interface): Ditto.
	(resolve_specific_s0): Use gfc_iso_c_sub_interface.
	(resolve_bind_c_comms): New function.
	(resolve_bind_c_derived_types): Ditto.
	(gfc_verify_binding_labels): Ditto.
	(resolve_fl_procedure): Check for ISO C interoperability.
	(resolve_symbol): Check C interoperability.
	(resolve_types): Walk the namespace.  Check COMMON blocks.
	* trans-decl.c (gfc_sym_mangled_identifier):  Prevent the mangling
	of identifiers that have an assigned binding label.
	(gfc_sym_mangled_function_id): Use the binding label rather than
	the mangled name.
	(gfc_finish_var_decl): Put variables that are BIND(C) into a common
	segment of the object file, because this is what C would do.
	(gfc_create_module_variable): Conver to proper types
	(set_tree_decl_type_code): New function.
	(generate_local_decl): Check dummy variables and derived types for
	ISO C Binding attributes.
	* match.c (gfc_match_small_int_expr): New function.
	(gfc_match_name_C): Ditto.
	(match_common_name): Deal with ISO C Binding in COMMON blocks
	* trans-io.c (transfer_expr):  Deal with C_NULL_PTR or C_NULL_FUNPTR
	expressions
	* match.h: Add prototypes for gfc_match_small_int_expr,
	gfc_match_name_C, match_common_name, set_com_block_bind_c,
	set_binding_label, set_verify_bind_c_sym,
	set_verify_bind_c_com_block, get_bind_c_idents,
	gfc_match_bind_c_stmt, gfc_match_suffix, gfc_match_bind_c,
	gfc_get_type_attr_spec
	* parse.c (decode_statement): Use gfc_match_bind_c_stmt
	(parse_derived): Init *derived_sym = NULL, and gfc_current_block
	later for valiadation.
	* primary.c (got_delim): Set ISO C Binding components of ts.
	(match_logical_constant): Ditto.
	(match_complex_constant): Ditto.
	(match_complex_constant): Ditto.
	(gfc_match_rvalue): Check for existence of at least one arg for
	C_LOC, C_FUNLOC, and C_ASSOCIATED.
	* misc.c (gfc_clear_ts): Clear ISO C Bindoing components in ts.
	(get_c_kind): New function.

2007-07-01  Christopher D. Rickett  <crickett@lanl.gov>

	* Makefile.in: Add support for iso_c_generated_procs.c and
	iso_c_binding.c.
	* Makefile.am: Ditto.
	* intrinsics/iso_c_generated_procs.c: New file containing helper
	functions.
	* intrinsics/iso_c_binding.c: Ditto.
	* intrinsics/iso_c_binding.h: New file
	* gfortran.map: Include the __iso_c_binding_c_* functions.
	* libgfortran.h: define GFC_NUM_RANK_BITS.

2007-06-23  Christopher D. Rickett  <crickett@lanl.gov>

	* bind_c_array_params.f03: New files for Fortran 2003 ISO C Binding.
	* bind_c_coms.f90: Ditto.
	* bind_c_coms_driver.c: Ditto.
	* bind_c_dts.f90: Ditto.
	* bind_c_dts_2.f03: Ditto.
	* bind_c_dts_2_driver.c: Ditto.
	* bind_c_dts_3.f03: Ditto.
	* bind_c_dts_4.f03: Ditto.
	* bind_c_dts_driver.c: Ditto.
	* bind_c_implicit_vars.f03: Ditto.
	* bind_c_procs.f03: Ditto.
	* bind_c_usage_2.f03: Ditto.
	* bind_c_usage_3.f03: Ditto.
	* bind_c_usage_5.f03: Ditto.
	* bind_c_usage_6.f03: Ditto.
	* bind_c_usage_7.f03: Ditto.
	* bind_c_vars.f90: Ditto.
	* bind_c_vars_driver.c: Ditto.
	* binding_c_table_15_1.f03: Ditto.
	* binding_label_tests.f03: Ditto.
	* binding_label_tests_10.f03: Ditto.
	* binding_label_tests_10_main.f03: Ditto.
	* binding_label_tests_11.f03: Ditto.
	* binding_label_tests_11_main.f03: Ditto.
	* binding_label_tests_12.f03: Ditto.
	* binding_label_tests_13.f03: Ditto.
	* binding_label_tests_13_main.f03: Ditto.
	* binding_label_tests_14.f03: Ditto.
	* binding_label_tests_2.f03: Ditto.
	* binding_label_tests_3.f03: Ditto.
	* binding_label_tests_4.f03: Ditto.
	* binding_label_tests_5.f03: Ditto.
	* binding_label_tests_6.f03: Ditto.
	* binding_label_tests_7.f03: Ditto.
	* binding_label_tests_8.f03: Ditto.
	* binding_label_tests_9.f03: Ditto.
	* c_assoc.f90: Ditto.
	* c_assoc_2.f03: Ditto.
	* c_f_pointer_shape_test.f90: Ditto.
	* c_f_pointer_tests.f90: Ditto.
	* c_f_tests_driver.c: Ditto.
	* c_funloc_tests.f03: Ditto.
	* c_funloc_tests_2.f03: Ditto.
	* c_funloc_tests_3.f03: Ditto.
	* c_funloc_tests_3_funcs.c: Ditto.
	* c_kind_params.f90: Ditto.
	* c_kind_tests_2.f03: Ditto.
	* c_kinds.c: Ditto.
	* c_loc_driver.c: Ditto.
	* c_loc_test.f90: Ditto.
	* c_loc_tests_2.f03: Ditto.
	* c_loc_tests_2_funcs.c: Ditto.
	* c_loc_tests_3.f03: Ditto.
	* c_loc_tests_4.f03: Ditto.
	* c_loc_tests_5.f03: Ditto.
	* c_loc_tests_6.f03: Ditto.
	* c_loc_tests_7.f03: Ditto.
	* c_loc_tests_8.f03: Ditto.
	* c_ptr_tests.f03: Ditto.
	* c_ptr_tests_10.f03: Ditto.
	* c_ptr_tests_5.f03: Ditto.
	* c_ptr_tests_7.f03: Ditto.
	* c_ptr_tests_7_driver.c: Ditto.
	* c_ptr_tests_8.f03: Ditto.
	* c_ptr_tests_8_funcs.c: Ditto.
	* c_ptr_tests_9.f03: Ditto.
	* c_ptr_tests_driver.c: Ditto.
	* c_size_t_driver.c: Ditto.
	* c_size_t_test.f03: Ditto.
	* com_block_driver.f90: Ditto.
	* global_vars_c_init.f90: Ditto.
	* global_vars_c_init_driver.c: Ditto.
	* global_vars_f90_init.f90: Ditto.
	* global_vars_f90_init_driver.c: Ditto.
	* interop_params.f03: Ditto.
	* iso_c_binding_only.f03: Ditto.
	* iso_c_binding_rename_1.f03: Ditto.
	* iso_c_binding_rename_1_driver.c: Ditto.
	* iso_c_binding_rename_2.f03: Ditto.
	* iso_c_binding_rename_2_driver.c: Ditto.
	* kind_tests_2.f03: Ditto.
	* kind_tests_3.f03: Ditto.
	* module_md5_1.f90: Ditto.
	* only_clause_main.c: Ditto.
	* print_c_kinds.f90: Ditto.
	* test_bind_c_parens.f03: Ditto.
	* test_c_assoc.c: Ditto.
	* test_com_block.f90: Ditto.
	* test_common_binding_labels.f03: Ditto.
	* test_common_binding_labels_2.f03: Ditto.
	* test_common_binding_labels_2_main.f03: Ditto.
	* test_common_binding_labels_3.f03: Ditto.
	* test_common_binding_labels_3_main.f03: Ditto.
	* test_only_clause.f90: Ditto.
	* use_iso_c_binding.f90: Ditto.
	* value_5.f90: Ditto.
	* value_test.f90: Ditto.
	* value_tests_f03.f90: Ditto.

From-SVN: r126185
2007-07-02 02:47:21 +00:00
Janne Blomqvist 31c97dfe34 re PR fortran/32239 (optimize power in loops, use __builtin_powi instead of _gfortran_pow_r4_i4)
gcc/fortran:
	
2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* trans-expr.c (gfc_conv_power_op): Use builtin_powi for
	real**int4 powers.
	* f95-lang.c (gfc_init_builtin_functions): Add builtin_powi to the
	builtins table.

	
libgfortran:
	
2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* Makefile.am: Don't generate real**int4 pow functions.
	* gfortran.map: Remove real**int4 pow symbols.
	* Makefile.in: Regenerated.

testsuite

2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90
	(test_4): Use proper test for floating point equality.
	(test_8): Likewise.

From-SVN: r126175
2007-07-01 19:24:38 +03:00
Jerry DeLisle c767280aa7 re PR fortran/32554 ([4.2 Only] Bug in P formatting)
2007-07-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32554
	* io/write.c (output_float): Set edigits to a fixed size, avoiding
	variation in field width calculation and eliminate buffer overrun.

From-SVN: r126173
2007-07-01 15:46:33 +00:00
Janne Blomqvist a6bd380438 fortran frontend:
2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	* trans.h: Remove decls for 64-bit allocation functions.
	* trans-array.c (gfc_grow_array): Always pick the standard realloc
	function decl.
	(gfc_array_allocate): Likewise.
	* trans-decl.c: Remove trees for 64-bit allocation functions.
	(gfc_build_builtin_function_decls): Don't build fndecls for 64-bit
	allocations functions, use index_int_type for normal allocation
	functions.

libgfortran changelog:

2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	* runtime/memory.c (internal_realloc): Use index_type for size
	argument instead of GFC_INTEGER_4.
	(allocate_array): Likewise.
	(allocate): Likewise, add ifdef around unnecessary check.
	(internal_reallo64): Remove.
	(allocate_array64): Remove.
	(allocate64): Remove.
	* gfortran.map: Remove symbols for 64-bit allocation functions.

From-SVN: r126166
2007-07-01 15:08:59 +03:00
Jerry DeLisle d1d92e95d2 re PR libfortran/32456 (IO error message should show Unit/Filename)
2007-06-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32456
	* io/unit.c (filename_from_unit): Don't use find_unit, instead search
	for unit directly.

From-SVN: r126119
2007-06-29 19:39:21 +00:00
Adam Nemet c861db6620 re PR libfortran/32495 (static declaration of 'strcasestr' follows non-static declaration)
PR libfortran/32495
	* runtime/backtrace.c (local_strcasestr): Rename from strcasestr.
	(show_backtrace): Rename strcasestr to local_strcasestr.

From-SVN: r125998
2007-06-25 17:21:46 +00:00
Jerry DeLisle 87557722c8 re PR libfortran/32456 (IO error message should show Unit/Filename)
2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32456
	* runtime/error.c (show_locus): Update to emit the unit number
	and file name involved with the error.  Use new function
	filename_from_unit.
	* libgfortran.h (filename_from_unit): Declare new function.
	* io/unit.c (init_units): Set the unit file name for stdin, stdout,
	and stderr for use later in error reporting.
	(filename_from_unit): Add this new function.

From-SVN: r125989
2007-06-24 22:56:21 +00:00
Jerry DeLisle 69774e69a7 re PR fortran/32446 (F0.n output format fails with large numbers)
2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32446
	* io/write.c (output_float): Calculate ndigits correctly for large
	numbered formats that must pad zeros before the decimal point.

From-SVN: r125985
2007-06-24 18:54:50 +00:00
Rainer Orth bec38225d5 re PR libfortran/32345 (Unconditional snprintf use breaks all gfortran exec tests on Tru64 UNIX V4.0F)
PR libfortran/32345
	* runtime/backtrace.c (show_backtrace): Only use snprintf if
	available.

From-SVN: r125739
2007-06-15 10:26:16 +00:00
Jerry DeLisle 82fa3fc0d3 re PR fortran/32235 (incorrectly position text file after backspace)
2007-06-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32235
	* io/transfer.c (st_read): Remove test for end of file condition.
	(next_record_r): Add test for end of file condition.

From-SVN: r125606
2007-06-10 22:50:47 +00:00
Paolo Bonzini 82a6cadf50 configure: Regenerate.
boehm-gc:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libffi:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libgfortran:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libgomp:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libjava:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libmudflap:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libobjc:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libssp:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

libstdc++-v3:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

zlib:
2007-06-02  Paolo Bonzini  <bonzini@gnu.org>

	* configure: Regenerate.

From-SVN: r125278
2007-06-02 08:18:15 +00:00
Tobias Burnus 3078848ea3 re PR fortran/32124 (Execution stops with stat= in ALLOCATE)
2007-05-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/32124
	* runtime/memory.c (allocate_size): Use ERROR_ALLOCATION.
	(allocate,allocate64): Use stat variable if present.

From-SVN: r125133
2007-05-28 18:39:35 +02:00
Janne Blomqvist 88fdfd5a86 string.c (compare0): Use gfc_charlen_type instead of int.
2007-05-27  Janne Blomqvist  <jb@gcc.gnu.org>

	* runtime/string.c (compare0): Use gfc_charlen_type instead of int.
	(fstrlen): Likewise.
	(find_option): Likewise.
	(fstrcpy): Use gfc_charlen_type instead of int, return length.
	(cf_strcpy): Likewise.
	* libgfortran.h: Change string prototypes to use gfc_charlen_type.
	* io/open.c (new_unit): Use snprintf if available.
	* io/list_read.c (nml_touch_nodes): Use memcpy instead of strcpy/strcat.
	(nml_read_obj): Likewise.
	* io/transfer.c (st_set_nml_var): Likewise.
	* io/write.c (output_float): Use snprintf if available.
	(nml_write_obj) Use memcpy instead of strcpy/strcat.

From-SVN: r125100
2007-05-27 00:15:22 +03:00
Janne Blomqvist c132497f1b unix.c (unix_stream): Rearrange struct members, remove small_buffer.
2007-05-26  Janne Blomqvist  <jb@gcc.gnu.org>

	* io/unix.c (unix_stream): Rearrange struct members, remove
	small_buffer.
	(int_stream): New struct.
	(fd_alloc): Always use existing buffer, never reallocate.
	(fd_sfree): Remove check for buffer != small_buffer.
	(fd_close): Likewise.
	(mem_alloc_r_at): Change to use int_stream.
	(mem_alloc_w_at): Likewise.
	(mem_read): Likewise.
	(mem_write): Likewise.
	(mem_set): Likewise.
	(mem_truncate): Likewise.
	(mem_close): Likewise.
	(mem_sfree): Likewise.
	(empty_internal_buffer): Likewise.
	(open_internal): Likewise.

From-SVN: r125099
2007-05-26 23:50:21 +03:00
Jerry DeLisle 853c0ad7f0 transfer.c (unformatted_read): Use size from front end eliminating use of size_from_real_kind.
2007-05-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/transfer.c (unformatted_read): Use size from front end eliminating
	use of size_from_real_kind. (unformatted_write): Ditto.

From-SVN: r125064
2007-05-25 17:41:17 +00:00
Steve Ellcey 1cf3d07da6 ltmain.sh: Update from ToT Libtool.
* ltmain.sh: Update from ToT Libtool.
        * libtool.m4: Update from ToT Libtool.
        * ltsugar.m4: New. Update from ToT Libtool.
        * ltversion.m4: New. Update from ToT Libtool.
        * ltoptions.m4: New. Update from ToT Libtool.
        * ltconfig: Remove.
        * ltcf-c.sh: Remove.
        * ltcf-cxx.sh: Remove.
        * ltcf-gcj.sh: Remove.
	* Regenerate all subdirs

From-SVN: r125032
2007-05-24 16:37:27 +00:00
Tobias Burnus 6b12f000e0 libgfortran.h: Mark stop_numeric as noreturn.
2007-05-22  Tobias Burnus  <burnus@net-b.de>

       * libgfortran.h: Mark stop_numeric as noreturn.

From-SVN: r124962
2007-05-22 22:55:53 +02:00
Tobias Burnus 1f801ab788 re PR libfortran/31295 (Uninitialized variable in libgfortran's _gfortran_eoshift0_4)
2007-05-22  Tobias Burnus  <burnus@net-b.de>

       PR libgfortran/31295
       * intrinsics/eoshift0.c (eoshift0): Silence uninitialized warning.
       * intrinsics/eoshift2.c (eoshift2): Ditto.

From-SVN: r124948
2007-05-22 18:19:09 +02:00
Jerry DeLisle c152efbb10 re PR fortran/31964 ([4.2, 4.1 only]ishftc fails with certain thrid argument)
2007-05-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31964
	* intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
	shift of bit-size number of bits.

From-SVN: r124846
2007-05-19 01:04:03 +00:00
Tobias Burnus 2d24f24b97 re PR fortran/31917 ([4.1 only] GFORTRAN_CONVERT_UNIT is ignored)
2007-05-14  Tobias Burnus <burnus@net-b.de>

        PR fortran/31917
        * runtime/environ.c (mark_range): Fix setting default convert unit.

From-SVN: r124787
2007-05-17 10:39:32 +02:00
Jerry DeLisle d5638e6e67 re PR fortran/31922 ([4.2 only] Accessing uninitialized variable for print *, trim(blank_string))
2007-05-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31922
	* intrinsics/string_intrinsics.c (string_trim): Set result to null if
	string length is zero.

From-SVN: r124754
2007-05-16 00:37:55 +00:00
Tobias Burnus 80bcbc8044 re PR libfortran/31915 (Failure with unf_io_convert_3.f90)
2007-05-15  Tobias Burnus  <burnus@net-b.de>

        PR libfortran/31915
        * io/transfer.c (unformatted_read): Use proper size for real(10).
          (unformatted_write): Ditto.

From-SVN: r124741
2007-05-15 12:16:46 +02:00
Francois-Xavier Coudert 1529b8d9be re PR fortran/30723 (Freeing memory doesn't need to call a library function)
PR fortran/30723

	* trans.h (gfor_fndecl_internal_malloc, gfor_fndecl_internal_malloc64,
	gfor_fndecl_internal_free): Remove prototypes.
	(gfor_fndecl_os_error, gfc_call_free, gfc_call_malloc): Add prototypes.
	* trans.c (gfc_call_malloc, gfc_call_free): New functions.
	* f95-lang.c (gfc_init_builtin_functions): Add __builtin_free
	and __builtin_malloc builtins.
	* trans-decl.c (gfor_fndecl_internal_malloc,
	gfor_fndecl_internal_malloc64, gfor_fndecl_internal_free): Remove.
	(gfor_fndecl_os_error): Add.
	(gfc_build_builtin_function_decls): Don't create internal_malloc,
	internal_malloc64 and internal_free library function declaration.
	Create os_error library call function declaration.
	* trans-array.c (gfc_trans_allocate_array_storage,
	gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
	gfc_conv_array_parameter, gfc_duplicate_allocatable): Use
	gfc_call_malloc and gfc_call_free instead of building calls to
	internal_malloc and internal_free.
	* trans-expr.c (gfc_conv_string_tmp): Likewise.
	* trans-stmt.c (gfc_do_allocate, gfc_trans_assign_need_temp,
	gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1,
	gfc_trans_where_2: Likewise.
	* trans-intrinsic.c (gfc_conv_intrinsic_ctime,
	gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam,
	gfc_conv_intrinsic_array_transfer, gfc_conv_intrinsic_trim): Likewise.

	* runtime/memory.c (internal_malloc, internal_malloc64,
	internal_free): Remove.
	* runtime/error.c (os_error): Export function.
	* intrinsics/move_alloc.c: Include stdlib.h.
	(move_alloc): Call free instead of internal_free.
	(move_alloc_c): Wrap long lines.
	* libgfortran.h (os_error): Export prototype.
	(internal_free): Remove prototype.
	* gfortran.map (GFORTRAN_1.0): Remove _gfortran_internal_free,
	_gfortran_internal_malloc and _gfortran_internal_malloc64.
	Add _gfortran_os_error.

From-SVN: r124721
2007-05-14 19:33:57 +00:00
Jerry DeLisle d5f9d0802c re PR libfortran/31880 ([4.2 only] silent data corruption in gfortran read statement)
2007-05-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31880
	* io/unix.c (fd_alloc_r_at): Fix calculation of physical offset.

From-SVN: r124588
2007-05-10 01:01:27 +00:00
Francois-Xavier Coudert 25a5e75613 re PR libfortran/31607 (CALL SYSTEM produces garbled output when writing to a buffered file)
PR libfortran/31607
	* intrinsics/system.c (system_sub): Call flush_all_units.
	* io/io.h (flush_all_units): Move prototype to libgfortran.h.
	* libgfortran.h (flush_all_units): Add prototype.

From-SVN: r124510
2007-05-07 19:48:40 +00:00
Jerry DeLisle cb13c28858 re PR fortran/31201 (Too large unit number generates wrong code)
2007-05-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31201
	* runtime/error.c (runtime_error_at): New function.
	(generate_error): Export this function.
	* gfortran.map: Add _gfortran_generate_error and
	_gfortran_runtime_error_at.
	* libgfortran.h: Add comment to reference error codes in front end.
	(library_start): Locate prototype with library_end macro and add
	a new comment.  Add prototype for runtime_error_at. Export prototype for
	generate_error.
	* io/lock.c (library_start): Fix check for error condition.
	* io/transfer.c (data_transfer_init): Add library check.

From-SVN: r124479
2007-05-06 22:28:31 +00:00
Daniel Franke 134b401077 Fix typo in PR numbers 22539 <> 22359.
From-SVN: r124441
2007-05-04 14:21:48 -04:00
Daniel Franke dcdc26dfd5 re PR target/22539 (Internal compiler error with maximum sized array)
gcc/fortran:
2007-05-04  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/22539
	* intrinsic.c (add_subroutines): Added FSEEK.
	* intrinsic.h (gfc_resolve_fseek_sub, gfc_check_fseek_sub): New.
	* iresolve.c (gfc_resolve_fseek_sub): New.
	* check.c (gfc_check_fseek_sub): New.
	* intrinsic.texi (FSEEK): Updated.

gcc/testsuite:
2007-05-01  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/22539
	* gfortran.dg/fseek.f90: New test.

libgfortran:
2007-05-04  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/22539
	* io/intrinsics.c (fseek_sub): New.
	* io/unix.c (fd_fseek): Change logical and physical offsets only
	if seek succeeds.
	* gfortran.map (fseek_sub): New.

From-SVN: r124437
2007-05-04 14:02:18 -04:00
Francois-Xavier Coudert e50443368c re PR libfortran/31210 (I/O of string with (non-constant) zero length)
PR libfortran/31210
	* io/transfer.c (transfer_character): Avoid passing a NULL
	pointer as source to the transfer routines, if the string length
	is zero.

From-SVN: r124428
2007-05-04 15:14:07 +00:00
Jerry DeLisle d10fb73e91 re PR libfortran/31501 (libgfortran internal unit I/O performance issues)
2007-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31501
	* io/list_read.c (next_char): Fix whitespace.
	* io/io.h: Remove prototypes and define macros for is_array_io,
	is_stream_io, and is_internal_unit.
	* io/unit.c (is_array_io), (is_internal_unit), (is_stream_io): Delete
	these functions.
	* io/transfer.c (read_sf): Change handling of internal_unit to make a
	single call to salloc_r and use memcpy to transfer the data.

From-SVN: r124266
2007-04-28 23:23:35 +00:00
Jerry DeLisle 16d962d92c re PR libfortran/31532 (INQUIRE(...,POSITION=...) not standard conforming)
2007-04-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31532
	* io/file_pos.c (st_backspace): Set flags.position for end of file
	condition and use new function update_position.
	(st_endfile): Use new function update_position.
	* io/io.h: Add prototype for new function.
	* io/inquire.c (inquire_via_unit): If not direct access, set NEXTREC
	to zero.
	* io/unit.c (update_position): New function to update position info
	used by inquire.
	* io/transfer.c (next_record): Fix typo and use new function.

From-SVN: r124252
2007-04-28 02:03:21 +00:00
François-Xavier Coudert 6422c11230 re PR libfortran/31299 (Use getpwuid(geteuid()) instead of getlogin() for GETLOG())
PR libfortran/31299
	* intrinsics/getlog.c: Use getpwuid and geteuid instead of
	getlogin if they are available.
	* configure.ac: Add checks for getpwuid and geteuid.
	* configure: Regenerate.
	* config.h.in: Regenerate.

From-SVN: r124143
2007-04-25 07:36:20 +00:00
Janne Blomqvist 78511f8b0d configure: Regenerate using autoconf 2.59.
2007-04-25  Janne Blomqvist  <jb@gcc.gnu.org>

	* configure: Regenerate using autoconf 2.59.
	* Makefile.in: Likewise.  
	* config.h.in: Likewise.

From-SVN: r124142
2007-04-25 10:25:09 +03:00
Janne Blomqvist c0e7e2bf13 re PR libfortran/27740 (libgfortran should use versioned symbols)
2007-04-24  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/27740
	* configure.ac: New test to determine if symbol versioning is
	supported.
	* Makefile.am: Use result of above test to add appropriate linker
	flags.
	* gfortran.map: New file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* config.h.in: Regenerated.

From-SVN: r124098
2007-04-24 12:08:52 +03:00
Thomas Koenig e08e57d0c5 re PR fortran/31618 ([4.2, 4.1 only] backspace intrinsic is not working on an unformatted file)
2007-04-23  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/31618
	* io/transfer.c (read_block_direct):  Instead of calling us_read,
	set dtp->u.p.current_unit->current_record = 0 so that pre_position
	will read the record marker.
	(data_transfer_init):  For different error conditions, call
	generate_error, then return.

2007-04-23  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/31618
	* gfortran.dg/backspace_8.f:  New test case.

From-SVN: r124079
2007-04-23 19:43:54 +00:00
Francois-Xavier Coudert a777d6e967 main.c (please_free_exe_path_when_done): New variable.
* runtime/main.c (please_free_exe_path_when_done): New variable.
	(store_exe_path): Initialize character buffer, and mark whether
	exe_path should be free'd by the library destructor function.
	(cleanup): Only free exe_path if needed.

From-SVN: r123969
2007-04-19 11:01:15 +00:00