Skip to content
Snippets Groups Projects
  1. Jan 02, 2025
  2. Dec 24, 2024
    • GCC Administrator's avatar
      Daily bump. · 4a8af01b
      GCC Administrator authored
      4a8af01b
    • Hans-Peter Nilsson's avatar
      libgfortran: Fix build for targets with int32_t=long int · a5b1f3e1
      Hans-Peter Nilsson authored
      Without this, after r15-6415-g586477d67bf2e3, you'll see,
      for targets where int32_t is a typedef of long int (beware
      of artificially broken lines):
      
      /x/gcc/libgfortran/caf/single.c: In function '_gfortran_caf_get_by_ct':
      /x/gcc/libgfortran/caf/single.c:2943:56: error: passing argument 2 of '\
      (accessor_hash_table + (sizetype)((unsigned int)getter_index * 12))->ac\
      cessor' from incompatible pointer type [-Wincompatible-pointer-types]
       2943 |   accessor_hash_table[getter_index].accessor (dst_ptr, &free_bu\
      ffer, src_ptr,
            |                                                        ^~~~~~~~\
      ~~~~
            |                                                        |
            |                                                        int *
      /x/gcc/libgfortran/caf/single.c:2943:56: note: expected 'int32_t *' {ak\
      a 'long int *'} but argument is of type 'int *'
      
      libgfortran:
      	* caf/single.c (_gfortran_caf_get_by_ct): Correct type of free_buffer
      	to int32_t.
      a5b1f3e1
  3. Dec 23, 2024
  4. Dec 22, 2024
    • Andre Vehreschild's avatar
      Fortran: Replace getting of coarray data with accessor-based version. [PR107635] · 586477d6
      Andre Vehreschild authored
      Getting coarray data from remote images was slow, inefficient and did
      not work for object files that where not compiled with coarray support
      for derived types with allocatable/pointer components.  The old approach
      emulated accessing data through a whole structure ref, which was error
      prone for corner cases.  Furthermore was did it have a runtime
      complexity of O(N), where N is the number of allocatable/pointer
      components and descriptors involved.  Each of those needed communication
      twice.  The new approach creates a routine for each access into a
      coarray object putting all required operations there.  Looking a
      tree-dump one will see those small routines.  But this time it is just
      compiled fortran with all the knowledge of the compiler of bounds and so
      on.  New paradigms will be available out of the box.  Furthermore is the
      complexity of the communication reduced to be O(1).  E.g. the mpi
      implementation sends one message for the parameters of the access and
      one message back with the results without caring about the number of
      allocatable/pointer/descriptor components in the access.
      
      Identification of access routines is done be adding them to a hash map,
      where the hash is the same on all images.  Translating the hash to an
      index, which is the same on all images again, allows for fast calls of
      the access routines.  Resolving the hash to an index is cached at
      runtime, preventing additional hash map lookups.  A hashmap was use
      because not all processor OS combinations may use the same address for
      the access routine.
      
      gcc/fortran/ChangeLog:
      
      	PR fortran/107635
      
      	* gfortran.h (gfc_add_caf_accessor): New function.
      	* gfortran.texi: Document new API routines.
      	* resolve.cc (get_arrayspec_from_expr): Synthesize the arrayspec
      	resulting from an expression, i.e. not only the rank, but also
      	the bounds.
      	(remove_coarray_from_derived_type): Remove coarray ref from a
      	derived type to access it in access routine.
      	(convert_coarray_class_to_derived_type): Same but for classes.
      	The result is a derived type.
      	(split_expr_at_caf_ref): Split an expression at the coarray
      	reference to move the reference after the coarray ref into the
      	access routine.
      	(check_add_new_component): Helper to add variables as
      	components to derived type transfered to the access routine.
      	(create_get_parameter_type): Create the derived type to transfer
      	addressing data to the access routine.
      	(create_get_callback): Create the access routine.
      	(add_caf_get_intrinsic): Use access routine instead of old
      	caf_get.
      	* trans-decl.cc (gfc_build_builtin_function_decls): Register new
      	API routines.
      	(gfc_create_module_variable): Use renamed flag.
      	(gfc_emit_parameter_debug_info):
      	(struct caf_accessor): Linked list of hash-access routine pairs.
      	(gfc_add_caf_accessor): Add a hash-access routine pair to above
      	linked list.
      	(create_caf_accessor_register): Add all registered hash-access
      	routine pairs to the current caf_init.
      	(generate_coarray_init): Use routine above.
      	(gfc_generate_module_vars): Use renamed flag.
      	(generate_local_decl): Same.
      	(gfc_generate_function_code): Same.
      	(gfc_process_block_locals): Same.
      	* trans-intrinsic.cc (conv_shape_to_cst): Build the product of a
      	shape.
      	(gfc_conv_intrinsic_caf_get): Create call to access routine.
      	(conv_caf_send): Adapt to caf_get using less arguments.
      	(gfc_conv_intrinsic_function): Same.
      	* trans.cc (gfc_trans_force_lval): Helper to ensure that an
      	expression can be used as an lvalue-ref.
      	* trans.h (gfc_trans_force_lval): See above.
      
      libgfortran/ChangeLog:
      
      	* caf/libcaf.h (_gfortran_caf_register_accessor): New function
      	to register access routines at runtime.
      	(_gfortran_caf_register_accessors_finish): New function to
      	finish registration of access routine and sort hash map.
      	(_gfortran_caf_get_remote_function_index): New function to
      	convert an hash to an index.
      	(_gfortran_caf_get_by_ct): New function to get data from a
      	remote image using the access routine given by an index.
      	* caf/single.c (struct accessor_hash_t): Hashmap type.
      	(_gfortran_caf_send): Fixed formatting.
      	(_gfortran_caf_register_accessor): Register a hash accessor
      	routine.
      	(hash_compare): Compare two hashes for sort() and bsearch().
      	(_gfortran_caf_register_accessors_finish): Sort the hashmap to
      	allow bsearch()'s quick lookup.
      	(_gfortran_caf_get_remote_function_index): Map a hash to an
      	index.
      	(_gfortran_caf_get_by_ct): Get data from a remote image using
      	the index provided by get_remote_function_index().
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/coarray_atomic_5.f90: Adapted to look for
      	get_by_ct.
      	* gfortran.dg/coarray_lib_comm_1.f90: Same.
      	* gfortran.dg/coarray_stat_function.f90: Same.
      586477d6
  5. Dec 21, 2024
  6. Dec 20, 2024
    • Andre Vehreschild's avatar
      Fortran: Fix caf_stop_numeric and reporting exceptions from caf [PR57598] · a25cc268
      Andre Vehreschild authored
      Caf_stop_numeric always exited with code 0, which is wrong.  It shall
      behave like regular stop.  Add reporting exceptions to caf's stop
      handlers.  For this the existing library routine had to be exported.
      
      libgfortran/ChangeLog:
      
      	PR fortran/57598
      
      	* caf/single.c (_gfortran_caf_stop_numeric): Report exceptions
      	on stop. And fix send_by_ref.
      	(_gfortran_caf_stop_str): Same.
      	(_gfortran_caf_error_stop_str): Same.
      	(_gfortran_caf_error_stop): Same.
      	* gfortran.map: Add report_exception for export.
      	* libgfortran.h (report_exception): Add to internal export.
      	* runtime/stop.c (report_exception): Same.
      a25cc268
  7. Dec 11, 2024
  8. Dec 10, 2024
    • Jerry DeLisle's avatar
      Fortran: Fix READ with padding in BLANK ZERO mode. · cf406a6c
      Jerry DeLisle authored
      	PR fortran/117819
      
      libgfortran/ChangeLog:
      
      	* io/read.c (read_decimal): If the read value is short of the
      	specified width and pad mode is PAD yes, check for BLANK ZERO
      	and adjust the value accordingly.
      	(read_decimal_unsigned): Likewise.
      	(read_radix): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/pr117819.f90: New test.
      cf406a6c
  9. Dec 05, 2024
  10. Dec 04, 2024
  11. Nov 24, 2024
  12. Nov 23, 2024
    • Jerry DeLisle's avatar
      Fortran: Reject missing comma in format. · fd118f4c
      Jerry DeLisle authored
      	Standards require rejecting formats where descriptors
      	are not separated by commas. This change allows this
      	the missing comma to be accepted only with
      	-std=legacy.
      
      	PR fortran/88052
      
      libgfortran/ChangeLog:
      
      	* io/format.c (parse_format_list): Reject missing comma in
      	format strings by default or if -std=f95 or higher. This is
      	a runtime error.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/comma_format_extension_4.f: Add missing comma.
      	* gfortran.dg/dollar_edit_descriptor_2.f: Likewise.
      	* gfortran.dg/fmt_error_9.f: Likewise.
      	* gfortran.dg/fmt_g0_5.f08: Likewise.
      	* gfortran.dg/fmt_t_2.f90: Likewise.
      	* gfortran.dg/pr88052.f90: New test.
      fd118f4c
  13. Oct 08, 2024
  14. Oct 07, 2024
    • Thomas Koenig's avatar
      Implement MAXLOC and MINLOC for unsigned. · c0002a67
      Thomas Koenig authored
      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.
      c0002a67
  15. Oct 02, 2024
  16. Oct 01, 2024
    • Thomas Koenig's avatar
      Implement MAXVAL and MINVAL for UNSIGNED. · 9dd9a069
      Thomas Koenig authored
      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.
      9dd9a069
  17. Sep 25, 2024
  18. Sep 24, 2024
    • Thomas Koenig's avatar
      Add random numbers and fix some bugs. · 291e20e8
      Thomas Koenig authored
      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.
      291e20e8
    • Thomas Koenig's avatar
      Implement SUM and PRODUCT for unsigned. · 5e918a4d
      Thomas Koenig authored
      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.
      5e918a4d
    • Thomas Koenig's avatar
      Implement MATMUL and DOT_PRODUCT for unsigned. · 5d98fe09
      Thomas Koenig authored
      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.
      5d98fe09
  19. Sep 08, 2024
  20. Sep 07, 2024
    • Thomas Koenig's avatar
      Implement first part of unsigned integers for Fortran. · 113a6da9
      Thomas Koenig authored
      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.
      113a6da9
  21. Aug 21, 2024
  22. Aug 20, 2024
    • Andre Vehreschild's avatar
      Fortran: Fix [Coarray] ICE in conv_caf_send, at fortran/trans-intrinsic.c:1950 [PR84246] · 35f56012
      Andre Vehreschild authored
      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.
      35f56012
  23. Aug 19, 2024
  24. Aug 18, 2024
  25. Jul 26, 2024
  26. Jul 25, 2024
  27. Jul 12, 2024
  28. Jul 11, 2024
    • Andre Vehreschild's avatar
      Fortran: Fix rejecting class arrays of different ranks as storage association... · e4f2f46e
      Andre Vehreschild authored
      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.
      e4f2f46e
  29. Jun 07, 2024
  30. Jun 06, 2024
    • Thomas Schwinge's avatar
      nvptx, libgfortran: Switch out of "minimal" mode · 3a4775d4
      Thomas Schwinge authored
      
      ..., 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: default avatarAndrew Stubbs <ams@gcc.gnu.org>
      3a4775d4
    • Thomas Schwinge's avatar
      Clean up after newlib "nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]" · 395ac041
      Thomas Schwinge authored
      	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.
      395ac041
  31. May 09, 2024
  32. May 07, 2024
    • Rainer Orth's avatar
      build: Derive object names in make_sunver.pl · 35b05a02
      Rainer Orth authored
      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.
      35b05a02
    • GCC Administrator's avatar
      Daily bump. · f56280d5
      GCC Administrator authored
      f56280d5
  33. May 06, 2024
    • David Edelsohn's avatar
      aix: Fix building fat library for AIX · f62e55a7
      David Edelsohn authored
      
      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: default avatarDavid Edelsohn <dje.gcc@gmail.com>
      f62e55a7
    • Rainer Orth's avatar
      libgfortran: Fix libgfortran.so versioning on Solaris with subdirs · 8daf4eb0
      Rainer Orth authored
      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.
      8daf4eb0
Loading