Commit Graph

2097 Commits

Author SHA1 Message Date
GCC Administrator
14870c1f86 Daily bump. 2024-10-08 00:19:04 +00:00
Thomas Koenig
c0002a675a Implement MAXLOC and MINLOC for unsigned.
gcc/fortran/ChangeLog:

	* check.cc (gfc_check_minloc_maxloc): Handle BT_UNSIGNED.
	* trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Likewise.
	* gfortran.texi: Document MAXLOC and MINLOC for UNSIGNED.

libgfortran/ChangeLog:

	* Makefile.am: Add files for unsigned MINLOC and MAXLOC.
	* Makefile.in: Regenerated.
	* gfortran.map: Add files for unsigned MINLOC and MAXLOC.
	* generated/maxloc0_16_m1.c: New file.
	* generated/maxloc0_16_m16.c: New file.
	* generated/maxloc0_16_m2.c: New file.
	* generated/maxloc0_16_m4.c: New file.
	* generated/maxloc0_16_m8.c: New file.
	* generated/maxloc0_4_m1.c: New file.
	* generated/maxloc0_4_m16.c: New file.
	* generated/maxloc0_4_m2.c: New file.
	* generated/maxloc0_4_m4.c: New file.
	* generated/maxloc0_4_m8.c: New file.
	* generated/maxloc0_8_m1.c: New file.
	* generated/maxloc0_8_m16.c: New file.
	* generated/maxloc0_8_m2.c: New file.
	* generated/maxloc0_8_m4.c: New file.
	* generated/maxloc0_8_m8.c: New file.
	* generated/maxloc1_16_m1.c: New file.
	* generated/maxloc1_16_m2.c: New file.
	* generated/maxloc1_16_m4.c: New file.
	* generated/maxloc1_16_m8.c: New file.
	* generated/maxloc1_4_m1.c: New file.
	* generated/maxloc1_4_m16.c: New file.
	* generated/maxloc1_4_m2.c: New file.
	* generated/maxloc1_4_m4.c: New file.
	* generated/maxloc1_4_m8.c: New file.
	* generated/maxloc1_8_m1.c: New file.
	* generated/maxloc1_8_m16.c: New file.
	* generated/maxloc1_8_m2.c: New file.
	* generated/maxloc1_8_m4.c: New file.
	* generated/maxloc1_8_m8.c: New file.
	* generated/minloc0_16_m1.c: New file.
	* generated/minloc0_16_m16.c: New file.
	* generated/minloc0_16_m2.c: New file.
	* generated/minloc0_16_m4.c: New file.
	* generated/minloc0_16_m8.c: New file.
	* generated/minloc0_4_m1.c: New file.
	* generated/minloc0_4_m16.c: New file.
	* generated/minloc0_4_m2.c: New file.
	* generated/minloc0_4_m4.c: New file.
	* generated/minloc0_4_m8.c: New file.
	* generated/minloc0_8_m1.c: New file.
	* generated/minloc0_8_m16.c: New file.
	* generated/minloc0_8_m2.c: New file.
	* generated/minloc0_8_m4.c: New file.
	* generated/minloc0_8_m8.c: New file.
	* generated/minloc1_16_m1.c: New file.
	* generated/minloc1_16_m16.c: New file.
	* generated/minloc1_16_m2.c: New file.
	* generated/minloc1_16_m4.c: New file.
	* generated/minloc1_16_m8.c: New file.
	* generated/minloc1_4_m1.c: New file.
	* generated/minloc1_4_m16.c: New file.
	* generated/minloc1_4_m2.c: New file.
	* generated/minloc1_4_m4.c: New file.
	* generated/minloc1_4_m8.c: New file.
	* generated/minloc1_8_m1.c: New file.
	* generated/minloc1_8_m16.c: New file.
	* generated/minloc1_8_m2.c: New file.
	* generated/minloc1_8_m4.c: New file.
	* generated/minloc1_8_m8.c: New file.

gcc/testsuite/ChangeLog:

	* gfortran.dg/unsigned_35.f90: New test.
2024-10-07 20:40:44 +02:00
GCC Administrator
60f1feded2 Daily bump. 2024-10-02 00:17:48 +00:00
Thomas Koenig
9dd9a06940 Implement MAXVAL and MINVAL for UNSIGNED.
gcc/fortran/ChangeLog:

	* check.cc (int_or_real_or_char_or_unsigned_check_f2003): New function.
	(gfc_check_minval_maxval): Use it.
	* trans-intrinsic.cc (gfc_conv_intrinsic_minmaxval): Handle
	initial values for UNSIGNED.
	* gfortran.texi: Document MINVAL and MAXVAL for unsigned.

libgfortran/ChangeLog:

	* Makefile.am: Add minval and maxval files.
	* Makefile.in: Regenerated.
	* gfortran.map: Add new functions.
	* generated/maxval_m1.c: New file.
	* generated/maxval_m16.c: New file.
	* generated/maxval_m2.c: New file.
	* generated/maxval_m4.c: New file.
	* generated/maxval_m8.c: New file.
	* generated/minval_m1.c: New file.
	* generated/minval_m16.c: New file.
	* generated/minval_m2.c: New file.
	* generated/minval_m4.c: New file.
	* generated/minval_m8.c: New file.

gcc/testsuite/ChangeLog:

	* gfortran.dg/unsigned_34.f90: New test.
2024-10-01 18:42:37 +02:00
GCC Administrator
2d8392c4e7 Daily bump. 2024-09-25 00:18:47 +00:00
Thomas Koenig
291e20e860 Add random numbers and fix some bugs.
This patch adds random number support for UNSIGNED, plus fixes
two bugs, with array I/O where the type used to be set to BT_INTEGER,
and for division with the divisor being a constant.

gcc/fortran/ChangeLog:

	* check.cc (gfc_check_random_number): Adjust for unsigned.
	* iresolve.cc (gfc_resolve_random_number): Handle unsigned.
	* trans-expr.cc (gfc_conv_expr_op): Handle BT_UNSIGNED for divide.
	* trans-types.cc (gfc_get_dtype_rank_type): Handle BT_UNSIGNED.
	* gfortran.texi: Add RANDOM_NUMBER for UNSIGNED.

libgfortran/ChangeLog:

	* gfortran.map: Add _gfortran_random_m1, _gfortran_random_m2,
	_gfortran_random_m4, _gfortran_random_m8 and _gfortran_random_m16.
	* intrinsics/random.c (random_m1): New function.
	(random_m2): New function.
	(random_m4): New function.
	(random_m8): New function.
	(random_m16): New function.
	(arandom_m1): New function.
	(arandom_m2): New function.
	(arandom_m4): New function.
	(arandom_m8): New funciton.
	(arandom_m16): New function.

gcc/testsuite/ChangeLog:

	* gfortran.dg/unsigned_30.f90: New test.
2024-09-24 22:57:42 +02:00
Thomas Koenig
5e918a4db9 Implement SUM and PRODUCT for unsigned.
gcc/fortran/ChangeLog:

	* gfortran.texi: Document SUM and PRODUCT.
	* iresolve.cc (resolve_transformational): New argument,
	use_integer, to translate calls to unsigned to calls to
	integer.
	(gfc_resolve_product): Use it
	(gfc_resolve_sum): Use it.
	* simplify.cc (init_result_expr): Handle BT_UNSIGNED.

libgfortran/ChangeLog:

	* generated/product_c10.c: Regenerated.
	* generated/product_c16.c: Regenerated.
	* generated/product_c17.c: Regenerated.
	* generated/product_c4.c: Regenerated.
	* generated/product_c8.c: Regenerated.
	* generated/product_i1.c: Regenerated.
	* generated/product_i16.c: Regenerated.
	* generated/product_i2.c: Regenerated.
	* generated/product_i4.c: Regenerated.
	* generated/product_i8.c: Regenarated.
	* generated/product_r10.c: Regenerated.
	* generated/product_r16.c: Regenerated.
	* generated/product_r17.c: Regenerated.
	* generated/product_r4.c: Regenerated.
	* generated/product_r8.c: Regenarated.
	* generated/sum_c10.c: Regenerated.
	* generated/sum_c16.c: Regenerated.
	* generated/sum_c17.c: Regenerated.
	* generated/sum_c4.c: Regenerated.
	* generated/sum_c8.c: Regenerated.
	* generated/sum_i1.c: Regenerated.
	* generated/sum_i16.c: Regenerated.
	* generated/sum_i2.c: Regenerated.
	* generated/sum_i4.c: Regenerated.
	* generated/sum_i8.c: Regenerated.
	* generated/sum_r10.c: Regenerated.
	* generated/sum_r16.c: Regenerated.
	* generated/sum_r17.c: Regenerated.
	* generated/sum_r4.c: Regenerated.
	* generated/sum_r8.c: Regenerated.
	* m4/ifunction.m4: Whitespace fix.
	* m4/product.m4: If type is integer, change to unsigned.
	* m4/sum.m4: Likewise.
2024-09-24 21:59:10 +02:00
Thomas Koenig
5d98fe096b Implement MATMUL and DOT_PRODUCT for unsigned.
gcc/fortran/ChangeLog:

	* arith.cc (gfc_arith_uminus): Fix warning.
	(gfc_arith_minus): Correctly truncate unsigneds.
	* check.cc (gfc_check_dot_product): Handle unsigned arguments.
	(gfc_check_matmul): Likewise.
	* expr.cc (gfc_get_unsigned_expr): New function.
	* gfortran.h (gfc_get_unsigned_expr): Add prototype.
	* iresolve.cc (gfc_resolve_matmul): If using UNSIGNED, use the
	signed integer version.
	* gfortran.texi: Document MATMUL and DOT_PRODUCT for unsigned.
	* simplify.cc (compute_dot_product): Handle unsigneds.

libgfortran/ChangeLog:

	* m4/iparm.m4: Add UNSIGED if type is m.
	* m4/matmul.m4: If type is GFC_INTEGER, use GFC_UINTEGER instead.
	Whitespace fixes.
	* m4/matmul_internal.m4: Whitespace fixes.

	* generated/matmul_c10.c: Regenerated.
	* generated/matmul_c16.c: Regenerated.
	* generated/matmul_c17.c: Regenerated.
	* generated/matmul_c4.c: Regenerated.
	* generated/matmul_c8.c: Regeneraated.
	* generated/matmul_i1.c: Regenerated.
	* generated/matmul_i16.c: Regenerated.
	* generated/matmul_i2.c: Regenerated.
	* generated/matmul_i4.c: Regenerated.
	* generated/matmul_i8.c: Regenerated.
	* generated/matmul_r10.c: Regenerated.
	* generated/matmul_r16.c: Regenerated.
	* generated/matmul_r17.c: Regenerated.
	* generated/matmul_r4.c: Regenerated.
	* generated/matmul_r8.c: Regenerated.
	* libgfortran.h: Add array types for unsiged.

gcc/testsuite/ChangeLog:

	* gfortran.dg/unsigned_25.f90: New test.
	* gfortran.dg/unsigned_26.f90: New test.
2024-09-24 21:51:42 +02:00
GCC Administrator
bfb9105ffb Daily bump. 2024-09-08 00:17:46 +00:00
Thomas Koenig
113a6da9bf Implement first part of unsigned integers for Fortran.
gcc/fortran/ChangeLog:

	* arith.cc (gfc_reduce_unsigned): New function.
	(gfc_arith_error): Add ARITH_UNSIGNED_TRUNCATED and
	ARITH_UNSIGNED_NEGATIVE.
	(gfc_arith_init_1): Initialize unsigned types.
	(gfc_check_unsigned_range): New function.
	(gfc_range_check): Handle unsigned types.
	(gfc_arith_uminus): Likewise.
	(gfc_arith_plus): Likewise.
	(gfc_arith_minus): Likewise.
	(gfc_arith_times): Likewise.
	(gfc_arith_divide): Likewise.
	(gfc_compare_expr): Likewise.
	(eval_intrinsic): Likewise.
	(gfc_int2int): Also convert unsigned.
	(gfc_uint2uint): New function.
	(gfc_int2uint): New function.
	(gfc_uint2int): New function.
	(gfc_uint2real): New function.
	(gfc_uint2complex): New function.
	(gfc_real2uint): New function.
	(gfc_complex2uint): New function.
	(gfc_log2uint): New function.
	(gfc_uint2log): New function.
	* arith.h (gfc_int2uint, gfc_uint2uint, gfc_uint2int, gfc_uint2real):
	Add prototypes.
	(gfc_uint2complex, gfc_real2uint, gfc_complex2uint, gfc_log2uint):
	Likewise.
	(gfc_uint2log): Likewise.
	* check.cc (gfc_boz2uint): New function
	(type_check2): New function.
	(int_or_real_or_unsigned_check): New function.
	(less_than_bitsizekind): Adjust for unsingeds.
	(less_than_bitsize2): Likewise.
	(gfc_check_allocated): Likewise.
	(gfc_check_mod): Likewise.
	(gfc_check_bge_bgt_ble_blt): Likewise.
	(gfc_check_bitfcn): Likewise.
	(gfc_check_digits): Likewise.
	(gfc_check_dshift): Likewise.
	(gfc_check_huge): Likewise.
	(gfc_check_iu): New function.
	(gfc_check_iand_ieor_ior): Adjust for unsigneds.
	(gfc_check_ibits): Likewise.
	(gfc_check_uint): New function.
	(gfc_check_ishft): Adjust for unsigneds.
	(gfc_check_ishftc): Likewise.
	(gfc_check_min_max): Likewise.
	(gfc_check_merge_bits): Likewise.
	(gfc_check_selected_int_kind): Likewise.
	(gfc_check_shift): Likewise.
	(gfc_check_mvbits): Likewise.
	(gfc_invalid_unsigned_ops): Likewise.
	* decl.cc (gfc_match_decl_type_spec): Likewise.
	* dump-parse-tree.cc (show_expr): Likewise.
	* expr.cc (gfc_get_constant_expr): Likewise.
	(gfc_copy_expr): Likewise.
	(gfc_extract_int): Likewise.
	(numeric_type): Likewise.
	* gfortran.h (enum arith): Extend with ARITH_UNSIGNED_TRUNCATED
	and ARITH_UNSIGNED_NEGATIVE.
	(enum gfc_isym_id): Extend with GFC_ISYM_SU_KIND and GFC_ISYM_UINT.
	(gfc_check_unsigned_range): New prototype-
	(gfc_arith_error): Likewise.
	(gfc_reduce_unsigned): Likewise.
	(gfc_boz2uint): Likewise.
	(gfc_invalid_unsigned_ops): Likewise.
	(gfc_convert_mpz_to_unsigned): Likewise.
	* gfortran.texi: Add some rudimentary documentation.
	* intrinsic.cc (gfc_type_letter): Adjust for unsigneds.
	(add_functions): Add uint and adjust functions to be called.
	(add_conversions): Add unsigned conversions.
	(gfc_convert_type_warn): Adjust for unsigned.
	* intrinsic.h (gfc_check_iu, gfc_check_uint, gfc_check_mod, gfc_simplify_uint,
	gfc_simplify_selected_unsigned_kind, gfc_resolve_uint): New prototypes.
	* invoke.texi: Add -funsigned.
	* iresolve.cc (gfc_resolve_dshift): Handle unsigneds.
	(gfc_resolve_iand): Handle unsigneds.
	(gfc_resolve_ibclr): Handle unsigneds.
	(gfc_resolve_ibits): Handle unsigneds.
	(gfc_resolve_ibset): Handle unsigneds.
	(gfc_resolve_ieor): Handle unsigneds.
	(gfc_resolve_ior): Handle unsigneds.
	(gfc_resolve_uint): Handle unsigneds.
	(gfc_resolve_merge_bits): Handle unsigneds.
	(gfc_resolve_not): Handle unsigneds.
	* lang.opt: Add -funsigned.
	* libgfortran.h: Add BT_UNSIGNED.
	* match.cc (gfc_match_type_spec): Match UNSIGNED.
	* misc.cc (gfc_basic_typename): Add UNSIGNED.
	(gfc_typename): Likewise.
	* primary.cc (convert_unsigned): New function.
	(match_unsigned_constant): New function.
	(gfc_match_literal_constant): Handle unsigned.
	* resolve.cc (resolve_operator): Handle unsigned.
	(resolve_ordinary_assign): Likewise.
	* simplify.cc (convert_mpz_to_unsigned): Renamed to...
	(gfc_convert_mpz_to_unsigned): and adjusted.
	(gfc_simplify_bit_size): Adjusted for unsigned.
	(compare_bitwise): Likewise.
	(gfc_simplify_bge): Likewise.
	(gfc_simplify_bgt): Likewise.
	(gfc_simplify_ble): Likewise.
	(gfc_simplify_blt): Likewise.
	(simplify_cmplx): Likewise.
	(gfc_simplify_digits): Likewise.
	(simplify_dshift): Likewise.
	(gfc_simplify_huge): Likewise.
	(gfc_simplify_iand): Likewise.
	(gfc_simplify_ibclr): Likewise.
	(gfc_simplify_ibits): Likewise.
	(gfc_simplify_ibset): Likewise.
	(gfc_simplify_ieor): Likewise.
	(gfc_simplify_uint): Likewise.
	(gfc_simplify_ior): Likewise.
	(simplify_shift): Likewise.
	(gfc_simplify_ishftc): Likewise.
	(gfc_simplify_merge_bits): Likewise.
	(min_max_choose): Likewise.
	(gfc_simplify_mod): Likewise.
	(gfc_simplify_modulo): Likewise.
	(gfc_simplify_popcnt): Likewise.
	(gfc_simplify_range): Likewise.
	(gfc_simplify_selected_unsigned_kind): Likewise.
	(gfc_convert_constant): Likewise.
	* target-memory.cc (size_unsigned): New function.
	(gfc_element_size): Adjust for unsigned.
	* trans-const.h (gfc_conv_mpz_unsigned_to_tree): Add prototype.
	* trans-const.cc (gfc_conv_mpz_unsigned_to_tree): Handle unsigneds.
	(gfc_conv_constant_to_tree): Likewise.
	* trans-decl.cc (gfc_conv_cfi_to_gfc): Put in "not yet implemented".
	* trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Likewise.
	* trans-stmt.cc (gfc_trans_integer_select): Handle unsigned.
	(gfc_trans_select): Likewise.
	* trans-intrinsic.cc (gfc_conv_intrinsic_mod): Handle unsigned.
	(gfc_conv_intrinsic_shift): Likewise.
	(gfc_conv_intrinsic_function): Add GFC_ISYM_UINT.
	* trans-io.cc (enum iocall): Add IOCALL_X_UNSIGNED and IOCALL_X_UNSIGNED_WRITE.
	(gfc_build_io_library_fndecls): Add transfer_unsigned and transfer_unsigned_write.
	(transfer_expr): Handle unsigneds.
	* trans-types.cc (gfc_unsinged_kinds): New array.
	(gfc_unsigned_types): Likewise.
	(gfc_init_kinds): Handle them.
	(validate_unsigned): New function.
	(gfc_validate_kind): Use it.
	(gfc_build_unsigned_type): New function.
	(gfc_init_types): Use it.
	(gfc_get_unsigned_type): New function.
	(gfc_typenode_for_spec): Handle unsigned.
	* trans-types.h (gfc_get_unsigned_type): New prototype.

libgfortran/ChangeLog:

	* gfortran.map: Add _gfortran_transfer_unsgned and
	_gfortran_transfer-signed.
	* io/io.h (set_unsigned): New prototype.
	(us_max): New prototype.
	(read_decimal_unsigned): New prototype.
	(write_iu): New prototype.
	* io/list_read.c (convert_unsigned): New function.
	(read_integer): Also handle unsigneds.
	(list_formatted_read_scalar): Handle unsigneds.
	(nml_read_obj): Likewise.
	* io/read.c (set_unsigned): New function.
	(us_max): New function.
	(read_utf8): Whitespace fixes.
	(read_default_char1): Whitespace fixes.
	(read_a_char4): Whitespace fixes.
	(next_char): Whiltespace fixes.
	(read_decimal_unsigned): New function.
	(read_f): Whitespace fixes.
	(read_x): Whitespace fixes.
	* io/transfer.c (transfer_unsigned): New function.
	(transfer_unsigned_write): New function.
	(require_one_of_two_types): New function.
	(formatted_transfer_scalar_read): Use it.
	(formatted_transfer_scalar_write): Also use it.
	* io/write.c (write_decimal_unsigned): New function.
	(write_iu): New function.
	(write_unsigned): New function.
	(list_formatted_write_scalar): Adjust for unsigneds.
	* libgfortran.h (GFC_UINTEGER_1_HUGE): Define.
	(GFC_UINTEGER_2_HUGE): Define.
	(GFC_UINTEGER_4_HUGE): Define.
	(GFC_UINTEGER_8_HUGE): Define.
	(GFC_UINTEGER_16_HUGE): Define.
	(HAVE_GFC_UINTEGER_1): Undefine (done by mk-kind-h.sh)
	(HAVE_GFC_UINTEGER_4): Likewise.
	* mk-kinds-h.sh: Add GFC_UINTEGER_*_HUGE.

gcc/testsuite/ChangeLog:

	* gfortran.dg/unsigned_1.f90: New test.
	* gfortran.dg/unsigned_10.f90: New test.
	* gfortran.dg/unsigned_11.f90: New test.
	* gfortran.dg/unsigned_12.f90: New test.
	* gfortran.dg/unsigned_13.f90: New test.
	* gfortran.dg/unsigned_14.f90: New test.
	* gfortran.dg/unsigned_15.f90: New test.
	* gfortran.dg/unsigned_16.f90: New test.
	* gfortran.dg/unsigned_17.f90: New test.
	* gfortran.dg/unsigned_18.f90: New test.
	* gfortran.dg/unsigned_19.f90: New test.
	* gfortran.dg/unsigned_2.f90: New test.
	* gfortran.dg/unsigned_20.f90: New test.
	* gfortran.dg/unsigned_21.f90: New test.
	* gfortran.dg/unsigned_22.f90: New test.
	* gfortran.dg/unsigned_23.f90: New test.
	* gfortran.dg/unsigned_24.f: New test.
	* gfortran.dg/unsigned_3.f90: New test.
	* gfortran.dg/unsigned_4.f90: New test.
	* gfortran.dg/unsigned_5.f90: New test.
	* gfortran.dg/unsigned_6.f90: New test.
	* gfortran.dg/unsigned_7.f90: New test.
	* gfortran.dg/unsigned_8.f90: New test.
	* gfortran.dg/unsigned_9.f90: New test.
2024-09-07 17:12:17 +02:00
GCC Administrator
964c9c247c Daily bump. 2024-08-21 00:19:34 +00:00
Andre Vehreschild
35f5601280 Fortran: Fix [Coarray] ICE in conv_caf_send, at fortran/trans-intrinsic.c:1950 [PR84246]
Fix ICE caused by converted expression already being pointer by checking
for its type.  Lift rewrite to caf_send completely into resolve and
prevent more temporary arrays.

	PR fortran/84246

gcc/fortran/ChangeLog:

	* resolve.cc (caf_possible_reallocate): Detect arrays that may
	be reallocated by caf_send.
	(resolve_ordinary_assign): More reliably detect assignments
	where a rewrite to caf_send is needed.
	* trans-expr.cc (gfc_trans_assignment_1): Remove rewrite to
	caf_send, because this is done by resolve now.
	* trans-intrinsic.cc (conv_caf_send): Prevent unneeded temporary
	arrays.

libgfortran/ChangeLog:

	* caf/single.c (send_by_ref): Created array's lbound is now 1
	and the offset set correctly.

gcc/testsuite/ChangeLog:

	* gfortran.dg/coarray_allocate_7.f08: Adapt to array being
	allocate by caf_send.
2024-08-20 09:32:09 +02:00
GCC Administrator
f11bc08844 Daily bump. 2024-08-19 00:18:24 +00:00
Sergey Fedorov
1cfe4a4d0d libgfortran: implement fpu-macppc for Darwin, support IEEE arithmetic
This allows to build and use IEEE modules on Darwin PowerPC.

libgfortran/ChangeLog:

	* config/fpu-macppc.h (new file): initial support for powerpc-darwin.
	* configure.host: enable ieee_support for powerpc-darwin case,
	set fpu_host='fpu-macppc'.

Signed-off-by: Sergey Fedorov <vital.had@gmail.com>
2024-08-18 18:54:27 +02:00
GCC Administrator
18eb6ca136 Daily bump. 2024-07-26 00:17:23 +00:00
Jerry DeLisle
3aeb697a21 Fortran: Suppress wrong End Of File error with user defined IO.
PR libfortran/105361

libgfortran/ChangeLog:

	* io/list_read.c (finish_list_read): Add a condition check for
	a user defined derived type IO operation to avoid calling the
	EOF error.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105361.f90: New test.
2024-07-25 09:01:19 -07:00
GCC Administrator
88ff0504ab Daily bump. 2024-07-12 00:17:52 +00:00
Andre Vehreschild
e4f2f46e01 Fortran: Fix rejecting class arrays of different ranks as storage association argument and add un/pack_class. [PR96992]
Removing the assert in trans-expr, lead to initial strides not set
which is now fixed.  When the array needs repacking, this is done for
class arrays now, too.

Packing class arrays was done using the regular internal pack
function in the past.  But that does not use the vptr's copy
function and breaks OOP paradigms (e.g. deep copy).  The new
un-/pack_class functions use the vptr's copy functionality to
implement OOP paradigms correctly.

	PR fortran/96992

gcc/fortran/ChangeLog:

	* trans-array.cc (gfc_trans_array_bounds): Set a starting
	stride, when descriptor expects a variable for the stride.
	(gfc_trans_dummy_array_bias): Allow storage association for
	dummy class arrays, when they are not elemental.
	(gfc_conv_array_parameter): Add more general class support
	and packing for classes, too.
	* trans-array.h (gfc_conv_array_parameter): Add lbound shift
	for class arrays.
	* trans-decl.cc (gfc_build_builtin_function_decls): Add decls
	for internal_un-/pack_class.
	* trans-expr.cc (gfc_reset_vptr): Allow supplying a type-tree
	to generate the vtab from.
	(gfc_class_set_vptr): Allow supplying a class-tree to take the
	vptr from.
	(class_array_data_assign): Rename to gfc_class_array_data_assign
	and make usable from other compile units.
	(gfc_class_array_data_assign): Renamed from class_array_data_
	assign.
	(gfc_conv_derived_to_class): Remove assert to
	allow converting derived to class type arrays with assumed
	rank.  Reduce code base and use gfc_conv_array_parameter also
	for classes.
	(gfc_conv_class_to_class): Use gfc_class_data_assign.
	(gfc_conv_procedure_call): Adapt to new signature of
	gfc_conv_derived_to_class.
	* trans-io.cc (transfer_expr): Same.
	* trans-stmt.cc (trans_associate_var): Same.
	* trans.h (gfc_conv_derived_to_class): Signature changed.
	(gfc_class_array_data_assign): Made public.
	(gfor_fndecl_in_pack_class): Added declaration.
	(gfor_fndecl_in_unpack_class): Same.

libgfortran/ChangeLog:

	* Makefile.am: Add in_un-/pack_class.c to build.
	* Makefile.in: Regenerated from Makefile.am.
	* gfortran.map: Added new functions and bumped ABI.
	* libgfortran.h (GFC_CLASS_T): Added for generating class
	representation at runtime.
	* runtime/in_pack_class.c: New file.
	* runtime/in_unpack_class.c: New file.

gcc/testsuite/ChangeLog:

	* gfortran.dg/class_dummy_11.f90: New test.
2024-07-11 09:47:44 +02:00
GCC Administrator
6af18e8c95 Daily bump. 2024-06-07 00:16:38 +00:00
Thomas Schwinge
3a4775d440 nvptx, libgfortran: Switch out of "minimal" mode
..., in order to enable (portions of) Fortran I/O, for example.

	libgfortran/
	* configure.ac: No longer set 'LIBGFOR_MINIMAL' for nvptx.
	* configure: Regenerate.
	libgomp/
	* libgomp.texi (nvptx): Update.
	* testsuite/libgomp.fortran/target-print-1-nvptx.f90: Remove.
	* testsuite/libgomp.fortran/target-print-1.f90: Adjust.
	* testsuite/libgomp.oacc-fortran/error_stop-2-nvptx.f: New.
	* testsuite/libgomp.oacc-fortran/error_stop-2.f: Adjust.
	* testsuite/libgomp.oacc-fortran/print-1-nvptx.f90: Adjust.
	* testsuite/libgomp.oacc-fortran/print-1.f90: Adjust.
	* testsuite/libgomp.oacc-fortran/stop-2-nvptx.f: New.
	* testsuite/libgomp.oacc-fortran/stop-2.f: Adjust.

Co-authored-by: Andrew Stubbs <ams@gcc.gnu.org>
2024-06-06 13:41:47 +02:00
Thomas Schwinge
395ac0417a Clean up after newlib "nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]"
PR target/85463
	libgfortran/
	* runtime/minimal.c [__nvptx__] (exit): Don't override.
	libgomp/
	* config/nvptx/error.c (exit): Don't override.
	* testsuite/libgomp.oacc-fortran/error_stop-1.f: Update.
	* testsuite/libgomp.oacc-fortran/error_stop-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/error_stop-3.f: Likewise.
	* testsuite/libgomp.oacc-fortran/stop-1.f: Likewise.
	* testsuite/libgomp.oacc-fortran/stop-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/stop-3.f: Likewise.
2024-06-06 13:41:46 +02:00
GCC Administrator
d508d70836 Daily bump. 2024-05-09 10:58:01 +00:00
Rainer Orth
35b05a02de build: Derive object names in make_sunver.pl
The recent move of libgfortran object files to subdirs and the resulting
breakage of libgfortran.so symbol exports demonstrated how fragile
deriving object and archive names from their libtool counterparts in the
Makefiles is.  Therefore, this patch moves that step into
make_sunver.pl, considerably simplifying the Makefile rules to create
the version scripts.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11, verifying that the version scripts are identical
except for the input filenames.

2024-05-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	contrib:
	* make_sunver.pl: Use File::Basename;
	Skip -lLIB args.
	Convert libtool object/archive names to underlying
	objects/archives.

	libatomic:
	* Makefile.am [LIBAT_BUILD_VERSIONED_SHLIB_SUN]
	(libatomic.map-sun): Pass $(libatomic_la_OBJECTS),
	$(libatomic_la_LIBADD) to make_sunver.pl unmodified.
	* Makefile.in: Regenerate.

	libffi:
	* Makefile.am [LIBFFI_BUILD_VERSIONED_SHLIB_SUN] (libffi.map-sun):
	Pass $(libffi_la_OBJECTS), $(libffi_la_LIBADD) to make_sunver.pl
	unmodified.
	* Makefile.in: Regenerate.

	libgfortran:
	* Makefile.am [LIBGFOR_USE_SYMVER_SUN} (gfortran.ver-sun): Pass
	$(libgfortran_la_OBJECTS), $(libgfortran_la_LIBADD) to
	make_sunver.pl unmodified.
	* Makefile.in: Regenerate.

	libgomp:
	* Makefile.am [LIBGOMP_BUILD_VERSIONED_SHLIB_SUN]
	(libgomp.ver-sun): Pass $(libgomp_la_OBJECTS),
	$(libgomp_la_LIBADD) to make_sunver.pl unmodified.
	* Makefile.in: Regenerate.

	libitm:
	* Makefile.am [LIBITM_BUILD_VERSIONED_SHLIB_SUN] (libitm.map-sun):
	Pass $(libitm_la_OBJECTS), $(libitm_la_LIBADD) to make_sunver.pl
	unmodified.
	* Makefile.in: Regenerate.

	libquadmath:
	* Makefile.am [LIBQUAD_USE_SYMVER_SUN] (quadmath.map-sun): Pass
	$(libquadmath_la_OBJECTS), $(libquadmath_la_LIBADD) to
	make_sunver.pl unmodified.
	* Makefile.in: Regenerate.

	libssp:
	* Makefile.am [LIBSSP_USE_SYMVER_SUN] (ssp.map-sun): Pass
	$(libssp_la_OBJECTS), $(libssp_la_LIBADD) to make_sunver.pl
	unmodified.
	* Makefile.in: Regenerate.

	libstdc++-v3:
	* src/Makefile.am [ENABLE_SYMVERS_SUN]
	(libstdc++-symbols.ver-sun): Pass $(libstdc___la_OBJECTS),
	$(libstdc___la_LIBADD) to make_sunver.pl unmodified.
	* src/Makefile.in: Regenerate.
2024-05-07 13:14:05 +02:00
GCC Administrator
f56280d57f Daily bump. 2024-05-07 00:18:28 +00:00
David Edelsohn
f62e55a7d0 aix: Fix building fat library for AIX
With the change in subdirectories, the code for libgfortran fat libraries
needs to be adjusted to explicitly reference the subdirectory.  AIX
creates fat library archives and the compiler itself can be built as
either 32 bit or 64 bit application and default code generation.  For
the two, alternate versions of the compiler to interoperate, GCC needs
to construct the fat libraries manually.

The Makefile fragment had been trying to leverage as much of the existing
targets and macros as possible.  With the subdirectory change, the
location of single.o is more obscured and cannot be determined without
libtool.  This patch references the location of the real object file
more explicitly.

Utilizing subst seems like overkill and unnecessary obscuration for a single
object file.  Either way, it's digging below the libtool abstraction layer.

This also fixes Fortran bootstrap on AIX.

Bootstrapped on powerpc-ibm-aix7.3.0.0

libgfortran/ChangeLog:

	* config/t-aix (all-local, libcaf_single): Explicitly reference
	caf/.libs/single.o

Signed-off-by: David Edelsohn <dje.gcc@gmail.com>
2024-05-06 18:36:41 -04:00
Rainer Orth
8daf4eb02a libgfortran: Fix libgfortran.so versioning on Solaris with subdirs
The move of libgfortran objects to subdirectories completely broke the
creation of libgfortran.so on Solaris.  Since the gfortran.ver-sun rule
doesn't support that structure, no libtool objects are found, thus no
symbols exported from libgfortran.so, causing every link to fail.

This patch fixes this by allowing for the new structure.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

2024-05-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgfortran:
	* Makefile.am [LIBGFOR_USE_SYMVER_SUN] (gfortran.ver-sun): Handle
	objects in subdirs.
	* Makefile.in: Regenerate.
2024-05-06 09:31:11 +02:00
GCC Administrator
f2d0116090 Daily bump. 2024-05-03 00:17:26 +00:00
Francois-Xavier Coudert
affd24bfc6 libgfortran: Fix up the autoreconf warnings
This means using sub-dirs and amending some of the recipes accordingly.

libgfortran/ChangeLog:

	* Makefile.am: Use sub-dirs, amend recipies accordingly.
	* Makefile.in: Regenerate.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-05-02 23:03:37 +02:00
GCC Administrator
42d2e2f57e Daily bump. 2024-04-30 00:17:28 +00:00
Francois-Xavier Coudert
050a4f7fc5 Fortran: add SELECTED_LOGICAL_KIND
gcc/fortran/ChangeLog:
	* expr.cc (check_transformational): Add SELECTED_LOGICAL_KIND
	to allowed functions for Fortran 2023.
	* gfortran.h (GFC_ISYM_SL_KIND): New.
	* gfortran.texi: Mention SELECTED_LOGICAL_KIND.
	* intrinsic.cc (add_functions): Add SELECTED_LOGICAL_KIND.
	(gfc_intrinsic_func_interface): Allow it in initialization
	expressions.
	* intrinsic.h (gfc_simplify_selected_logical_kind): New proto.
	* intrinsic.texi: Add SELECTED_LOGICAL_KIND.
	* simplify.cc (gfc_simplify_selected_logical_kind): New
	function.
	* trans-decl.cc (gfc_build_intrinsic_function_decls): Initialize
	gfor_fndecl_sl_kind.
	* trans-intrinsic.cc (gfc_conv_intrinsic_sl_kind): New function.
	(gfc_conv_intrinsic_function): Call it for GFC_ISYM_SL_KIND.
	* trans.h (gfor_fndecl_sl_kind): New symbol.

gcc/testsuite/ChangeLog:

	* gfortran.dg/selected_logical_kind_1.f90: New test.
	* gfortran.dg/selected_logical_kind_2.f90: New test.
	* gfortran.dg/selected_logical_kind_3.f90: New test.
	* gfortran.dg/selected_logical_kind_4.f90: New test.

libgfortran/ChangeLog:

	* gfortran.map: Add _gfortran_selected_logical_kind.
	* intrinsics/selected_int_kind.f90: Add SELECTED_LOGICAL_KIND.
2024-04-29 16:24:20 +02:00
GCC Administrator
1667962ae7 Daily bump. 2024-04-13 00:17:47 +00:00
Ian McInerney
3bd3ca05b5 libgfortran: Fix compilation of gf_vsnprintf
The fallback function (gf_vsnprintf) to provide a vsnprintf function
if the system library doesn't have one would not compile due to the
variable name for the string's destination buffer not being updated
after the refactor in 2018 in edaaef601d.

This updates the internal logic of gf_vsnprintf to now use the str
variable defined in the function signature.

libgfortran/ChangeLog:

2024-04-04  Ian McInerney  <i.mcinerney17@imperial.ac.uk>

	* runtime/error.c (gf_vsnprintf): Fix compilation

Signed-off-by: Ian McInerney <i.mcinerney17@imperial.ac.uk>
2024-04-12 13:52:10 +02:00
GCC Administrator
45532e3a92 Daily bump. 2024-04-09 00:17:24 +00:00
Tobias Burnus
477c8a82f3 Fortran: Accept again tab as alternative to space as separator [PR114304]
This fixes a side-effect of/regression caused by r14-9822-g93adf88cc6744a,
which was for the same PR.

	PR libfortran/114304

libgfortran/ChangeLog:

	* io/list_read.c (eat_separator): Accept tab as alternative to space.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr114304-2.f90: New test.
2024-04-08 21:47:51 +02:00
GCC Administrator
1a96eb0a43 Daily bump. 2024-04-08 12:15:19 +00:00
Jerry DeLisle
93adf88cc6 libfortran: Fix handling of formatted separators.
PR libfortran/114304
	PR libfortran/105473

libgfortran/ChangeLog:

	* io/list_read.c (eat_separator): Add logic to handle spaces
	preceding a comma or semicolon such that that a 'null' read
	occurs without error at the end of comma or semicolon
	terminated input lines. Add check and error message for ';'.
	(list_formatted_read_scalar): Treat comma as a decimal point
	when specified by the decimal mode on the first item.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105473.f90: Modify to verify new error message.
	* gfortran.dg/pr114304.f90: New test.
2024-04-06 06:55:45 -07:00
GCC Administrator
a1e6798acf Daily bump. 2024-04-03 00:17:29 +00:00
Jakub Jelinek
94792057ad Fix up duplicated words mostly in comments, part 1
Like in r12-7519-g027e30414492d50feb2854aff38227b14300dc4b, I've done
git grep -v 'long long\|optab optab\|template template\|double double' | grep ' \([a-zA-Z]\+\) \1 '

This is just part of the changes, mostly for non-gcc directories.
I'll try to get to the rest soon.  Obviously, the above command also
finds cases which are correct as is and shouldn't be changed, so one
needs to manually inspect everything.

I'd hope most of it is pretty obvious, but the config/ and libstdc++-v3/
hunks include a tweak in a license wording, though other copies of the
similar license have the wording right.

2024-04-02  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.tpl: Fix duplicated words; returns returns ->
	returns.
config/
	* lcmessage.m4: Fix duplicated words; can can -> can,
	package package -> package.
libdecnumber/
	* decCommon.c (decFinalize): Fix duplicated words in
	comment; the the -> the.
libgcc/
	* unwind-dw2-fde.c (struct fde_accumulator): Fix duplicated
	words in comment; is is -> is.
libgfortran/
	* configure.host: Fix duplicated words; the the -> the.
libgm2/
	* configure.host: Fix duplicated words; the the -> the.
libgomp/
	* libgomp.texi (OpenMP 5.2): Fix duplicated words; with with ->
	with.
	(omp_target_associate_ptr): Fix duplicated words; either either ->
	either.
	(omp_init_allocator): Fix duplicated words; be be -> be.
	(omp_realloc): Fix duplicated words; is is -> is.
	(OMP_ALLOCATOR): Fix duplicated words; other other -> other.
	* priority_queue.h (priority_queue_multi_p): Fix duplicated words;
	to to -> to.
libiberty/
	* regex.c (byte_re_match_2_internal): Fix duplicated words in comment;
	next next -> next.
	* dyn-string.c (dyn_string_init): Fix duplicated words in comment;
	of of -> of.
libitm/
	* beginend.cc (GTM::gtm_thread::begin_transaction): Fix duplicated
	words in comment; not not -> not to.
libobjc/
	* init.c (duplicate_classes): Fix duplicated words in comment; in in
	-> in.
	* sendmsg.c (__objc_prepare_dtable_for_class): Fix duplicated words
	in comment; the the -> the.
	* encoding.c (objc_layout_structure): Likewise.
libstdc++-v3/
	* acinclude.m4: Fix duplicated words; file file -> file can.
	* configure.host: Fix duplicated words; the the -> the.
libvtv/
	* vtv_rts.cc (vtv_fail): Fix duplicated words; to to -> to.
	* vtv_fail.cc (vtv_fail): Likewise.
2024-04-02 13:39:11 +02:00
GCC Administrator
4b8e7b57d9 Daily bump. 2024-03-27 00:18:06 +00:00
Jerry DeLisle
41e767c482 libgfortran: Fix file position after ENDFILE statement.
PR libfortran/107031

libgfortran/ChangeLog:

	* io/file_pos.c (st_endfile): Remove call to next_record().

gcc/testsuite/ChangeLog:

	* gfortran.dg/endfile_5.f90: New test.
2024-03-26 17:13:51 -07:00
GCC Administrator
0628916802 Daily bump. 2024-03-12 00:17:48 +00:00
Jerry DeLisle
0c179654c3 libgfortran: [PR114304] Revert portion of PR105347 change.
PR libfortran/105437
	PR libfortran/114304

libgfortran/ChangeLog:

	* io/list_read.c (eat_separator): Remove check for decimal
	point mode and semicolon used as a seprator. Removes
	the regression.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105473.f90: Add additional checks to address
	the case of semicolon at the end of a line.
2024-03-11 15:15:34 -07:00
GCC Administrator
1e74c758a2 Daily bump. 2024-03-08 00:17:33 +00:00
Jerry DeLisle
03932d3203 Fortran: Fix issue with using snprintf function.
The previous patch used snprintf to set the message
string. The message string is not a formatted string
and the snprintf will interpret '%' related characters
as format specifiers when there are no associated
output variables. A segfault ensues.

This change replaces snprintf with a fortran string copy
function and null terminates the message string.

	PR libfortran/105456

libgfortran/ChangeLog:

	* io/list_read.c (list_formatted_read_scalar): Use fstrcpy
	from libgfortran/runtime/string.c to replace snprintf.
	(nml_read_obj): Likewise.
	* io/transfer.c (unformatted_read): Likewise.
	(unformatted_write): Likewise.
	(formatted_transfer_scalar_read): Likewise.
	(formatted_transfer_scalar_write): Likewise.
	* io/write.c (list_formatted_write_scalar): Likewise.
	(nml_write_obj): Likewise.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105456.f90: Revise using '%' characters
	in users error message.
2024-03-06 19:57:05 -08:00
GCC Administrator
8b483cd552 Daily bump. 2024-03-07 00:17:38 +00:00
Jerry DeLisle
21edfb0051 Fortran: Add user defined error messages for UDTIO.
The defines IOMSG_LEN and MSGLEN were redundant so these are combined
into IOMSG_LEN as defined in io.h.

The remainder of the patch adds checks for when a user defined
derived type IO procedure sets the IOSTAT or IOMSG variables
independent of the librrary defined I/O messages.

	PR libfortran/105456

libgfortran/ChangeLog:

	* io/io.h (IOMSG_LEN): Moved to here.
	* io/list_read.c (MSGLEN): Removed MSGLEN.
	(convert_integer): Changed MSGLEN to IOMSG_LEN.
	(parse_repeat): Likewise.
	(read_logical): Likewise.
	(read_integer): Likewise.
	(read_character): Likewise.
	(parse_real): Likewise.
	(read_complex): Likewise.
	(read_real): Likewise.
	(check_type): Likewise.
	(list_formatted_read_scalar): Adjust to IOMSG_LEN.
	(nml_read_obj): Add user defined error message.
	* io/transfer.c (unformatted_read): Add user defined error
	message.
	(unformatted_write): Add user defined error message.
	(formatted_transfer_scalar_read): Add user defined error message.
	(formatted_transfer_scalar_write): Add user defined error message.
	* io/write.c (list_formatted_write_scalar): Add user defined error message.
	(nml_write_obj): Add user defined error message.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105456-nmlr.f90: New test.
	* gfortran.dg/pr105456-nmlw.f90: New test.
	* gfortran.dg/pr105456-ruf.f90: New test.
	* gfortran.dg/pr105456-wf.f90: New test.
	* gfortran.dg/pr105456-wuf.f90: New test.
2024-03-05 20:54:07 -08:00
GCC Administrator
ad178a2be7 Daily bump. 2024-02-26 00:16:54 +00:00
Jerry DeLisle
3f58f96a4e libgfortran: Propagate user defined iostat and iomsg.
PR libfortran/105456

libgfortran/ChangeLog:

	* io/list_read.c (list_formatted_read_scalar): Add checks
	for the case where a user defines their own error codes
	and error messages and generate the runtime error.
	* io/transfer.c (st_read_done): Whitespace.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105456.f90: New test.
2024-02-25 14:53:52 -08:00
GCC Administrator
c1d1571329 Daily bump. 2024-02-18 00:17:05 +00:00
Jerry DeLisle
a71d87431d libgfortran: [PR105473] Fix checks for decimal='comma'.
PR libfortran/105473

libgfortran/ChangeLog:

	* io/list_read.c (eat_separator): Reject comma as a
	seprator when it is being used as a decimal point.
	(parse_real): Reject a '.' when is should be a comma.
	(read_real): Likewise.
	* io/read.c (read_f): Add more checks for ',' and '.'
	conditions.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr105473.f90: New test.
2024-02-17 10:03:43 -08:00