[gcc r16-760] libstdc++: Cleanup and stabilize format _Spec<_CharT> and _Pres_type.

2025-05-20 Thread Tomasz Kaminski via Gcc-cvs
https://gcc.gnu.org/g:67584acb5906eb130223cd12f05161ca4de84d5f

commit r16-760-g67584acb5906eb130223cd12f05161ca4de84d5f
Author: Tomasz Kamiński 
Date:   Thu Apr 24 16:03:27 2025 +0200

libstdc++: Cleanup and stabilize format _Spec<_CharT> and _Pres_type.

These patch makes following changes to _Pres_type values:
 * _Pres_esc is replaced with separate _M_debug flag.
 * _Pres_s, _Pres_p do not overlap with _Pres_none.
 * hexadecimal presentation use same values for pointer, integer
   and floating point types.

The members of _Spec<_CharT> are rearranged so the class contains 8 bits
reserved for future use (_M_reserved) and 8 bits of tail padding.
Derived classes (like _ChronoSpec<_CharT>) can reuse the storage for initial
members. We also add _SpecBase as the base class for _Spec<_CharT> to make
it non-C++98 POD, which allows tail padding to be reused on Itanium ABI.

Finally, the format enumerators are defined as enum class with unsigned
char as underlying type, followed by using enum to bring names in scope.
_Term_char names are adjusted for consistency, and enumerator values are
changed so it can fit in smaller bitfields.

The '?' is changed to separate _M_debug flag, to allow debug format to be
independent from the presentation type, and applied to multiple presentation
types. For example it could be used to trigger memberwise or reflection 
based
formatting.

The _M_format_character and _M_format_character_escaped functions are merged
to single function that handle normal and debug presentation. In particular
this would allow future support for '?c' for printing integer types as 
escaped
character. _S_character_width is also folded in the merged function.

Decoupling _Pres_s value from _Pres_none, allows it to be used for string
presentation for range formatting, and removes the need for separate 
_Pres_seq
and _Pres_str. This does not affect formatting of bool as 
__formatter_int::_M_parse
overrides default value of _M_type. And with separation of the _M_debug 
flag,
__formatter_str::format behavior is now agnostic to _M_type value.

The values for integer presentation types, are arranged so textual 
presentations
(_Prec_s, _Pres_c) are grouped together. For consistency floating point
hexadecimal presentation uses the same values as integer ones.

New _Pres_p and setting for _M_alt enables using some spec to configure 
formatting
of  uintptr_t with __formatter_int, and const void* with __formatter_ptr.
Differentiating it from _Pres_none would allow future of formatter
that would require explicit presentation type to be specified. This would 
allow
std::vector to be formatted directly with '{::p}' format spec.

The constructors for __formatter_int and _formatter_ptr from _Spec<_CharT>,
now also set default presentation modes, as format functions expects them.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (_ChronoSpec::_M_locale_specific):
Declare as bit fiekd in tail-padding..
* include/bits/formatfwd.h (__format::_Align): Defined as enum
class and add using enum.
* include/std/format (__format::_Pres_type, __format::_Sign)
(__format::_WidthPrec,  __format::_Arg_t): Defined as enum class
and add using enum.
(_Pres_type::_Pres_esc): Replace with _Pres_max.
(_Pres_type::_Pres_seq, _Pres_type::_Pres_str): Remove.
(__format::_Pres_type): Updated values of enumerators as described
above.
(__format::_Spec): Rearranged members to have 8 bits of 
tail-padding.
(_Spec::_M_debug): Defined.
(_Spec::_M_reserved): Extended to 8 bits and moved at the end.
(_Spec::_M_reserved2): Removed.
(_Spec::_M_parse_fill_and_align, _Spec::_M_parse_sign)
(__format::__write_padded_as_spec): Adjusted default value checks.
(__format::_Term_char): Add using enum and adjust enumertors.
(__Escapes::_S_term): Adjusted for _Term_char values.
(__format::__should_escape_ascii): Adjusted _Term_char uses.
(__format::__write_escaped): Adjusted for _Term_char.
(__formatter_str::parse): Set _Pres_s if specifed and _M_debug
instead of _Pres_esc.
(__formatter_str::set_debug_format): Set _M_debug instead of
_Pres_esc.
(__formatter_str::format, __formatter_str::_M_format_range):
Check _M_debug instead of _Prec_esc.
(__formatter_str::_M_format_escaped): Adjusted _Term_char uses.
(__formatter_int::__formatter_int(_Spec<_CharT>)): Set _Pres_d if
default presentation type is not set.
(__formatter_int::_M_parse): Adjusted default value checks.
(__formatter_int::_M_do_parse

[gcc/devel/omp/gcc-15] Merge branch 'releases/gcc-15' into devel/omp/gcc-15

2025-05-20 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:bc76738d12f06a5efc2b998c2d6fcc093288771f

commit bc76738d12f06a5efc2b998c2d6fcc093288771f
Merge: 033dc40acd5c 911cfea5e597
Author: Tobias Burnus 
Date:   Tue May 20 13:39:18 2025 +0200

Merge branch 'releases/gcc-15' into devel/omp/gcc-15

Merge up to r15-9715-g911cfea5e59798 (May 20, 2025).

Diff:

 gcc/ChangeLog  |  22 +
 gcc/DATESTAMP  |   2 +-
 gcc/config/alpha/alpha.cc  |  23 +-
 gcc/cp/ChangeLog   |  39 ++
 gcc/cp/class.cc|   6 +-
 gcc/cp/decl2.cc|  14 +-
 gcc/cp/module.cc   |  47 +-
 gcc/cp/optimize.cc |   4 +-
 gcc/cp/pt.cc   |   6 +-
 gcc/cp/rtti.cc |   1 +
 gcc/doc/gm2.texi   |   2 +-
 gcc/dwarf2out.cc   |   3 +-
 gcc/fortran/ChangeLog  |  60 ++
 gcc/fortran/check.cc   |  42 +-
 gcc/fortran/dump-parse-tree.cc |   7 +-
 gcc/fortran/gfortran.h |   3 +
 gcc/fortran/resolve.cc |   7 +-
 gcc/fortran/trans-intrinsic.cc |  51 +-
 gcc/fortran/trans-openmp.cc|  20 +
 gcc/m2/ChangeLog   |  57 ++
 gcc/m2/gm2-compiler/M2Check.mod|  21 +-
 gcc/m2/gm2-compiler/M2GenGCC.mod   |   3 -
 gcc/m2/gm2-compiler/M2Quads.mod|  10 +-
 gcc/m2/gm2-compiler/M2Range.mod|  43 +-
 gcc/m2/gm2-compiler/PCSymBuild.mod |  13 +-
 gcc/m2/gm2-compiler/SymbolTable.def|  16 +
 gcc/m2/gm2-compiler/SymbolTable.mod| 138 -
 gcc/m2/gm2-libs/FormatStrings.mod  |   4 +-
 gcc/po/ChangeLog   |  12 +
 gcc/po/sv.po   |  24 +-
 gcc/po/zh_CN.po| 341 +---
 gcc/testsuite/ChangeLog| 135 +
 gcc/testsuite/g++.dg/abi/base-defaulted2.C |  12 +
 gcc/testsuite/g++.dg/modules/clone-4_a.C   |  12 +
 gcc/testsuite/g++.dg/modules/clone-4_b.C   |  12 +
 gcc/testsuite/g++.dg/modules/openmp-1.C|   9 +
 gcc/testsuite/g++.dg/modules/partial-8.h   |   8 +
 gcc/testsuite/g++.dg/modules/partial-8_a.C |  10 +
 gcc/testsuite/g++.dg/modules/partial-8_b.C |   8 +
 gcc/testsuite/g++.dg/modules/partial-8_c.C |   7 +
 gcc/testsuite/g++.dg/modules/partial-8_d.C |   9 +
 gcc/testsuite/g++.dg/modules/tinfo-3_a.H   |   7 +
 gcc/testsuite/g++.dg/modules/tinfo-3_b.C   |   8 +
 gcc/testsuite/g++.dg/template/unify13.C|  18 +
 .../gcc.target/alpha/memcpy-nested-offset-long.c   |  76 +++
 .../gcc.target/alpha/memcpy-nested-offset-quad.c   |  64 +++
 gcc/testsuite/gfortran.dg/interface_61.f90 |  27 +
 gcc/testsuite/gfortran.dg/pr120049_a.f90   |  15 +
 gcc/testsuite/gfortran.dg/pr120049_b.f90   |   8 +
 gcc/testsuite/gfortran.dg/pr120191_1.f90   | 614 +
 gcc/testsuite/gfortran.dg/pr120191_2.f90   |  84 +++
 gcc/testsuite/gfortran.dg/pr120191_3.f90   |  23 +
 gcc/testsuite/gfortran.dg/pr120196.f90 |  26 +
 .../doc/examples/plugin/fail/assignvalue.mod   |  25 +
 .../plugin/fail/doc-examples-plugin-fail.exp   |  25 +
 gcc/testsuite/gm2/pim/fail/constintarraybyte.mod   |  10 +
 gcc/testsuite/gm2/pim/pass/highbit.mod |  13 +
 gcc/testsuite/gm2/pim/pass/highbit2.mod|  13 +
 gcc/testsuite/gm2/pimlib/run/pass/format2.mod  |  63 +++
 gcc/testsuite/lib/gm2-dg.exp   |  37 +-
 libcpp/po/ChangeLog|  16 +
 libcpp/po/es.po|  66 +--
 libcpp/po/zh_CN.po |  61 +-
 libgfortran/ChangeLog  |  54 ++
 libgfortran/generated/findloc2_s1.c|   4 +-
 libgfortran/generated/findloc2_s4.c|   4 +-
 libgfortran/generated/maxloc1_16_s1.c  |   5 +-
 libgfortran/generated/maxloc1_16_s4.c  |   5 +-
 libgfortran/generated/maxloc1_4_s1.c   |   5 +-
 libgfortran/generated/maxloc1_4_s4.c   |   5 +-
 libgfortran/generated/maxloc1_8_s1.c   |   5 +-
 libgfortran/generated/maxloc1_8_s4.c   |   5 +-
 libgfortran/generated/maxloc2_16_s1.c  |   4 +-
 libgfortran/generated/maxloc2_16_s4.c  |   4 +-
 libgfortran/generated/maxloc2_4_s1.c   |   4 +-
 libgfortran/generated/maxloc2_4_s4.c   |   4 +-
 libgfortran/gener

[gcc/devel/omp/gcc-15] (53 commits) Merge branch 'releases/gcc-15' into devel/omp/gcc-15

2025-05-20 Thread Tobias Burnus via Gcc-cvs
The branch 'devel/omp/gcc-15' was updated to point to:

 bc76738d12f0... Merge branch 'releases/gcc-15' into devel/omp/gcc-15

It previously pointed to:

 033dc40acd5c... ChangeLog.omp bump

Diff:

Summary of changes (added commits):
---

  bc76738... Merge branch 'releases/gcc-15' into devel/omp/gcc-15
  911cfea... libstdc++: Fix incorrect links to archived SGI STL docs (*)
  2d1244a... c++/modules: Fix ICE on merge of instantiation with partial (*)
  3ba1b0a... c++/modules: Always mark tinfo vars as TREE_ADDRESSABLE [PR (*)
  fedf81e... Daily bump. (*)
  06a10db... libstdc++: Fix some Clang -Wsystem-headers warnings in  for C++17 [PR1201 (*)
  d06a800... libstdc++: Restore std::scoped_lock for non-gthreads target (*)
  c9e3181... c+: -Wabi false positive [PR120012] (*)

(*) This commit already exists in another branch.
Because the reference `refs/heads/devel/omp/gcc-15' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] gimple-exec: prise en charge écrasement adresse

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:140b1b46af178e33c48e6ca526b653d130f7b49a

commit 140b1b46af178e33c48e6ca526b653d130f7b49a
Author: Mikael Morin 
Date:   Tue May 20 17:19:02 2025 +0200

gimple-exec: prise en charge écrasement adresse

Diff:
---
 gcc/cgraphunit.cc | 29 +
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index 721d15405b4a..62fb874dbdba 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -2418,13 +2418,22 @@ struct storage_address
 struct stored_address
 {
   storage_address address;
-  unsigned position;
+  HOST_WIDE_INT position;
 
-  stored_address (storage_address addr, unsigned pos)
+  stored_address (storage_address addr, HOST_WIDE_INT pos)
 : address (addr), position (pos)
   {}
+  void invalidate ();
 };
 
+
+void
+stored_address::invalidate ()
+{
+  position = HOST_WIDE_INT_M1;
+}
+
+
 namespace selftest
 {
   void data_value_classify_tests ();
@@ -2456,7 +2465,7 @@ class data_value
   vec addresses;
   void set_cst_at (unsigned dest_offset, unsigned value_width,
   const wide_int &val, unsigned src_offset);
-  stored_address *find_address (unsigned offset) const;
+  stored_address *find_address (HOST_WIDE_INT offset) const;
 
   friend void selftest::data_value_classify_tests ();
   friend void selftest::data_value_set_address_tests ();
@@ -3250,7 +3259,7 @@ data_value::classify (unsigned offset, unsigned width) 
const
 
 
 stored_address *
-data_value::find_address (unsigned offset) const
+data_value::find_address (HOST_WIDE_INT offset) const
 {
   gcc_assert (offset <= bit_width - HOST_BITS_PER_PTR);
 
@@ -3279,8 +3288,7 @@ data_value::set_address_at (storage_address & address, 
unsigned offset)
 {
   stored_address *existing_address = find_address (offset);
   gcc_assert (existing_address != nullptr);
-  /* Invalidate existing address.  */
-  existing_address->position = -1;
+  existing_address->invalidate ();
 }
 
   constant_mask &= ~mask;
@@ -3324,8 +3332,13 @@ data_value::set_cst_at (unsigned dest_offset, unsigned 
value_width,
   enum value_type orig_type = classify (dest_offset, value_width);
   wide_int dest_mask = wi::shifted_mask (dest_offset, value_width, false,
 bit_width);
-  // TODO: invalidate existing address if any
-  gcc_assert (orig_type != VAL_ADDRESS);
+  if (orig_type == VAL_ADDRESS)
+{
+  stored_address *existing_address = find_address (dest_offset);
+  if (existing_address)
+   existing_address->invalidate ();
+}
+
   if (orig_type != VAL_CONSTANT)
 {
   constant_mask |= dest_mask;


[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction partielle maxval_char_4

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:f95d5a5ea51c923525e84f5817a94064ab99133d

commit f95d5a5ea51c923525e84f5817a94064ab99133d
Author: Mikael Morin 
Date:   Tue May 20 14:20:24 2025 +0200

Correction partielle maxval_char_4

Diff:
---
 libgfortran/generated/maxloc0_16_s1.c | 16 +++---
 libgfortran/generated/maxloc0_16_s4.c | 16 +++---
 libgfortran/generated/maxloc0_4_s1.c  | 16 +++---
 libgfortran/generated/maxloc0_4_s4.c  | 16 +++---
 libgfortran/generated/maxloc0_8_s1.c  | 16 +++---
 libgfortran/generated/maxloc0_8_s4.c  | 16 +++---
 libgfortran/generated/maxval1_s1.c| 13 +++--
 libgfortran/generated/maxval1_s4.c| 13 +++--
 libgfortran/generated/minloc0_16_s1.c | 16 +++---
 libgfortran/generated/minloc0_16_s4.c | 16 +++---
 libgfortran/generated/minloc0_4_s1.c  | 16 +++---
 libgfortran/generated/minloc0_4_s4.c  | 16 +++---
 libgfortran/generated/minloc0_8_s1.c  | 16 +++---
 libgfortran/generated/minloc0_8_s4.c  | 16 +++---
 libgfortran/generated/minval1_s1.c| 13 +++--
 libgfortran/generated/minval1_s4.c| 13 +++--
 libgfortran/m4/ifunction-s2.m4| 99 ++-
 17 files changed, 179 insertions(+), 164 deletions(-)

diff --git a/libgfortran/generated/maxloc0_16_s1.c 
b/libgfortran/generated/maxloc0_16_s1.c
index 7056d7fca55b..47697cdd3795 100644
--- a/libgfortran/generated/maxloc0_16_s1.c
+++ b/libgfortran/generated/maxloc0_16_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+extern void maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_16_s1);
 
 void
-maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_16_s1 (gfc_array_i16 * const restrict, 
+extern void mmaxloc0_16_s1 (gfc_array_i16 * const restrict,
gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
gfc_charlen_type len);
 export_proto(mmaxloc0_16_s1);
 
 void
-mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
gfc_array_s1 * const restrict array,
gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL)
 {
-#ifdef HAVE_BACK_ARG
+#ifdef HAVE_BACK_ARG
   maxloc0_16_s1 (retarray, array, back, len);
 #else
   maxloc0_16_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void smaxloc0_16_s1 (gfc_array_i16 * const restrict, 
+extern void smaxloc0_16_s1 (gfc_array_i16 * const restrict,
gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
gfc_charlen_type len);
 export_proto(smaxloc0_16_s1);
 
 void
-smaxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+smaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL || *mask)
 {
-#ifdef HAVE_BACK_ARG
+#ifdef HAVE_BACK_ARG
   maxloc0_16_s1 (retarray, array, back, len);
 #else
   maxloc0_16_s1 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc0_16_s4.c 
b/libgfortran/generated/maxloc0_16_s4.c
index 095f8a169e93..d719520688b0 100644
--- a/libgfortran/generated/maxloc0_16_s4.c
+++ b/libgfortran/generated/maxloc0_16_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+extern void maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_16_s4);
 
 void
-maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_16_s4 (gfc_array_i16 * const restrict, 
+extern void mmaxloc0_16_s4 (gfc_array_i16 * const restrict,
gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
gfc_charlen_type len);
 export_proto(mmaxloc0_16_s4);
 
 void
-mmaxloc0_16_s4 (gfc_array_

[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression maxval_char_4

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:37157d145c9c8864bbd80fc00541e07d1b9e77b6

commit 37157d145c9c8864bbd80fc00541e07d1b9e77b6
Author: Mikael Morin 
Date:   Tue May 20 15:39:49 2025 +0200

Correction régression maxval_char_4

Diff:
---
 libgfortran/generated/maxval1_s1.c | 5 +++--
 libgfortran/generated/maxval1_s4.c | 5 +++--
 libgfortran/generated/minval1_s1.c | 5 +++--
 libgfortran/generated/minval1_s4.c | 5 +++--
 libgfortran/m4/ifunction-s2.m4 | 1 -
 libgfortran/m4/maxval1s.m4 | 4 +++-
 libgfortran/m4/minval1s.m4 | 4 +++-
 7 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/libgfortran/generated/maxval1_s1.c 
b/libgfortran/generated/maxval1_s1.c
index e4c487e3cb77..9a9e8e0d3a83 100644
--- a/libgfortran/generated/maxval1_s1.c
+++ b/libgfortran/generated/maxval1_s1.c
@@ -359,8 +359,10 @@ mmaxval1_s1 (gfc_array_s1 * const restrict retarray,
retval = src;
break;
  }
+   src = (GFC_UINTEGER_1*) (((char*)src) + delta);
+   msrc += mdelta;
}
-   for (; n < len; n++, src += delta, msrc += mdelta)
+   for (; n < len; n++)
  {
if (*msrc && compare_fcn (src, retval, string_len) > 0)
  {
@@ -419,7 +421,6 @@ smaxval1_s1 (gfc_array_s1 * const restrict retarray,
gfc_charlen_type xlen, gfc_array_s1 * const restrict array, 
const index_type * const restrict pdim,
GFC_LOGICAL_4 *mask, gfc_charlen_type string_len)
-
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
diff --git a/libgfortran/generated/maxval1_s4.c 
b/libgfortran/generated/maxval1_s4.c
index 686e18276a12..0c2d4733a9ff 100644
--- a/libgfortran/generated/maxval1_s4.c
+++ b/libgfortran/generated/maxval1_s4.c
@@ -359,8 +359,10 @@ mmaxval1_s4 (gfc_array_s4 * const restrict retarray,
retval = src;
break;
  }
+   src = (GFC_UINTEGER_4*) (((char*)src) + delta);
+   msrc += mdelta;
}
-   for (; n < len; n++, src += delta, msrc += mdelta)
+   for (; n < len; n++)
  {
if (*msrc && compare_fcn (src, retval, string_len) > 0)
  {
@@ -419,7 +421,6 @@ smaxval1_s4 (gfc_array_s4 * const restrict retarray,
gfc_charlen_type xlen, gfc_array_s4 * const restrict array, 
const index_type * const restrict pdim,
GFC_LOGICAL_4 *mask, gfc_charlen_type string_len)
-
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
diff --git a/libgfortran/generated/minval1_s1.c 
b/libgfortran/generated/minval1_s1.c
index 00f4473c3b45..cd60a26b8ef9 100644
--- a/libgfortran/generated/minval1_s1.c
+++ b/libgfortran/generated/minval1_s1.c
@@ -359,8 +359,10 @@ mminval1_s1 (gfc_array_s1 * const restrict retarray,
retval = src;
break;
  }
+   src = (GFC_UINTEGER_1*) (((char*)src) + delta);
+   msrc += mdelta;
}
-   for (; n < len; n++, src += delta, msrc += mdelta)
+   for (; n < len; n++)
  {
if (*msrc && compare_fcn (src, retval, string_len) < 0)
  {
@@ -419,7 +421,6 @@ sminval1_s1 (gfc_array_s1 * const restrict retarray,
gfc_charlen_type xlen, gfc_array_s1 * const restrict array, 
const index_type * const restrict pdim,
GFC_LOGICAL_4 *mask, gfc_charlen_type string_len)
-
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
diff --git a/libgfortran/generated/minval1_s4.c 
b/libgfortran/generated/minval1_s4.c
index 1ecbc7b75f25..9a21602c30b1 100644
--- a/libgfortran/generated/minval1_s4.c
+++ b/libgfortran/generated/minval1_s4.c
@@ -359,8 +359,10 @@ mminval1_s4 (gfc_array_s4 * const restrict retarray,
retval = src;
break;
  }
+   src = (GFC_UINTEGER_4*) (((char*)src) + delta);
+   msrc += mdelta;
}
-   for (; n < len; n++, src += delta, msrc += mdelta)
+   for (; n < len; n++)
  {
if (*msrc && compare_fcn (src, retval, string_len) < 0)
  {
@@ -419,7 +421,6 @@ sminval1_s4 (gfc_array_s4 * const restrict retarray,
gfc_charlen_type xlen, gfc_array_s4 * const restrict array, 
const index_type * const restrict pdim,
GFC_LOGICAL_4 *mask, gfc_charlen_type string_len)
-
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
diff --git a/libgfortran/m4/ifunction-s2.m4 b/libgfortran/m4/ifunction-s2.m4
index beb3fd95ad11..4da7080f1d7b 100644
--- a/libgfortran/m4/ifunction-s2.m4
+++ b/libgfortran/m4/ifunction-s2.m4
@@ -391,7 +391,6 @@ s'name`'rtype_qual`_'atype_code` ('rtype` * const restrict 
retarray,
gfc_charlen_type

[gcc r15-9716] ipa: Dump cgraph_node UID instead of order into ipa-clones dump file

2025-05-20 Thread Martin Jambor via Gcc-cvs
https://gcc.gnu.org/g:76d16fbd802a10faabf63945dd34f351aea087dc

commit r15-9716-g76d16fbd802a10faabf63945dd34f351aea087dc
Author: Martin Jambor 
Date:   Fri May 16 17:13:51 2025 +0200

ipa: Dump cgraph_node UID instead of order into ipa-clones dump file

Since starting from GCC 15 the order is not unique for any
symtab_nodes but m_uid is, I believe we ought to dump the latter in
the ipa-clones dump, if only so that people can reliably match entries
about new clones to those about removed nodes (if any).

This patch also contains a fixes to a few other places where we have
so far dumped order to our ordinary dumps and which have been
identified by Michal Jires.

gcc/ChangeLog:

2025-05-16  Martin Jambor  

* cgraph.h (symtab_node): Make member function get_uid const.
* cgraphclones.cc (dump_callgraph_transformation): Dump m_uid of the
call graph nodes instead of order.
* cgraph.cc (cgraph_node::remove): Likewise.
* ipa-cp.cc (ipcp_lattice::print): Likewise.
* ipa-sra.cc (ipa_sra_summarize_function): Likewise.
* symtab.cc (symtab_node::dump_base): Likewise.

Co-Authored-By: Michal Jires 
(cherry picked from commit 9fa534f0831892393885e64596a0d6ca8c4078b6)

Diff:
---
 gcc/cgraph.cc   | 2 +-
 gcc/cgraph.h| 2 +-
 gcc/cgraphclones.cc | 4 ++--
 gcc/ipa-cp.cc   | 2 +-
 gcc/ipa-sra.cc  | 2 +-
 gcc/symtab.cc   | 4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 6ae6a97f6f56..48646de6aa32 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1879,7 +1879,7 @@ cgraph_node::remove (void)
   clone_info *info, saved_info;
   if (symtab->ipa_clones_dump_file && symtab->cloned_nodes.contains (this))
 fprintf (symtab->ipa_clones_dump_file,
-"Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), order,
+"Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), get_uid (),
 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
 DECL_SOURCE_COLUMN (decl));
 
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index abde770ba2b3..45119e3dce9e 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -493,7 +493,7 @@ public:
   static inline void checking_verify_symtab_nodes (void);
 
   /* Get unique identifier of the node.  */
-  inline int get_uid ()
+  inline int get_uid () const
   {
 return m_uid;
   }
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index bf5bc41cde9c..3c9c642bdec4 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -324,11 +324,11 @@ dump_callgraph_transformation (const cgraph_node 
*original,
 {
   fprintf (symtab->ipa_clones_dump_file,
   "Callgraph clone;%s;%d;%s;%d;%d;%s;%d;%s;%d;%d;%s\n",
-  original->asm_name (), original->order,
+  original->asm_name (), original->get_uid (),
   DECL_SOURCE_FILE (original->decl),
   DECL_SOURCE_LINE (original->decl),
   DECL_SOURCE_COLUMN (original->decl), clone->asm_name (),
-  clone->order, DECL_SOURCE_FILE (clone->decl),
+  clone->get_uid (), DECL_SOURCE_FILE (clone->decl),
   DECL_SOURCE_LINE (clone->decl), DECL_SOURCE_COLUMN (clone->decl),
   suffix);
 
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index a8ff3c870731..7ce9ba776961 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -292,7 +292,7 @@ ipcp_lattice::print (FILE * f, bool dump_sources, 
bool dump_benefits)
  else
fprintf (f, " [scc: %i, from:", val->scc_no);
  for (s = val->sources; s; s = s->next)
-   fprintf (f, " %i(%f)", s->cs->caller->order,
+   fprintf (f, " %i(%f)", s->cs->caller->get_uid (),
 s->cs->sreal_frequency ().to_double ());
  fprintf (f, "]");
}
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 1331ba49b507..88bfae9502c7 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -4644,7 +4644,7 @@ ipa_sra_summarize_function (cgraph_node *node)
 {
   if (dump_file)
 fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (),
-node->order);
+node->get_uid ());
   gcc_obstack_init (&gensum_obstack);
   loaded_decls = new hash_set;
 
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index fe9c031247f9..fc1155f46964 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -989,10 +989,10 @@ symtab_node::dump_base (FILE *f)
 same_comdat_group->dump_asm_name ());
   if (next_sharing_asm_name)
 fprintf (f, "  next sharing asm name: %i\n",
-next_sharing_asm_name->order);
+next_sharing_asm_name->get_uid ());
   if (previous_sharing_asm_name)
 fprintf (f, "  previous sharing asm name: %i\n",
-previous_sharing_asm_name->order);
+previous_sharing_asm_name->get_uid ());
 
   if (address_taken)
 fprintf (f, "  Address is taken.\n");


[gcc r15-9717] tree-sra: Do not create stores into const aggregates (PR111873)

2025-05-20 Thread Martin Jambor via Gcc-cvs
https://gcc.gnu.org/g:c1db46f7e51d4a546ca536f7f10e548f02e5cc12

commit r15-9717-gc1db46f7e51d4a546ca536f7f10e548f02e5cc12
Author: Martin Jambor 
Date:   Wed May 14 12:08:24 2025 +0200

tree-sra: Do not create stores into const aggregates (PR111873)

This patch fixes (hopefully the) one remaining place where gimple SRA
was still creating a load into const aggregates.  It occurs when there
is a replacement for a load but that replacement is not type
compatible - typically because it is a single field structure.

I have used testcases from duplicates because the original test-case
no longer reproduces for me.

gcc/ChangeLog:

2025-05-13  Martin Jambor  

PR tree-optimization/111873
* tree-sra.cc (sra_modify_expr): When processing a load which has
a type-incompatible replacement, do not store the contents of the
replacement into the original aggregate when that aggregate is
const.

gcc/testsuite/ChangeLog:

2025-05-13  Martin Jambor  

* gcc.dg/ipa/pr120044-1.c: New test.
* gcc.dg/ipa/pr120044-2.c: Likewise.
* gcc.dg/tree-ssa/pr114864.c: Likewise.

(cherry picked from commit 9d039eff453f777c58642ff16178c1ce2a4be6ab)

Diff:
---
 gcc/testsuite/gcc.dg/ipa/pr120044-1.c| 17 +
 gcc/testsuite/gcc.dg/ipa/pr120044-2.c| 17 +
 gcc/testsuite/gcc.dg/tree-ssa/pr114864.c | 15 +++
 gcc/tree-sra.cc  |  4 +++-
 4 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-1.c 
b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c
new file mode 100644
index ..f9fee3e85afb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre 
-fno-code-hoisting -fno-inline" } */
+
+struct a {
+  int b;
+} const c;
+void d(char p, struct a e) {
+  while (e.b)
+;
+}
+static unsigned short f(const struct a g) {
+  d(g.b, g);
+  return g.b;
+}
+int main() {
+  return f(c);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-2.c 
b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c
new file mode 100644
index ..5130791f5444
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre 
-fno-code-hoisting -fno-ipa-cp" } */
+
+struct a {
+  int b;
+} const c;
+void d(char p, struct a e) {
+  while (e.b)
+;
+}
+static unsigned short f(const struct a g) {
+  d(g.b, g);
+  return g.b;
+}
+int main() {
+  return f(c);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c 
b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
new file mode 100644
index ..cd9b94c094fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-tree-dce -fno-tree-fre" } */
+
+struct a {
+  int b;
+} const c;
+void d(const struct a f) {}
+void e(const struct a f) {
+  f.b == 0 ? 1 : f.b;
+  d(f);
+}
+int main() {
+  e(c);
+  return 0;
+}
diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index 302b73e83b8f..4b6daf772841 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -4205,8 +4205,10 @@ sra_modify_expr (tree *expr, bool write, 
gimple_stmt_iterator *stmt_gsi,
}
  else
{
- gassign *stmt;
+ if (TREE_READONLY (access->base))
+   return false;
 
+ gassign *stmt;
  if (access->grp_partial_lhs)
repl = force_gimple_operand_gsi (stmt_gsi, repl, true,
 NULL_TREE, true,


[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression pointer_array_5

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:e5e42dae1cc1ee5001e62f2826730d56240662e3

commit e5e42dae1cc1ee5001e62f2826730d56240662e3
Author: Mikael Morin 
Date:   Tue May 20 17:18:38 2025 +0200

Correction régression pointer_array_5

Diff:
---
 gcc/fortran/trans-array.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index d8d7aa9b97c1..9a20f3a73583 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -7067,7 +7067,7 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, 
tree desc, tree offset,
}
 
  /* Apply the index to obtain the array element.  */
- tmp = gfc_build_array_ref (tmp, index, true);
+ tmp = gfc_build_array_ref (tmp, index, true, gfc_index_zero_node);
  break;
 
case REF_INQUIRY:


[gcc r16-762] [PATCH v2 1/2] The following changes enable P8700 processor for RISCV and P8700 is a high-performanc

2025-05-20 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:1186a2bd6e187d512030233171293ee87b608189

commit r16-762-g1186a2bd6e187d512030233171293ee87b608189
Author: Umesh Kalappa 
Date:   Tue May 20 11:50:46 2025 -0600

[PATCH v2 1/2] The following changes enable P8700 processor for RISCV and 
P8700 is a high-performance processor from MIPS by extending RISCV with custom 
instructions

Add support for the p8700 design from MIPS.

gcc/
* config/riscv/mips-p8700.md: New scheduler model.
* config/riscv/riscv-cores.def (mips-p87000): New tuning model
and core architecture.
* config/riscv/riscv-opts.h (riscv_microarchitecture_type); Add
mips-p8700.
* config/riscv/riscv.cc (mips_p8700_tune_info): New uarch
tuning parameters.
* config/riscv/riscv.md (tune): Add mips_p8700.
Include mips-p8700.md
* doc/invoke.texi: Document tune/cpu options for the MIPS P8700.

Co-authored-by: Jeff Law 

Diff:
---
 gcc/config/riscv/mips-p8700.md   | 139 +++
 gcc/config/riscv/riscv-cores.def |   5 ++
 gcc/config/riscv/riscv-opts.h|   3 +-
 gcc/config/riscv/riscv.cc|  22 +++
 gcc/config/riscv/riscv.md|   3 +-
 gcc/doc/invoke.texi  |  14 ++--
 6 files changed, 177 insertions(+), 9 deletions(-)

diff --git a/gcc/config/riscv/mips-p8700.md b/gcc/config/riscv/mips-p8700.md
new file mode 100644
index ..11d0b1ca7930
--- /dev/null
+++ b/gcc/config/riscv/mips-p8700.md
@@ -0,0 +1,139 @@
+;; DFA-based pipeline description for MIPS P8700.
+;;
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 3, or (at your
+;; option) any later version.
+
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; .
+
+(define_automaton "mips_p8700_agen_alq_pipe, mips_p8700_mdu_pipe, 
mips_p8700_fpu_pipe")
+
+;; The address generation queue (AGQ) has AL2, CTISTD and LDSTA pipes
+(define_cpu_unit "mips_p8700_agq, mips_p8700_al2, mips_p8700_ctistd, 
mips_p8700_lsu"
+"mips_p8700_agen_alq_pipe")
+
+(define_cpu_unit "mips_p8700_gpmul, mips_p8700_gpdiv" "mips_p8700_mdu_pipe")
+
+;; The arithmetic-logic-unit queue (ALQ) has ALU pipe
+(define_cpu_unit "mips_p8700_alq, mips_p8700_alu" "mips_p8700_agen_alq_pipe")
+
+;; The floating-point-unit queue (FPQ) has short and long pipes
+(define_cpu_unit "mips_p8700_fpu_short, mips_p8700_fpu_long" 
"mips_p8700_fpu_pipe")
+
+;; Long FPU pipeline.
+(define_cpu_unit "mips_p8700_fpu_apu" "mips_p8700_fpu_pipe")
+
+(define_reservation "mips_p8700_agq_al2" "mips_p8700_agq, mips_p8700_al2")
+(define_reservation "mips_p8700_agq_ctistd" "mips_p8700_agq, 
mips_p8700_ctistd")
+(define_reservation "mips_p8700_agq_lsu" "mips_p8700_agq, mips_p8700_lsu")
+(define_reservation "mips_p8700_alq_alu" "mips_p8700_alq, mips_p8700_alu")
+
+;;
+;; FPU pipe
+;;
+
+(define_insn_reservation "mips_p8700_fpu_fadd" 4
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fadd"))
+  "mips_p8700_fpu_long, mips_p8700_fpu_apu")
+
+(define_insn_reservation "mips_p8700_fpu_fabs" 2
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fcmp,fmove"))
+  "mips_p8700_fpu_short, mips_p8700_fpu_apu")
+
+(define_insn_reservation "mips_p8700_fpu_fload" 8
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fpload"))
+  "mips_p8700_agq_lsu")
+
+(define_insn_reservation "mips_p8700_fpu_fstore" 1
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fpstore"))
+  "mips_p8700_agq_lsu")
+
+(define_insn_reservation "mips_p8700_fpu_fmadd" 8
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fmadd"))
+  "mips_p8700_fpu_long, mips_p8700_fpu_apu")
+
+(define_insn_reservation "mips_p8700_fpu_fmul" 5
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fmul"))
+  "mips_p8700_fpu_long, mips_p8700_fpu_apu")
+
+(define_insn_reservation "mips_p8700_fpu_div" 17
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fdiv,fsqrt"))
+  "mips_p8700_fpu_long, mips_p8700_fpu_apu*17")
+
+(define_insn_reservation "mips_p8700_fpu_fcvt" 4
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "fcvt,fcvt_i2f,fcvt_f2i"))
+  "mips_p8700_fpu_long, mips_p8700_fpu_apu")
+
+(define_insn_reservation "mips_p8700_fpu_fmtc" 7
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "mtc"))
+  "mips_p8700_agq_lsu")
+
+(define_insn_reservation "mips_p8700_fpu_fmf

[gcc r16-763] [PATCH v2 2/2] MIPS p8700 doesn't have vector extension and added the dummies reservation for the sa

2025-05-20 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:18f272ec3364bcffac2d798a3a744ff2d4c0f7d5

commit r16-763-g18f272ec3364bcffac2d798a3a744ff2d4c0f7d5
Author: Umesh Kalappa 
Date:   Tue May 20 11:57:00 2025 -0600

[PATCH v2 2/2] MIPS p8700 doesn't have vector extension and added the 
dummies reservation for the same.

The RISC-V backend requires all types to map to a reservation in the
scheduler model.  This adds types to a dummy reservation for all the
types not currently handled by the p8700 model.

gcc/
* config/riscv/mips-p8700.md (mips_p8700_dummies): New
reservation.
(mips_p8700_unknown): Reservation for all the dummies.

Diff:
---
 gcc/config/riscv/mips-p8700.md | 28 
 1 file changed, 28 insertions(+)

diff --git a/gcc/config/riscv/mips-p8700.md b/gcc/config/riscv/mips-p8700.md
index 11d0b1ca7930..ae0ea8dc896f 100644
--- a/gcc/config/riscv/mips-p8700.md
+++ b/gcc/config/riscv/mips-p8700.md
@@ -35,6 +35,11 @@
 ;; Long FPU pipeline.
 (define_cpu_unit "mips_p8700_fpu_apu" "mips_p8700_fpu_pipe")
 
+;; P8700 unsupported insns are mapped to dummies reservations
+(define_reservation "mips_p8700_dummies"
+ "mips_p8700_agq |  mips_p8700_al2 |  mips_p8700_ctistd |  mips_p8700_lsu |
+ mips_p8700_fpu_short |  mips_p8700_fpu_long")
+
 (define_reservation "mips_p8700_agq_al2" "mips_p8700_agq, mips_p8700_al2")
 (define_reservation "mips_p8700_agq_ctistd" "mips_p8700_agq, 
mips_p8700_ctistd")
 (define_reservation "mips_p8700_agq_lsu" "mips_p8700_agq, mips_p8700_lsu")
@@ -137,3 +142,26 @@
   (and (eq_attr "tune" "mips_p8700")
(eq_attr "type" "call,jalr"))
   "mips_p8700_agq_ctistd")
+
+;; mips-p8700 dummies insn and placeholder that had no mapping to p8700 
hardware.
+(define_insn_reservation "mips_p8700_unknown" 1
+  (and (eq_attr "tune" "mips_p8700")
+   (eq_attr "type" "rdvlenb,rdvl,wrvxrm,wrfrm,
+   rdfrm,vsetvl,vsetvl_pre,vlde,vste,vldm,vstm,vlds,vsts,
+   vldux,vldox,vstux,vstox,vldff,vldr,vstr,
+   
vlsegde,vssegte,vlsegds,vssegts,vlsegdux,vlsegdox,vssegtux,vssegtox,vlsegdff,
+   vialu,viwalu,vext,vicalu,vshift,vnshift,vicmp,viminmax,
+   vimul,vidiv,viwmul,vimuladd,sf_vqmacc,viwmuladd,vimerge,vimov,
+   vsalu,vaalu,vsmul,vsshift,vnclip,sf_vfnrclip,
+   vfalu,vfwalu,vfmul,vfdiv,vfwmul,vfmuladd,vfwmuladd,vfsqrt,vfrecp,
+   vfcmp,vfminmax,vfsgnj,vfclass,vfmerge,vfmov,
+   vfcvtitof,vfcvtftoi,vfwcvtitof,vfwcvtftoi,
+   vfwcvtftof,vfncvtitof,vfncvtftoi,vfncvtftof,
+   vired,viwred,vfredu,vfredo,vfwredu,vfwredo,
+   vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,vfmovvf,vfmovfv,
+   vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,
+   
vgather,vcompress,vmov,vector,vandn,vbrev,vbrev8,vrev8,vclz,vctz,vcpop,vrol,vror,vwsll,
+   
vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz,
+   
vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16,
+   sf_vc,sf_vc_se"))
+  "mips_p8700_dummies")


[gcc r16-768] [RISC-V] Infrastructure of synthesizing logical AND with constant

2025-05-20 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:5568277c005f5edda0ce444e11abd1d5845d6ee7

commit r16-768-g5568277c005f5edda0ce444e11abd1d5845d6ee7
Author: Shreya Munnangi 
Date:   Tue May 20 20:15:42 2025 -0600

[RISC-V] Infrastructure of synthesizing logical AND with constant

So this is the next step on the path to mvconst_internal removal and is work
from Shreya and myself.

This puts in the infrastructure to allow us to synthesize logical AND much 
like
we're doing with logical IOR/XOR.

Unlike IOR/XOR, AND has many more special cases that can be profitable. For
example, you can use shifts to clear many bits.  You can use zero extension 
to
clear bits, you can use rotate+andi+rotate, shift pairs, etc.

So to make potential bisecting easy the plan is to drop in the work on 
logical
AND in several steps, essentially one new case at a time.

This step just puts the basics of a operation synthesis in place.  It still
uses the same code generation strategies as we are currently using.

I'd like to say this is NFC, but unfortunately that's not true.  While the 
code
generation strategy is the same, this does indirectly introduce new 
REG_EQUAL
notes.  Those additional notes in turn can impact how various optimizers 
behave
in very minor ways.

As usual, this has survived my tester on riscv32-elf and riscv64-elf.

Waiting on pre-commit to do its thing.  And I'll start queuing up the
additional cases we want to handle while waiting 😉

gcc/
* config/riscv/riscv-protos.h (synthesize_and): Prototype.
* config/riscv/riscv.cc (synthesize_and): New function.
* config/riscv/riscv.md (and3): Use it.

Co-Authored-By: Jeff Law  

Diff:
---
 gcc/config/riscv/riscv-protos.h |  1 +
 gcc/config/riscv/riscv.cc   | 64 +
 gcc/config/riscv/riscv.md   | 21 ++
 3 files changed, 63 insertions(+), 23 deletions(-)

diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h
index b39b858acac8..d8c8f6b5079f 100644
--- a/gcc/config/riscv/riscv-protos.h
+++ b/gcc/config/riscv/riscv-protos.h
@@ -141,6 +141,7 @@ extern void riscv_expand_ustrunc (rtx, rtx);
 extern void riscv_expand_sstrunc (rtx, rtx);
 extern int riscv_register_move_cost (machine_mode, reg_class_t, reg_class_t);
 extern bool synthesize_ior_xor (rtx_code, rtx [3]);
+extern bool synthesize_and (rtx [3]);
 
 #ifdef RTX_CODE
 extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx, bool 
*invert_ptr = 0);
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 4c5bb02754df..1a88e96d8c6f 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14300,7 +14300,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
  we clear bits in IVAL.  Once IVAL is zero, then synthesis of the
  operation is complete.  */
   unsigned HOST_WIDE_INT ival = INTVAL (operands[2]);
-  
+
   /* Check if we want to use [x]ori. Then get the remaining bits
  and decrease the budget by one. */
   if ((ival & HOST_WIDE_INT_UC (0x7ff)) != 0)
@@ -14435,14 +14435,14 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
}
 }
 
-  /* If after accounting for bseti the remaining budget has 
+  /* If after accounting for bseti the remaining budget has
  gone to less than zero, it forces the value into a
  register and performs the IOR operation.  It returns
  TRUE to the caller so the caller knows code generation
  is complete. */
   if (budget < 0)
 {
-  rtx x = force_reg (word_mode, operands[2]); 
+  rtx x = force_reg (word_mode, operands[2]);
   x = gen_rtx_fmt_ee (code, word_mode, operands[1], x);
   emit_insn (gen_rtx_SET (operands[0], x));
   return true;
@@ -14466,8 +14466,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
 }
 
   /* We figure out a single bit as a constant and
- generate a CONST_INT node for that.  Then we 
- construct the IOR node, then the SET node and 
+ generate a CONST_INT node for that.  Then we
+ construct the IOR node, then the SET node and
  emit it.  An IOR with a suitable constant that is
  a single bit will be implemented with a bseti. */
   while (ival)
@@ -14486,6 +14486,60 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   return true;
 }
 
+/* Synthesize OPERANDS[0] = OPERANDS[1] & OPERANDS[2].
+
+OPERANDS[0] and OPERANDS[1] will be a REG and may be the same
+REG.
+
+OPERANDS[2] is a CONST_INT.
+
+Return TRUE if the operation was fully synthesized and the caller
+need not generate additional code.  Return FALSE if the operation
+was not synthesized and the caller is responsible for emitting the
+proper sequence.  */
+
+bool
+synthesize_and (rtx operands[3])
+{
+  /* Trivial cases that don't need synthesis.  */
+  if (SMALL_OPERAND (INTVAL (operands[2]))
+ || (TARGET_ZBS &

[gcc r16-767] Add pattern match in match.pd for .AVG_CEIL

2025-05-20 Thread hongtao Liu via Gcc-cvs
https://gcc.gnu.org/g:72f0b446d2c03866ebe4cae125e32fef598e924d

commit r16-767-g72f0b446d2c03866ebe4cae125e32fef598e924d
Author: liuhongt 
Date:   Tue Feb 25 22:48:27 2025 -0800

Add pattern match in match.pd for .AVG_CEIL

1) Optimize (a >> 1) + (b >> 1) + ((a | b) & 1) to .AVG_CEIL (a, b)
2) Optimize (a | b) - ((a ^ b) >> 1) to .AVG_CEIL (a, b)

gcc/ChangeLog:

PR middle-end/118994
* match.pd ((a >> 1) + (b >> 1) + ((a | b) & 1) to
.AVG_CEIL (a, b)): New pattern.
((a | b) - ((a ^ b) >> 1) to .AVG_CEIL (a, b)): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr118994-1.c: New test.
* gcc.target/i386/pr118994-2.c: New test.

Diff:
---
 gcc/match.pd   | 23 +++
 gcc/testsuite/gcc.target/i386/pr118994-1.c | 37 ++
 gcc/testsuite/gcc.target/i386/pr118994-2.c | 37 ++
 3 files changed, 97 insertions(+)

diff --git a/gcc/match.pd b/gcc/match.pd
index 3b827df4cd6c..27f662f9714b 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -11486,3 +11486,26 @@ and,
   }
   (if (full_perm_p)
(vec_perm (op@3 @0 @1) @3 @2))
+
+#if GIMPLE
+/* Simplify (a >> 1) + (b >> 1) + ((a | b) & 1) to .AVG_CEIL (a, b).
+   Similar for (a | b) - ((a ^ b) >> 1).  */
+
+(simplify
+  (plus:c
+(plus (rshift @0 integer_onep@1) (rshift @2 @1))
+(bit_and (bit_ior @0 @2) integer_onep@3))
+  (if (cfun && (cfun->curr_properties & PROP_last_full_fold) != 0
+  && VECTOR_TYPE_P (type)
+  && direct_internal_fn_supported_p (IFN_AVG_CEIL, type, 
OPTIMIZE_FOR_BOTH))
+  (IFN_AVG_CEIL @0 @2)))
+
+(simplify
+  (minus
+(bit_ior @0 @2)
+(rshift (bit_xor @0 @2) integer_onep@1))
+  (if (cfun && (cfun->curr_properties & PROP_last_full_fold) != 0
+  && VECTOR_TYPE_P (type)
+  && direct_internal_fn_supported_p (IFN_AVG_CEIL, type, 
OPTIMIZE_FOR_BOTH))
+  (IFN_AVG_CEIL @0 @2)))
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr118994-1.c 
b/gcc/testsuite/gcc.target/i386/pr118994-1.c
new file mode 100644
index ..5f40ababcccf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr118994-1.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vl -O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "\.AVG_CEIL" 6 "optimized"} } */
+
+#define VecRoundingAvg(a, b) ((a >> 1) + (b >> 1) + ((a | b) & 1))
+
+typedef unsigned char GccU8x16Vec __attribute__((__vector_size__(16)));
+typedef unsigned short GccU16x8Vec __attribute__((__vector_size__(16)));
+typedef unsigned char GccU8x32Vec __attribute__((__vector_size__(32)));
+typedef unsigned short GccU16x16Vec __attribute__((__vector_size__(32)));
+typedef unsigned char GccU8x64Vec __attribute__((__vector_size__(64)));
+typedef unsigned short GccU16x32Vec __attribute__((__vector_size__(64)));
+
+GccU8x16Vec U8x16VecRoundingAvg(GccU8x16Vec a, GccU8x16Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU16x8Vec U16x8VecRoundingAvg(GccU16x8Vec a, GccU16x8Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU8x32Vec U8x32VecRoundingAvg(GccU8x32Vec a, GccU8x32Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU16x16Vec U16x16VecRoundingAvg(GccU16x16Vec a, GccU16x16Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU8x64Vec U8x64VecRoundingAvg(GccU8x64Vec a, GccU8x64Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU16x32Vec U16x32VecRoundingAvg(GccU16x32Vec a, GccU16x32Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/pr118994-2.c 
b/gcc/testsuite/gcc.target/i386/pr118994-2.c
new file mode 100644
index ..ba90e0a2992a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr118994-2.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vl -O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "\.AVG_CEIL" 6 "optimized"} } */
+
+#define VecRoundingAvg(a, b) ((a | b) - ((a ^ b) >> 1))
+
+typedef unsigned char GccU8x16Vec __attribute__((__vector_size__(16)));
+typedef unsigned short GccU16x8Vec __attribute__((__vector_size__(16)));
+typedef unsigned char GccU8x32Vec __attribute__((__vector_size__(32)));
+typedef unsigned short GccU16x16Vec __attribute__((__vector_size__(32)));
+typedef unsigned char GccU8x64Vec __attribute__((__vector_size__(64)));
+typedef unsigned short GccU16x32Vec __attribute__((__vector_size__(64)));
+
+GccU8x16Vec U8x16VecRoundingAvg(GccU8x16Vec a, GccU8x16Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU16x8Vec U16x8VecRoundingAvg(GccU16x8Vec a, GccU16x8Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU8x32Vec U8x32VecRoundingAvg(GccU8x32Vec a, GccU8x32Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU16x16Vec U16x16VecRoundingAvg(GccU16x16Vec a, GccU16x16Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU8x64Vec U8x64VecRoundingAvg(GccU8x64Vec a, GccU8x64Vec b) {
+  return VecRoundingAvg(a, b);
+}
+
+GccU16x3

[gcc r16-769] middle-end: Fix complex lowering of cabs with no LHS [PR120369]

2025-05-20 Thread Andrew Pinski via Gcc-cvs
https://gcc.gnu.org/g:95c74f354ae3186e84fbada22d2e7f3845dbb659

commit r16-769-g95c74f354ae3186e84fbada22d2e7f3845dbb659
Author: Andrew Pinski 
Date:   Tue May 20 13:21:28 2025 -0700

middle-end: Fix complex lowering of cabs with no LHS [PR120369]

This was introduced by r15-1797-gd8fe4f05ef448e . I had missed that
the LHS of the cabs call could be NULL. This seems to only happen at -O0,
I tried to produce one that happens at -O1 but needed many different
options to prevent the removal of the call.
Anyways the fix is just keep around the call if the LHS is null.

Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/120369

gcc/ChangeLog:

* tree-complex.cc (gimple_expand_builtin_cabs): Return early
if the LHS of cabs is null.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr120369-1.c: New test.

Signed-off-by: Andrew Pinski 

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr120369-1.c | 9 +
 gcc/tree-complex.cc   | 4 
 2 files changed, 13 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/torture/pr120369-1.c 
b/gcc/testsuite/gcc.dg/torture/pr120369-1.c
new file mode 100644
index ..4c20fb0932f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120369-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* PR middle-end/120369 */
+
+/* Make sure cabs without a lhs does not cause an ICE. */
+void f()
+{
+  double _Complex z = 1.0;
+  __builtin_cabs(z);
+}
diff --git a/gcc/tree-complex.cc b/gcc/tree-complex.cc
index 8a812d4bf9b0..e339b3a5b377 100644
--- a/gcc/tree-complex.cc
+++ b/gcc/tree-complex.cc
@@ -1715,6 +1715,10 @@ gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, 
gimple *old_stmt)
 
   tree lhs = gimple_call_lhs (old_stmt);
 
+  /* If there is not a LHS, then just keep the statement around.  */
+  if (!lhs)
+return;
+
   real_part = extract_component (gsi, arg, false, true);
   imag_part = extract_component (gsi, arg, true, true);
   location_t loc = gimple_location (old_stmt);


[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression dec_type_print_2

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:480a6c07dc80604899315779877d640b815c6ea3

commit 480a6c07dc80604899315779877d640b815c6ea3
Author: Mikael Morin 
Date:   Mon May 19 21:02:06 2025 +0200

Correction régression dec_type_print_2

Diff:
---
 gcc/fortran/trans-array.cc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index f9bdcd395eba..d8d7aa9b97c1 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8935,7 +8935,12 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, 
tree dest,
  tmp = array_type_nelts_minus_one (decl_type);
  if (error_operand_p (tmp)
  && GFC_ARRAY_TYPE_P (decl_type))
-   tmp = GFC_TYPE_ARRAY_SIZE (decl_type);
+   {
+ tmp = GFC_TYPE_ARRAY_SIZE (decl_type);
+ tmp = fold_build2_loc (input_location, MINUS_EXPR,
+gfc_array_index_type, tmp,
+gfc_index_one_node);
+   }
  tmp = fold_convert (gfc_array_index_type, tmp);
}


[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régressions minloc_string maxloc_string

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:54c9c143568edcaeaa5eb72e9cd6529df22c70aa

commit 54c9c143568edcaeaa5eb72e9cd6529df22c70aa
Author: Mikael Morin 
Date:   Tue May 20 10:04:55 2025 +0200

Correction régressions minloc_string maxloc_string

Diff:
---
 libgfortran/generated/maxloc0_16_s1.c |  4 +--
 libgfortran/generated/maxloc0_16_s4.c |  4 +--
 libgfortran/generated/maxloc0_4_s1.c  |  4 +--
 libgfortran/generated/maxloc0_4_s4.c  |  4 +--
 libgfortran/generated/maxloc0_8_s1.c  |  4 +--
 libgfortran/generated/maxloc0_8_s4.c  |  4 +--
 libgfortran/generated/minloc0_16_s1.c |  4 +--
 libgfortran/generated/minloc0_16_s4.c |  4 +--
 libgfortran/generated/minloc0_4_s1.c  |  4 +--
 libgfortran/generated/minloc0_4_s4.c  |  4 +--
 libgfortran/generated/minloc0_8_s1.c  |  4 +--
 libgfortran/generated/minloc0_8_s4.c  |  4 +--
 libgfortran/m4/iforeach-s.m4  | 62 +--
 13 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/libgfortran/generated/maxloc0_16_s1.c 
b/libgfortran/generated/maxloc0_16_s1.c
index e5e81dd28a83..7056d7fca55b 100644
--- a/libgfortran/generated/maxloc0_16_s1.c
+++ b/libgfortran/generated/maxloc0_16_s1.c
@@ -83,7 +83,7 @@ maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
   if (extent[n] <= 0)
@@ -224,7 +224,7 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
diff --git a/libgfortran/generated/maxloc0_16_s4.c 
b/libgfortran/generated/maxloc0_16_s4.c
index 20ef05fb3268..095f8a169e93 100644
--- a/libgfortran/generated/maxloc0_16_s4.c
+++ b/libgfortran/generated/maxloc0_16_s4.c
@@ -83,7 +83,7 @@ maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
   if (extent[n] <= 0)
@@ -224,7 +224,7 @@ mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
diff --git a/libgfortran/generated/maxloc0_4_s1.c 
b/libgfortran/generated/maxloc0_4_s1.c
index 629b544fab1c..a14058d17352 100644
--- a/libgfortran/generated/maxloc0_4_s1.c
+++ b/libgfortran/generated/maxloc0_4_s1.c
@@ -83,7 +83,7 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
   if (extent[n] <= 0)
@@ -224,7 +224,7 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
diff --git a/libgfortran/generated/maxloc0_4_s4.c 
b/libgfortran/generated/maxloc0_4_s4.c
index de596da6638c..6c2e2d3339d6 100644
--- a/libgfortran/generated/maxloc0_4_s4.c
+++ b/libgfortran/generated/maxloc0_4_s4.c
@@ -83,7 +83,7 @@ maxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
   if (extent[n] <= 0)
@@ -224,7 +224,7 @@ mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
   dest = retarray->base_addr;
   for (n = 0; n < rank; n++)
 {
-  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n) * len;
+  sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n);
   mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n);
   extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
   count[n] = 0;
diff --git a/libgfortran/generated/maxloc0_8_s1.c 
b/libgfortran/generated/maxloc0_8_s1.c
index 3482fbc6d283..85cfa97e3d8f 100644
--- a/libgfortran/generated/maxloc0_8_s1.c
+++ b/libgfortran/generated/maxloc0_8_s1.c
@@ -83,7 +83,

[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression reduce_3 et reduce_4

2025-05-20 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:203e4c8225e3f5b40d27a0f49742f64e405cade9

commit 203e4c8225e3f5b40d27a0f49742f64e405cade9
Author: Mikael Morin 
Date:   Mon May 19 20:30:09 2025 +0200

Correction régression reduce_3 et reduce_4

Diff:
---
 libgfortran/intrinsics/reduce.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libgfortran/intrinsics/reduce.c b/libgfortran/intrinsics/reduce.c
index 02f3aef7609d..a475813792db 100644
--- a/libgfortran/intrinsics/reduce.c
+++ b/libgfortran/intrinsics/reduce.c
@@ -95,7 +95,7 @@ reduce (parray *ret,
  painless by the use of pointer arithmetic throughout (except for MASK,
  whose type is known.  */
   ext0 = ext1 = ext2 = 1;
-  spc0 = spc1 = spc2 = 0;
+  spc0 = spc1 = spc2 = elem_len;
 
   scalar_result = (!dim_present && array_rank > 1) || array_rank == 1;
 
@@ -140,12 +140,16 @@ reduce (parray *ret,
   if (dimen < array_rank)
spc2 = GFC_DESCRIPTOR_SPACING (array, dimen);
   else
-   spc2 = 1;
+   spc2 = elem_len;
 }
 
   /* Allocate the result data, the result buffer and zero.  */
   if (ret->base_addr == NULL)
-ret->base_addr = calloc ((size_t)(ext0 * ext2), elem_len);
+{
+  ret->base_addr = calloc ((size_t)(ext0 * ext2), elem_len);
+  GFC_DESCRIPTOR_SPAN (ret) = GFC_DESCRIPTOR_SIZE (ret);
+}
+
   buffer = calloc (1, elem_len);
   zero = calloc (1, elem_len);


[gcc r16-759] libstdc++: Fix incorrect links to archived SGI STL docs

2025-05-20 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:501e6e786652748ff0ad9a322f74b9b47970031f

commit r16-759-g501e6e786652748ff0ad9a322f74b9b47970031f
Author: Jonathan Wakely 
Date:   Tue May 20 10:53:41 2025 +0100

libstdc++: Fix incorrect links to archived SGI STL docs

In r8--g25949ee33201f2 I updated some URLs to point to copies of the
SGI STL docs in the Wayback Machine, because the original pags were no
longer hosted on sgi.com. However, I incorrectly assumed that if one
archived page was at https://web.archive.org/web/20171225062613/... then
all the other pages would be too. Apparently that's not how the Wayback
Machine works, and each page is archived on a different date. That meant
that some of our links were redirecting to archived copies of the
announcement that the SGI STL docs have gone away.

This fixes each URL to refer to a correctly archived copy of the
original docs.

libstdc++-v3/ChangeLog:

* doc/xml/faq.xml: Update URL for archived SGI STL docs.
* doc/xml/manual/containers.xml: Likewise.
* doc/xml/manual/extensions.xml: Likewise.
* doc/xml/manual/using.xml: Likewise.
* doc/xml/manual/utilities.xml: Likewise.
* doc/html/*: Regenerate.

Diff:
---
 libstdc++-v3/doc/html/faq.html  |  2 +-
 libstdc++-v3/doc/html/manual/containers.html|  2 +-
 libstdc++-v3/doc/html/manual/ext_numerics.html  |  2 +-
 libstdc++-v3/doc/html/manual/ext_sgi.html   |  4 ++--
 libstdc++-v3/doc/html/manual/using_concurrency.html | 10 +-
 libstdc++-v3/doc/html/manual/utilities.html |  4 ++--
 libstdc++-v3/doc/xml/faq.xml|  2 +-
 libstdc++-v3/doc/xml/manual/containers.xml  |  2 +-
 libstdc++-v3/doc/xml/manual/extensions.xml  |  6 +++---
 libstdc++-v3/doc/xml/manual/using.xml   | 10 +-
 libstdc++-v3/doc/xml/manual/utilities.xml   |  4 ++--
 11 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html
index 507555839f2f..9bd477f1395d 100644
--- a/libstdc++-v3/doc/html/faq.html
+++ b/libstdc++-v3/doc/html/faq.html
@@ -796,7 +796,7 @@
 Libstdc++-v3 incorporates a lot of code from
 https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/"; 
target="_top">the SGI STL
 (the final merge was from
-https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/whats_new.html";
 target="_top">release 3.3).
+https://web.archive.org/web/20171206110416/http://www.sgi.com/tech/stl/whats_new.html";
 target="_top">release 3.3).
 The code in libstdc++ contains many fixes and changes compared to the
 original SGI code.
 
diff --git a/libstdc++-v3/doc/html/manual/containers.html 
b/libstdc++-v3/doc/html/manual/containers.html
index 7035a949074d..dcd609a6000d 100644
--- a/libstdc++-v3/doc/html/manual/containers.html
+++ b/libstdc++-v3/doc/html/manual/containers.html
@@ -11,7 +11,7 @@
  Yes it is, at least using the old
  ABI, and that's okay.  This is a decision that we preserved
  when we imported SGI's STL implementation.  The following is
- quoted from https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/FAQ.html";
 target="_top">their FAQ:
+ quoted from https://web.archive.org/web/20161222192301/http://www.sgi.com/tech/stl/FAQ.html";
 target="_top">their FAQ:

The size() member function, for list and slist, takes time
proportional to the number of elements in the list.  This was a
diff --git a/libstdc++-v3/doc/html/manual/ext_numerics.html 
b/libstdc++-v3/doc/html/manual/ext_numerics.html
index 9b864e1dcf4a..c3a5623d1752 100644
--- a/libstdc++-v3/doc/html/manual/ext_numerics.html
+++ b/libstdc++-v3/doc/html/manual/ext_numerics.html
@@ -14,7 +14,7 @@
The operation functor must be associative.
 The iota function wins the award for 
Extension With the
Coolest Name (the name comes from Ken Iverson's APL language.)  As
-   described in the https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/iota.html";
 target="_top">SGI
+   described in the https://web.archive.org/web/20170201044840/http://www.sgi.com/tech/stl/iota.html";
 target="_top">SGI
documentation, it "assigns sequentially increasing values to a range.
That is, it assigns value to *first,
value + 1 to *(first + 
1) and so on."
diff --git a/libstdc++-v3/doc/html/manual/ext_sgi.html 
b/libstdc++-v3/doc/html/manual/ext_sgi.html
index ae2062954f4f..2310857804b3 100644
--- a/libstdc++-v3/doc/html/manual/ext_sgi.html
+++ b/libstdc++-v3/doc/html/manual/ext_sgi.html
@@ -28,12 +28,12 @@
   and sets.
Each of the associative containers map, multimap, set, and multiset
   have a counterpart which uses a
-  https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/HashFunction.html";
 target="_top">hashing
+  https:

[gcc r15-9715] libstdc++: Fix incorrect links to archived SGI STL docs

2025-05-20 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:911cfea5e59798e04479ad475870935ccfae004b

commit r15-9715-g911cfea5e59798e04479ad475870935ccfae004b
Author: Jonathan Wakely 
Date:   Tue May 20 10:53:41 2025 +0100

libstdc++: Fix incorrect links to archived SGI STL docs

In r8--g25949ee33201f2 I updated some URLs to point to copies of the
SGI STL docs in the Wayback Machine, because the original pags were no
longer hosted on sgi.com. However, I incorrectly assumed that if one
archived page was at https://web.archive.org/web/20171225062613/... then
all the other pages would be too. Apparently that's not how the Wayback
Machine works, and each page is archived on a different date. That meant
that some of our links were redirecting to archived copies of the
announcement that the SGI STL docs have gone away.

This fixes each URL to refer to a correctly archived copy of the
original docs.

libstdc++-v3/ChangeLog:

* doc/xml/faq.xml: Update URL for archived SGI STL docs.
* doc/xml/manual/containers.xml: Likewise.
* doc/xml/manual/extensions.xml: Likewise.
* doc/xml/manual/using.xml: Likewise.
* doc/xml/manual/utilities.xml: Likewise.
* doc/html/*: Regenerate.

(cherry picked from commit 501e6e786652748ff0ad9a322f74b9b47970031f)

Diff:
---
 libstdc++-v3/doc/html/faq.html  |  2 +-
 libstdc++-v3/doc/html/manual/containers.html|  2 +-
 libstdc++-v3/doc/html/manual/ext_numerics.html  |  2 +-
 libstdc++-v3/doc/html/manual/ext_sgi.html   |  4 ++--
 libstdc++-v3/doc/html/manual/using_concurrency.html | 10 +-
 libstdc++-v3/doc/html/manual/utilities.html |  4 ++--
 libstdc++-v3/doc/xml/faq.xml|  2 +-
 libstdc++-v3/doc/xml/manual/containers.xml  |  2 +-
 libstdc++-v3/doc/xml/manual/extensions.xml  |  6 +++---
 libstdc++-v3/doc/xml/manual/using.xml   | 10 +-
 libstdc++-v3/doc/xml/manual/utilities.xml   |  4 ++--
 11 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html
index 507555839f2f..9bd477f1395d 100644
--- a/libstdc++-v3/doc/html/faq.html
+++ b/libstdc++-v3/doc/html/faq.html
@@ -796,7 +796,7 @@
 Libstdc++-v3 incorporates a lot of code from
 https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/"; 
target="_top">the SGI STL
 (the final merge was from
-https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/whats_new.html";
 target="_top">release 3.3).
+https://web.archive.org/web/20171206110416/http://www.sgi.com/tech/stl/whats_new.html";
 target="_top">release 3.3).
 The code in libstdc++ contains many fixes and changes compared to the
 original SGI code.
 
diff --git a/libstdc++-v3/doc/html/manual/containers.html 
b/libstdc++-v3/doc/html/manual/containers.html
index 7035a949074d..dcd609a6000d 100644
--- a/libstdc++-v3/doc/html/manual/containers.html
+++ b/libstdc++-v3/doc/html/manual/containers.html
@@ -11,7 +11,7 @@
  Yes it is, at least using the old
  ABI, and that's okay.  This is a decision that we preserved
  when we imported SGI's STL implementation.  The following is
- quoted from https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/FAQ.html";
 target="_top">their FAQ:
+ quoted from https://web.archive.org/web/20161222192301/http://www.sgi.com/tech/stl/FAQ.html";
 target="_top">their FAQ:

The size() member function, for list and slist, takes time
proportional to the number of elements in the list.  This was a
diff --git a/libstdc++-v3/doc/html/manual/ext_numerics.html 
b/libstdc++-v3/doc/html/manual/ext_numerics.html
index 9b864e1dcf4a..c3a5623d1752 100644
--- a/libstdc++-v3/doc/html/manual/ext_numerics.html
+++ b/libstdc++-v3/doc/html/manual/ext_numerics.html
@@ -14,7 +14,7 @@
The operation functor must be associative.
 The iota function wins the award for 
Extension With the
Coolest Name (the name comes from Ken Iverson's APL language.)  As
-   described in the https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/iota.html";
 target="_top">SGI
+   described in the https://web.archive.org/web/20170201044840/http://www.sgi.com/tech/stl/iota.html";
 target="_top">SGI
documentation, it "assigns sequentially increasing values to a range.
That is, it assigns value to *first,
value + 1 to *(first + 
1) and so on."
diff --git a/libstdc++-v3/doc/html/manual/ext_sgi.html 
b/libstdc++-v3/doc/html/manual/ext_sgi.html
index ae2062954f4f..2310857804b3 100644
--- a/libstdc++-v3/doc/html/manual/ext_sgi.html
+++ b/libstdc++-v3/doc/html/manual/ext_sgi.html
@@ -28,12 +28,12 @@
   and sets.
Each of the associative containers map, multimap, set, and multiset
   have a counterpart which uses a
-  https://web.archive.org/web/20171225062613/http:

[gcc r16-758] libgcc: Move bitint support exports to x86/aarch64 specific map files

2025-05-20 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:35fd4abd3b9631e24f8b0b910edb001561eaa382

commit r16-758-g35fd4abd3b9631e24f8b0b910edb001561eaa382
Author: Jakub Jelinek 
Date:   Tue May 20 09:36:58 2025 +0200

libgcc: Move bitint support exports to x86/aarch64 specific map files

When adding _BitInt support I was hoping all or most of arches would
implement it already for GCC 14.  That didn't happen and with
new hosts adding support for _BitInt for GCC 16 (s390x-linux and as was
posted today loongarch-linux too), we need the _BitInt support functions
exported on those arches at GCC_16.0.0 rather than GCC_14.0.0 which
shouldn't be changed anymore.

The following patch does that.  Both arches were already exporting
some of the _BitInt related symbols in their specific map files, this
just moves the remaining ones there as well.

2025-05-20  Jakub Jelinek  

* libgcc-std.ver.in (GCC_14.0.0): Remove bitint related exports
from here.
* config/i386/libgcc-glibc.ver (GCC_14.0.0): Add them here.
* config/i386/libgcc-darwin.ver (GCC_14.0.0): Likewise.
* config/i386/libgcc-sol2.ver (GCC_14.0.0): Likewise.
* config/aarch64/libgcc-softfp.ver (GCC_14.0.0): Likewise.

Diff:
---
 libgcc/config/aarch64/libgcc-softfp.ver | 6 ++
 libgcc/config/i386/libgcc-darwin.ver| 6 ++
 libgcc/config/i386/libgcc-glibc.ver | 6 ++
 libgcc/config/i386/libgcc-sol2.ver  | 6 ++
 libgcc/libgcc-std.ver.in| 6 --
 5 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/libgcc/config/aarch64/libgcc-softfp.ver 
b/libgcc/config/aarch64/libgcc-softfp.ver
index c24466c1fef8..3b392c985814 100644
--- a/libgcc/config/aarch64/libgcc-softfp.ver
+++ b/libgcc/config/aarch64/libgcc-softfp.ver
@@ -42,8 +42,14 @@ GCC_13.0.0 {
 
 %inherit GCC_14.0.0 GCC_13.0.0
 GCC_14.0.0 {
+  __mulbitint3
+  __divmodbitint4
+  __fixsfbitint
+  __fixdfbitint
   __fixtfbitint
   __floatbitintbf
   __floatbitinthf
+  __floatbitintsf
+  __floatbitintdf
   __floatbitinttf
 }
diff --git a/libgcc/config/i386/libgcc-darwin.ver 
b/libgcc/config/i386/libgcc-darwin.ver
index 06560d6b47f1..fd609eaaaf6c 100644
--- a/libgcc/config/i386/libgcc-darwin.ver
+++ b/libgcc/config/i386/libgcc-darwin.ver
@@ -37,10 +37,16 @@ GCC_14.0.0 {
   __truncxfbf2
   __trunchfbf2
   # Added to GCC_14.0.0 in i386/libgcc-glibc.ver.
+  __mulbitint3
+  __divmodbitint4
+  __fixsfbitint
+  __fixdfbitint
   __fixxfbitint
   __fixtfbitint
   __floatbitintbf
   __floatbitinthf
+  __floatbitintsf
+  __floatbitintdf
   __floatbitintxf
   __floatbitinttf
 }
diff --git a/libgcc/config/i386/libgcc-glibc.ver 
b/libgcc/config/i386/libgcc-glibc.ver
index e71cc225049e..9e47b9a73fe3 100644
--- a/libgcc/config/i386/libgcc-glibc.ver
+++ b/libgcc/config/i386/libgcc-glibc.ver
@@ -229,10 +229,16 @@ GCC_13.0.0 {
 
 %inherit GCC_14.0.0 GCC_13.0.0
 GCC_14.0.0 {
+  __mulbitint3
+  __divmodbitint4
+  __fixsfbitint
+  __fixdfbitint
   __fixxfbitint
   __fixtfbitint
   __floatbitintbf
   __floatbitinthf
+  __floatbitintsf
+  __floatbitintdf
   __floatbitintxf
   __floatbitinttf
 }
diff --git a/libgcc/config/i386/libgcc-sol2.ver 
b/libgcc/config/i386/libgcc-sol2.ver
index d2d626531c28..538bb69a2c98 100644
--- a/libgcc/config/i386/libgcc-sol2.ver
+++ b/libgcc/config/i386/libgcc-sol2.ver
@@ -144,10 +144,16 @@ GCC_14.0.0 {
   __truncxfbf2
   __trunchfbf2
   # Added to GCC_14.0.0 in i386/libgcc-glibc.ver.
+  __mulbitint3
+  __divmodbitint4
+  __fixsfbitint
+  __fixdfbitint
   __fixxfbitint
   __fixtfbitint
   __floatbitintbf
   __floatbitinthf
+  __floatbitintsf
+  __floatbitintdf
   __floatbitintxf
   __floatbitinttf
 }
diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in
index 1e372d74f0fa..3b3b5e6302ec 100644
--- a/libgcc/libgcc-std.ver.in
+++ b/libgcc/libgcc-std.ver.in
@@ -1947,12 +1947,6 @@ GCC_7.0.0 {
 
 %inherit GCC_14.0.0 GCC_7.0.0
 GCC_14.0.0 {
-  __PFX__mulbitint3
-  __PFX__divmodbitint4
-  __PFX__fixsfbitint
-  __PFX__fixdfbitint
-  __PFX__floatbitintsf
-  __PFX__floatbitintdf
   __PFX__hardcfr_check
   __PFX__strub_enter
   __PFX__strub_update


[gcc r16-761] cobol: sqrt(0) is not an ec-argument error. [PR119885]

2025-05-20 Thread Robert Dubner via Gcc-cvs
https://gcc.gnu.org/g:d44beb132850a8ced1b0614e2724f18465b4a737

commit r16-761-gd44beb132850a8ced1b0614e2724f18465b4a737
Author: Robert Dubner 
Date:   Tue May 20 11:49:43 2025 -0400

cobol: sqrt(0) is not an ec-argument error. [PR119885]

libgcobol

PR cobol/119885
* intrinsic.cc: (__gg__sqrt): Change test from <= zero to < zero.

gcc/testsuite

* cobol.dg/group2/FUNCTION_SQRT__2_.cob: Testcase.
* cobol.dg/group2/FUNCTION_SQRT__2_.out: Known-good for the 
testcase.

Diff:
---
 gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.cob | 13 +
 gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.out |  5 +
 libgcobol/intrinsic.cc  |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.cob 
b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.cob
new file mode 100644
index ..c1f4ba8684a6
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.cob
@@ -0,0 +1,13 @@
+   *> { dg-do run }
+   *> { dg-output-file "group2/FUNCTION_SQRT__2_.out" }
+program-id. sqbug.
+procedure division.
+if function sqrt (0) = 0*>if4034.2
+display 'ok' else display 'bad'.
+display "sqrt(0) "  function trim (function exception-status) 
+set last exception to off
+if function sqrt (-0.1) = 0*>if4034.2
+display 'ok' else display 'bad'.
+display "sqrt(-0.1) "  function trim (function exception-status) 

+goback.
+
diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.out 
b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.out
new file mode 100644
index ..0783ac5abb17
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT__2_.out
@@ -0,0 +1,5 @@
+ok
+sqrt(0) ""
+bad
+sqrt(-0.1) "EC-ARGUMENT-FUNCTION"
+
diff --git a/libgcobol/intrinsic.cc b/libgcobol/intrinsic.cc
index 37ae13e262fe..d6dfcb981a5e 100644
--- a/libgcobol/intrinsic.cc
+++ b/libgcobol/intrinsic.cc
@@ -3565,7 +3565,7 @@ __gg__sqrt( cblc_field_t *dest,
 source_offset,
 source_size);
 
-  if( value <= GCOB_FP128_LITERAL(0.0) )
+  if( value < GCOB_FP128_LITERAL(0.0) )
 {
 exception_raise(ec_argument_function_e);
 }


[gcc r16-764] cobol: Multiple PRs; formatting; exception processing.

2025-05-20 Thread Robert Dubner via Gcc-cvs
https://gcc.gnu.org/g:fba34a0cc55488ad89becf81cf2c9ac517d244d4

commit r16-764-gfba34a0cc55488ad89becf81cf2c9ac517d244d4
Author: Robert Dubner 
Date:   Tue May 20 13:35:15 2025 -0400

cobol: Multiple PRs; formatting; exception processing.

The PRs mentined here have either been previously fixed, or are fixed by
this commit.

gcc/cobol/ChangeLog:

PR cobol/119770
PR cobol/119772
PR cobol/119790
PR cobol/119771
PR cobol/119810
PR cobol/119335
PR cobol/119632
* cdf-copy.cc (GLOB_BRACE): Eliminate .
* cdfval.h (_CDF_VAL_H_): Switch to C++ headers.
* copybook.h (class copybook_elem_t): Eliminate .
(class copybook_t): Likewise.
* gcobc: Numerous changes to improve utility.
* gcobol.1: Correct names in the list of functions.
* genapi.cc (compare_binary_binary): Use has_attr() function.
* lexio.cc (cdftext::lex_open): Typo; filename logic.
(cdftext::process_file): Filename logic.
* parse.y: Numerous parsing changes.
* parse_ante.h (new_alphanumeric): C++ includes; changes to 
temporaries.
(new_tempnumeric): Likewise.
(new_tempnumeric_float): Likewise.
(set_real_from_capacity): Created.
* scan.l: Use yy_pop_state().
* scan_ante.h (typed_name): Find figconst from data.initial.
* symbols.cc (symbol_valid_udf_args): Eliminate.
(symbols_update): figconst processing.
(new_temporary_impl): For functions, set .initial to function name.
(temporaries_t::acquire): Likewise.
(new_alphanumeric): Likewise.
(new_temporary): Likewise.
* symbols.h (_SYMBOLS_H_): Use C++ includes.
(cbl_figconst_tok): Change handling of figconst.
(cbl_figconst_field_of): Change handling of figconst.
(symbol_valid_udf_args): Eliminate.
* symfind.cc (symbol_match2): Change declaration.
(symbol_match): Change declaration.

libgcobol/ChangeLog:

* charmaps.cc: Switch to C++ includes.
* common-defs.h: Likewise.
* constants.cc: Likewise.
* ec.h: Remove #include .
* gcobolio.h (GCOBOLIO_H_): Switch to C++ includes.
* gfileio.cc: Likewise.
* gmath.cc: Likewise.
* intrinsic.cc: Comment formatting; C++ includes.
* io.cc: C++ includes.
* libgcobol.cc: (__gg__stash_exceptions): Eliminate.
* valconv.cc: Switch to C++ includes.

Co-Authored-By: James K. Lowden 

Diff:
---
 gcc/cobol/cdf-copy.cc   |  88 +++
 gcc/cobol/cdfval.h  |   6 +-
 gcc/cobol/copybook.h|  13 +--
 gcc/cobol/gcobc | 141 ++--
 gcc/cobol/gcobol.1  |  54 -
 gcc/cobol/genapi.cc |   4 +-
 gcc/cobol/lexio.cc  |   7 +-
 gcc/cobol/parse.y   | 283 +++-
 gcc/cobol/parse_ante.h  |  35 --
 gcc/cobol/scan.l|   2 +-
 gcc/cobol/scan_ante.h   |   4 +
 gcc/cobol/symbols.cc|  63 +++
 gcc/cobol/symbols.h |  19 ++--
 gcc/cobol/symfind.cc|   4 +-
 libgcobol/charmaps.cc   |  14 ++-
 libgcobol/common-defs.h |   5 +-
 libgcobol/constants.cc  |  19 ++--
 libgcobol/ec.h  |   1 -
 libgcobol/gcobolio.h|   3 +-
 libgcobol/gfileio.cc|  18 +--
 libgcobol/gmath.cc  |  19 ++--
 libgcobol/intrinsic.cc  |  22 ++--
 libgcobol/io.cc |  11 +-
 libgcobol/libgcobol.cc  |  14 +--
 libgcobol/valconv.cc|   7 +-
 25 files changed, 456 insertions(+), 400 deletions(-)

diff --git a/gcc/cobol/cdf-copy.cc b/gcc/cobol/cdf-copy.cc
index 059596c08f41..99f5866ae86f 100644
--- a/gcc/cobol/cdf-copy.cc
+++ b/gcc/cobol/cdf-copy.cc
@@ -35,23 +35,12 @@
 // We regret any confusion engendered.
 
 #include "config.h"
-#include 
 
 #include "cobol-system.h"
 #include "cbldiag.h"
 #include "util.h"
 #include "copybook.h"
 
-// GLOB_BRACE and GLOB_TILDE are BSD extensions.  Provide fallback definitions
-// if necessary.
-#ifndef GLOB_BRACE
-#define GLOB_BRACE 0
-#endif
-
-#ifndef GLOB_TILDE
-#define GLOB_TILDE 0
-#endif
-
 #define COUNT_OF(X) (sizeof(X) / sizeof(X[0]))
 
 /*
@@ -86,7 +75,6 @@
  * space.  This function only applies them.
  */
 
-extern int yydebug;
 const char * cobol_filename();
 bool is_fixed_format();
 bool is_reference_format();
@@ -190,12 +178,6 @@ esc( size_t len, const char input[] ) {
   return buffer; // caller must strdup static buffer
 }
 
-static int
-glob_error(const char *epath, int eerrno) {
-  dbgmsg("%s: COPY file search: '%s': %s", __func__, epath, xstrerror(eerrno));
-  return 0;
-}
-
 void
 copybook_directory_add( const char gcob_copybook[] ) {
   if( !gcob_copybook ) return;
@@ -242,27 +224,15 @@ copybook_extension_add( const char ext[] ) {
   copybook.ext

[gcc r16-765] match: Remove valueize_condition argument from gimple_extra template

2025-05-20 Thread Andrew Pinski via Gcc-cvs
https://gcc.gnu.org/g:70a5de6920055adde1cba97d91534376a195adf4

commit r16-765-g70a5de6920055adde1cba97d91534376a195adf4
Author: Andrew Pinski 
Date:   Sun May 18 00:06:38 2025 -0700

match: Remove valueize_condition argument from gimple_extra template

After r15-4791-gb60031e8f9f8fe, the valueize_condition argument becomes
unused. I didn't notice that as there was -Wno-unused option being added
while compiling gimple-match-exports.cc. This removes that too as there are
no unused warnings.

gcc/ChangeLog:

* Makefile.in (gimple-match-exports.o-warn): Remove.
* gimple-match-exports.cc (gimple_extract): Remove 
valueize_condition
argument.
(gimple_extract_op): Update call to gimple_extract.
(gimple_simplify): Likewise. Also remove valueize_condition lambda.

Signed-off-by: Andrew Pinski 

Diff:
---
 gcc/Makefile.in |  1 -
 gcc/gimple-match-exports.cc | 44 ++--
 2 files changed, 6 insertions(+), 39 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 72d132207c0d..366364a23dea 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -253,7 +253,6 @@ gengtype-lex.o-warn = -Wno-error
 libgcov-util.o-warn = -Wno-error
 libgcov-driver-tool.o-warn = -Wno-error
 libgcov-merge-tool.o-warn = -Wno-error
-gimple-match-exports.o-warn = -Wno-unused
 dfp.o-warn = -Wno-strict-aliasing
 
 # All warnings have to be shut off in stage1 if the compiler used then
diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc
index ccba046a1d4f..555e8a967a0d 100644
--- a/gcc/gimple-match-exports.cc
+++ b/gcc/gimple-match-exports.cc
@@ -720,16 +720,14 @@ gimple_simplify (combined_fn fn, tree type,
describe STMT in RES_OP, returning true on success.  Before recording
an operand, call:
 
-   - VALUEIZE_CONDITION for a COND_EXPR condition
-   - VALUEIZE_OP for every other top-level operand
+   - VALUEIZE_OP for all top-level operand
 
-   Both routines take a tree argument and returns a tree.  */
+   This routine takes a tree argument and returns a tree.  */
 
-template
+template
 inline bool
 gimple_extract (gimple *stmt, gimple_match_op *res_op,
-   ValueizeOp valueize_op,
-   ValueizeCondition valueize_condition)
+   ValueizeOp valueize_op)
 {
   switch (gimple_code (stmt))
 {
@@ -858,7 +856,7 @@ bool
 gimple_extract_op (gimple *stmt, gimple_match_op *res_op)
 {
   auto nop = [](tree op) { return op; };
-  return gimple_extract (stmt, res_op, nop, nop);
+  return gimple_extract (stmt, res_op, nop);
 }
 
 /* The main STMT based simplification entry.  It is used by the fold_stmt
@@ -873,38 +871,8 @@ gimple_simplify (gimple *stmt, gimple_match_op *res_op, 
gimple_seq *seq,
 {
   return do_valueize (op, top_valueize, valueized);
 };
-  auto valueize_condition = [&](tree op) -> tree
-{
-  bool cond_valueized = false;
-  tree lhs = do_valueize (TREE_OPERAND (op, 0), top_valueize,
- cond_valueized);
-  tree rhs = do_valueize (TREE_OPERAND (op, 1), top_valueize,
- cond_valueized);
-  gimple_match_op res_op2 (res_op->cond, TREE_CODE (op),
-  TREE_TYPE (op), lhs, rhs);
-  if ((gimple_resimplify2 (seq, &res_op2, valueize)
-  || cond_valueized)
- && res_op2.code.is_tree_code ())
-   {
- auto code = tree_code (res_op2.code);
- if (TREE_CODE_CLASS (code) == tcc_comparison)
-   {
- valueized = true;
- return build2 (code, TREE_TYPE (op),
-res_op2.ops[0], res_op2.ops[1]);
-   }
- else if (code == SSA_NAME
-  || code == INTEGER_CST
-  || code == VECTOR_CST)
-   {
- valueized = true;
- return res_op2.ops[0];
-   }
-   }
-  return valueize_op (op);
-};
 
-  if (!gimple_extract (stmt, res_op, valueize_op, valueize_condition))
+  if (!gimple_extract (stmt, res_op, valueize_op))
 return false;
 
   if (res_op->code.is_internal_fn ())


[gcc(refs/users/meissner/heads/work206-bugs)] Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.

2025-05-20 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:75392e393a610adb674d84ae3ebb61c089521a58

commit 75392e393a610adb674d84ae3ebb61c089521a58
Author: Michael Meissner 
Date:   Tue May 20 16:39:49 2025 -0400

Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.

In bug PR target/118541 on power9, power10, and power11 systems, for the
function:

extern double __ieee754_acos (double);

double
__acospi (double x)
{
  double ret = __ieee754_acos (x) / 3.14;
  return __builtin_isgreater (ret, 1.0) ? 1.0 : ret;
}

GCC currently generates the following code:

Power9  Power10 and Power11
==  ===
bl __ieee754_acos   bl __ieee754_acos@notoc
nop plfd 0,.LC0@pcrel
addis 9,2,.LC2@toc@ha   xxspltidp 12,1065353216
addi 1,1,32 addi 1,1,32
lfd 0,.LC2@toc@l(9) ld 0,16(1)
addis 9,2,.LC0@toc@ha   fdiv 0,1,0
ld 0,16(1)  mtlr 0
lfd 12,.LC0@toc@l(9)xscmpgtdp 1,0,12
fdiv 0,1,0  xxsel 1,0,12,1
mtlr 0  blr
xscmpgtdp 1,0,12
xxsel 1,0,12,1
blr

This is because ifcvt.c optimizes the conditional floating point move to 
use the
XSCMPGTDP instruction.

However, the XSCMPGTDP instruction will generate an interrupt if one of the
arguments is a signalling NaN and signalling NaNs can generate an interrupt.
The IEEE comparison functions (isgreater, etc.) require that the comparison 
not
raise an interrupt.

The following patch changes the PowerPC back end so that ifcvt.c will not 
change
the if/then test and move into a conditional move if the comparison is one 
of
the comparisons that do not raise an error with signalling NaNs and -Ofast 
is
not used.  If a normal comparison is used or -Ofast is used, GCC will 
continue
to generate XSCMPGTDP and XXSEL.

For the following code:

double
ordered_compare (double a, double b, double c, double d)
{
  return __builtin_isgreater (a, b) ? c : d;
}

/* Verify normal > does generate xscmpgtdp.  */

double
normal_compare (double a, double b, double c, double d)
{
  return a > b ? c : d;
}

with the following patch, GCC generates the following for power9, power10, 
and
power11:

ordered_compare:
fcmpu 0,1,2
fmr 1,4
bnglr 0
fmr 1,3
blr

normal_compare:
xscmpgtdp 1,1,2
xxsel 1,4,3,1
blr

I have built bootstrap compilers on big endian power9 systems and little 
endian
power9/power10 systems and there were no regressions.  Can I check this 
patch
into the GCC trunk, and after a waiting period, can I check this into the 
active
older branches?

2025-05-20  Michael Meissner  

gcc/

PR target/118541
* config/rs6000/predicates.md (invert_fpmask_comparison_operator): 
Do
not allow UNLT and UNLE unless -ffast-math.
* config/rs6000/rs6000-protos.h (enum rev_cond_ordered): New 
enumeration.
(rs6000_reverse_condition): Add argument.
* config/rs6000/rs6000.cc (rs6000_reverse_condition): Do not allow
ordered comparisons to be reversed for floating point conditional 
moves,
but allow ordered comparisons to be reversed on jumps.
(rs6000_emit_sCOND): Adjust rs6000_reverse_condition call.
* config/rs6000/rs6000.h (REVERSIBLE_CC_MODE): Do not allow floating
point comparisons to be reversed on platforms that can generate the
xscmp{eq,gt,ge}{dp,qp} instructions.
(REVERSE_CONDITION): Adjust rs6000_reverse_condition call.
* config/rs6000/rs6000.md (reverse_branch_comparison): Name insn.
Adjust rs6000_reverse_condition calls.

gcc/testsuite/

PR target/118541
* gcc.target/powerpc/pr118541.c: New test.

Diff:
---
 gcc/config/rs6000/predicates.md |  10 +-
 gcc/config/rs6000/rs6000-protos.h   |  17 +++-
 gcc/config/rs6000/rs6000.cc |  35 +--
 gcc/config/rs6000/rs6000.h  |  13 ++-
 gcc/config/rs6000/rs6000.md |  25 +++--
 gcc/testsuite/gcc.target/powerpc/pr118541.c | 147 
 6 files changed, 223 insertions(+), 24 deletions(-)

diff --git a/gcc/config/rs6000/predicates.md b

[gcc(refs/users/meissner/heads/work206-bugs)] Update ChangeLog.*

2025-05-20 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:a331932dec94b756814f8759585915cf1f01efdf

commit a331932dec94b756814f8759585915cf1f01efdf
Author: Michael Meissner 
Date:   Tue May 20 16:41:38 2025 -0400

Update ChangeLog.*

Diff:
---
 gcc/ChangeLog.bugs | 109 +
 1 file changed, 109 insertions(+)

diff --git a/gcc/ChangeLog.bugs b/gcc/ChangeLog.bugs
index 44b7e35dd38b..8eb6295859ab 100644
--- a/gcc/ChangeLog.bugs
+++ b/gcc/ChangeLog.bugs
@@ -1,3 +1,112 @@
+ Branch work206-bugs, patch #110 
+
+Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.
+
+In bug PR target/118541 on power9, power10, and power11 systems, for the
+function:
+
+extern double __ieee754_acos (double);
+
+double
+__acospi (double x)
+{
+  double ret = __ieee754_acos (x) / 3.14;
+  return __builtin_isgreater (ret, 1.0) ? 1.0 : ret;
+}
+
+GCC currently generates the following code:
+
+Power9  Power10 and Power11
+==  ===
+bl __ieee754_acos   bl __ieee754_acos@notoc
+nop plfd 0,.LC0@pcrel
+addis 9,2,.LC2@toc@ha   xxspltidp 12,1065353216
+addi 1,1,32 addi 1,1,32
+lfd 0,.LC2@toc@l(9) ld 0,16(1)
+addis 9,2,.LC0@toc@ha   fdiv 0,1,0
+ld 0,16(1)  mtlr 0
+lfd 12,.LC0@toc@l(9)xscmpgtdp 1,0,12
+fdiv 0,1,0  xxsel 1,0,12,1
+mtlr 0  blr
+xscmpgtdp 1,0,12
+xxsel 1,0,12,1
+blr
+
+This is because ifcvt.c optimizes the conditional floating point move to use 
the
+XSCMPGTDP instruction.
+
+However, the XSCMPGTDP instruction will generate an interrupt if one of the
+arguments is a signalling NaN and signalling NaNs can generate an interrupt.
+The IEEE comparison functions (isgreater, etc.) require that the comparison not
+raise an interrupt.
+
+The following patch changes the PowerPC back end so that ifcvt.c will not 
change
+the if/then test and move into a conditional move if the comparison is one of
+the comparisons that do not raise an error with signalling NaNs and -Ofast is
+not used.  If a normal comparison is used or -Ofast is used, GCC will continue
+to generate XSCMPGTDP and XXSEL.
+
+For the following code:
+
+double
+ordered_compare (double a, double b, double c, double d)
+{
+  return __builtin_isgreater (a, b) ? c : d;
+}
+
+/* Verify normal > does generate xscmpgtdp.  */
+
+double
+normal_compare (double a, double b, double c, double d)
+{
+  return a > b ? c : d;
+}
+
+with the following patch, GCC generates the following for power9, power10, and
+power11:
+
+ordered_compare:
+fcmpu 0,1,2
+fmr 1,4
+bnglr 0
+fmr 1,3
+blr
+
+normal_compare:
+xscmpgtdp 1,1,2
+xxsel 1,4,3,1
+blr
+
+I have built bootstrap compilers on big endian power9 systems and little endian
+power9/power10 systems and there were no regressions.  Can I check this patch
+into the GCC trunk, and after a waiting period, can I check this into the 
active
+older branches?
+
+2025-05-20  Michael Meissner  
+
+gcc/
+
+   PR target/118541
+   * config/rs6000/predicates.md (invert_fpmask_comparison_operator): Do
+   not allow UNLT and UNLE unless -ffast-math.
+   * config/rs6000/rs6000-protos.h (enum rev_cond_ordered): New 
enumeration.
+   (rs6000_reverse_condition): Add argument.
+   * config/rs6000/rs6000.cc (rs6000_reverse_condition): Do not allow
+   ordered comparisons to be reversed for floating point conditional moves,
+   but allow ordered comparisons to be reversed on jumps.
+   (rs6000_emit_sCOND): Adjust rs6000_reverse_condition call.
+   * config/rs6000/rs6000.h (REVERSIBLE_CC_MODE): Do not allow floating
+   point comparisons to be reversed on platforms that can generate the
+   xscmp{eq,gt,ge}{dp,qp} instructions.
+   (REVERSE_CONDITION): Adjust rs6000_reverse_condition call.
+   * config/rs6000/rs6000.md (reverse_branch_comparison): Name insn.
+   Adjust rs6000_reverse_condition calls.
+
+gcc/testsuite/
+
+   PR target/118541
+   * gcc.target/powerpc/pr118541.c: New test.
+
  Branch work206-bugs, patch #101 
 
 PR 99293: Optimize splat of a V2DF/V2DI extract with constant element


[gcc r15-9718] Fortran: fix passing of inquiry ref of complex array to TRANSFER [PR102891]

2025-05-20 Thread Harald Anlauf via Gcc-cvs
https://gcc.gnu.org/g:6683c729663299cdcc401248dce63ea16fc8357e

commit r15-9718-g6683c729663299cdcc401248dce63ea16fc8357e
Author: Harald Anlauf 
Date:   Tue May 6 20:59:48 2025 +0200

Fortran: fix passing of inquiry ref of complex array to TRANSFER [PR102891]

PR fortran/102891

gcc/fortran/ChangeLog:

* dependency.cc (gfc_ref_needs_temporary_p): Within an array
reference, inquiry references of complex variables generally
need a temporary.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 94fa992b60e53dcf807fc7055ab606d828b931d8)

Diff:
---
 gcc/fortran/dependency.cc  |  6 ++-
 .../gfortran.dg/transfer_array_subref.f90  | 48 ++
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
index 57c0c49391bd..aa8a57a80e0e 100644
--- a/gcc/fortran/dependency.cc
+++ b/gcc/fortran/dependency.cc
@@ -944,8 +944,12 @@ gfc_ref_needs_temporary_p (gfc_ref *ref)
   types), not in characters.  */
return subarray_p;
 
-  case REF_COMPONENT:
   case REF_INQUIRY:
+   /* Within an array reference, inquiry references of complex
+  variables generally need a temporary.  */
+   return subarray_p;
+
+  case REF_COMPONENT:
break;
   }
 
diff --git a/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 
b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90
new file mode 100644
index ..b480dffd00bf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90
@@ -0,0 +1,48 @@
+! { dg-do run }
+! { dg-additional-options "-O2 -fdump-tree-optimized" }
+!
+! PR fortran/102891 - passing of inquiry ref of complex array to TRANSFER
+
+program main
+  implicit none
+  integer, parameter :: dp = 8
+
+  type complex_wrap1
+ complex(dp) :: z(2)
+  end type complex_wrap1
+
+  type complex_wrap2
+ complex(dp), dimension(:), allocatable :: z
+  end type complex_wrap2
+
+  type(complex_wrap1) :: x = complex_wrap1([ (1, 2), (3, 4) ])
+  type(complex_wrap2) :: w
+
+  w%z = x%z
+
+  ! The following statements should get optimized away...
+  if (size (transfer ( x%z%re ,[1.0_dp])) /= 2) error stop 1
+  if (size (transfer ((x%z%re),[1.0_dp])) /= 2) error stop 2
+  if (size (transfer ([x%z%re],[1.0_dp])) /= 2) error stop 3
+  if (size (transfer ( x%z%im ,[1.0_dp])) /= 2) error stop 4
+  if (size (transfer ((x%z%im),[1.0_dp])) /= 2) error stop 5
+  if (size (transfer ([x%z%im],[1.0_dp])) /= 2) error stop 6
+
+  ! ... while the following may not:
+  if (any  (transfer ( x%z%re ,[1.0_dp])  /= x%z%re)) stop 7
+  if (any  (transfer ( x%z%im ,[1.0_dp])  /= x%z%im)) stop 8
+
+  if (size (transfer ( w%z%re ,[1.0_dp])) /= 2) stop 11
+  if (size (transfer ((w%z%re),[1.0_dp])) /= 2) stop 12
+  if (size (transfer ([w%z%re],[1.0_dp])) /= 2) stop 13
+  if (size (transfer ( w%z%im ,[1.0_dp])) /= 2) stop 14
+  if (size (transfer ((w%z%im),[1.0_dp])) /= 2) stop 15
+  if (size (transfer ([w%z%im],[1.0_dp])) /= 2) stop 16
+
+  if (any  (transfer ( w%z%re ,[1.0_dp])  /= x%z%re)) stop 17
+  if (any  (transfer ( w%z%im ,[1.0_dp])  /= x%z%im)) stop 18
+
+  deallocate (w%z)
+end program main
+
+! { dg-final { scan-tree-dump-not "_gfortran_error_stop_numeric" "optimized" } 
}