[gcc r15-9362] c++: lambda in constraint of lambda [PR119175]

2025-04-10 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:39892d9618ee0f06dd09271589878b0df7b1e75d

commit r15-9362-g39892d9618ee0f06dd09271589878b0df7b1e75d
Author: Jason Merrill 
Date:   Wed Apr 9 13:22:56 2025 -0400

c++: lambda in constraint of lambda [PR119175]

Here when we went to mangle the constraints of from<0>, the outer lambda has
no mangling scope, but the inner one was treated as having the outer one as
its scope.  And mangling the outer one means mangling its constraints, which
include the inner one.  So infinite recursion.

But a lambda closure type isn't a scope that anything should have for
mangling, the inner lambda should also have no mangling scope.

PR c++/119175

gcc/cp/ChangeLog:

* mangle.cc (decl_mangling_context): Look through lambda type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-lambda23.C: New test.

Diff:
---
 gcc/cp/mangle.cc   |  6 ++
 gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C | 12 
 2 files changed, 18 insertions(+)

diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 02129c6b89a1..3d5e96b2c944 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -1048,6 +1048,12 @@ decl_mangling_context (tree decl)
   tree extra = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (decl));
   if (extra)
return extra;
+  tcontext = CP_DECL_CONTEXT (decl);
+  if (LAMBDA_TYPE_P (tcontext))
+   /* Lambda type context means this lambda appears between the
+  lambda-introducer and the open brace of another lambda (c++/119175).
+  That isn't a real scope; look further into the enclosing scope.  */
+   return decl_mangling_context (TYPE_NAME (tcontext));
 }
   else if (template_type_parameter_p (decl))
  /* template type parms have no mangling context.  */
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C 
b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C
new file mode 100644
index ..f44212031dd7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C
@@ -0,0 +1,12 @@
+// PR c++/119175
+// { dg-do compile { target c++20 } }
+
+template
+static void from() requires requires {
+  [] requires requires { [] {}; } {};
+}
+{}
+
+int main() {
+  from();
+}


[gcc r15-9363] cobol: New testcases for reference modification.

2025-04-10 Thread Robert Dubner via Gcc-cvs
https://gcc.gnu.org/g:6ddcbb3ec8cf5e0ab38c28f40e92e0a77d6f1fdd

commit r15-9363-g6ddcbb3ec8cf5e0ab38c28f40e92e0a77d6f1fdd
Author: Bob Dubner 
Date:   Thu Apr 10 09:52:49 2025 -0400

cobol: New testcases for reference modification.

gcc/testsuite

* cobol.dg/group2/Dynamic_reference_modification.cob: New testcase.
* cobol.dg/group2/Length_overflow__1_.cob: Likewise.
* cobol.dg/group2/Length_overflow__2_.cob: Likewise.
* cobol.dg/group2/Length_overflow_with_offset__1_.cob: Likewise.
* cobol.dg/group2/Length_overflow_with_offset__2_.cob: Likewise.
* cobol.dg/group2/Length_overflow_with_offset__3_.cob: Likewise.
* cobol.dg/group2/Offset_overflow.cob: Likewise.
* cobol.dg/group2/Offset_underflow.cob: Likewise.
* cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob: 
Likewise.
* cobol.dg/group2/Refmod_sources_are_figurative_constants.cob: 
Likewise.
* cobol.dg/group2/Static_reference_modification.cob: Likewise.
* cobol.dg/group2/Dynamic_reference_modification.out: New 
known-good result.
* cobol.dg/group2/Length_overflow__1_.out: Likewise.
* cobol.dg/group2/Length_overflow__2_.out: Likewise.
* cobol.dg/group2/Length_overflow_with_offset__1_.out: Likewise.
* cobol.dg/group2/Length_overflow_with_offset__2_.out: Likewise.
* cobol.dg/group2/Length_overflow_with_offset__3_.out: Likewise.
* cobol.dg/group2/Offset_overflow.out: Likewise.
* cobol.dg/group2/Offset_underflow.out: Likewise.
* cobol.dg/group2/Refmod__comparisons_inside_numeric-display.out: 
Likewise.
* cobol.dg/group2/Refmod_sources_are_figurative_constants.out: 
Likewise.
* cobol.dg/group2/Static_reference_modification.out: Likewise.

Diff:
---
 .../group2/Dynamic_reference_modification.cob  | 24 ++
 .../group2/Dynamic_reference_modification.out  |  5 
 .../cobol.dg/group2/Length_overflow__1_.cob| 16 
 .../cobol.dg/group2/Length_overflow__1_.out|  1 +
 .../cobol.dg/group2/Length_overflow__2_.cob| 16 
 .../cobol.dg/group2/Length_overflow__2_.out|  1 +
 .../group2/Length_overflow_with_offset__1_.cob | 15 +++
 .../group2/Length_overflow_with_offset__1_.out |  1 +
 .../group2/Length_overflow_with_offset__2_.cob | 16 
 .../group2/Length_overflow_with_offset__2_.out |  1 +
 .../group2/Length_overflow_with_offset__3_.cob | 22 
 .../group2/Length_overflow_with_offset__3_.out |  1 +
 gcc/testsuite/cobol.dg/group2/Offset_overflow.cob  | 16 
 gcc/testsuite/cobol.dg/group2/Offset_overflow.out  |  1 +
 gcc/testsuite/cobol.dg/group2/Offset_underflow.cob | 16 
 gcc/testsuite/cobol.dg/group2/Offset_underflow.out |  1 +
 .../Refmod__comparisons_inside_numeric-display.cob | 20 +++
 .../Refmod__comparisons_inside_numeric-display.out |  9 +++
 .../Refmod_sources_are_figurative_constants.cob| 29 ++
 .../Refmod_sources_are_figurative_constants.out|  9 +++
 .../group2/Static_reference_modification.cob   | 19 ++
 .../group2/Static_reference_modification.out   |  5 
 22 files changed, 244 insertions(+)

diff --git a/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.cob 
b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.cob
new file mode 100644
index ..99690da57327
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.cob
@@ -0,0 +1,24 @@
+   *> { dg-do run }
+   *> { dg-output-file "group2/Dynamic_reference_modification.out" }
+
+   IDENTIFICATION   DIVISION.
+   PROGRAM-ID.  prog.
+   DATA DIVISION.
+   WORKING-STORAGE  SECTION.
+   01 X PIC X(4) VALUE "abcd".
+   01 I PIC 9.
+   PROCEDUREDIVISION.
+   MOVE 1 TO I.
+   DISPLAY X(I:1)
+   END-DISPLAY.
+   MOVE 4 TO I.
+   DISPLAY X(I:1)
+   END-DISPLAY.
+   MOVE 1 TO I.
+   DISPLAY X(1:I)
+   END-DISPLAY.
+   MOVE 4 TO I.
+   DISPLAY X(1:I)
+   END-DISPLAY.
+   STOP RUN.
+
diff --git a/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.out 
b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.out
new file mode 100644
index ..42a4b69544ec
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.out
@@ -0,0 +1,5 @@
+a
+d
+a
+abcd
+
diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.cob 
b/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.cob
new file mode 100644
index ..647535675756
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.cob
@@ -0,0 +1,16 @@
+   *> { dg-

[gcc r15-9364] Darwin, libgcobol: Enable for x86_64 Darwin.

2025-04-10 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:6fd19b2dbda453d3de57529ded2df9e62d1efdaa

commit r15-9364-g6fd19b2dbda453d3de57529ded2df9e62d1efdaa
Author: Iain Sandoe 
Date:   Thu Apr 10 14:16:37 2025 +0100

Darwin, libgcobol: Enable for x86_64 Darwin.

Now that we have libquadmath support, we can enable for x86_64, at
least.

libgcobol/ChangeLog:

* configure.tgt: Enable for x86_64 Darwin.

Signed-off-by: Iain Sandoe 

Diff:
---
 libgcobol/configure.tgt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgcobol/configure.tgt b/libgcobol/configure.tgt
index c5e263a4eed9..ebf044e98f1a 100644
--- a/libgcobol/configure.tgt
+++ b/libgcobol/configure.tgt
@@ -34,7 +34,7 @@ case "${target}" in
LIBGCOBOL_SUPPORTED=yes
fi
;;
-x86_64-*-linux* | i?86-*-linux*)
+x86_64-*-linux* | i?86-*-linux* | x86_64-*-darwin*)
if test x$ac_cv_sizeof_void_p = x8; then
LIBGCOBOL_SUPPORTED=yes
fi


[gcc r15-9365] libstdc++: Adjust value of __cpp_lib_constrained_equality for C++20

2025-04-10 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:bb323ec8fdfce6dc22b1ca13a2c381f1496c545d

commit r15-9365-gbb323ec8fdfce6dc22b1ca13a2c381f1496c545d
Author: Jonathan Wakely 
Date:   Thu Apr 10 11:00:36 2025 +0100

libstdc++: Adjust value of __cpp_lib_constrained_equality for C++20

The P3379R0 bump to __cpp_lib_constrained_equality relates to changes
that only affect std::expected, so there's no reason to define the
updated value in C++20.

This change restores the previous value (202403) for C++20, and only
uses the new value (202411) for C++23 and later.

Also remove the TODO comments, because I correctly predicted that the
final value would be 202411.

libstdc++-v3/ChangeLog:

* include/bits/version.def (constrained_equality): Only define
as 202411 for C++23 and later, use 202403 for C++20.
* include/bits/version.h: Regenerate.
* testsuite/20_util/expected/equality_constrained.cc: Remove
TODO comment.

Diff:
---
 libstdc++-v3/include/bits/version.def   | 7 ++-
 libstdc++-v3/include/bits/version.h | 7 ++-
 libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc | 2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index 8f609b469cc9..2ec1b40bd38f 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1273,7 +1273,12 @@ ftms = {
 ftms = {
   name = constrained_equality;
   values = {
-v = 202411; // FIXME: 202403 for P2944R3, ??? for P3379R0
+v = 202411;
+cxxmin = 23;
+extra_cond = "__glibcxx_three_way_comparison";
+  };
+  values = {
+v = 202403;
 cxxmin = 20;
 extra_cond = "__glibcxx_three_way_comparison";
   };
diff --git a/libstdc++-v3/include/bits/version.h 
b/libstdc++-v3/include/bits/version.h
index f05c3fd13c0e..04c1349c84bb 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -1406,11 +1406,16 @@
 #undef __glibcxx_want_constexpr_vector
 
 #if !defined(__cpp_lib_constrained_equality)
-# if (__cplusplus >= 202002L) && (__glibcxx_three_way_comparison)
+# if (__cplusplus >= 202100L) && (__glibcxx_three_way_comparison)
 #  define __glibcxx_constrained_equality 202411L
 #  if defined(__glibcxx_want_all) || 
defined(__glibcxx_want_constrained_equality)
 #   define __cpp_lib_constrained_equality 202411L
 #  endif
+# elif (__cplusplus >= 202002L) && (__glibcxx_three_way_comparison)
+#  define __glibcxx_constrained_equality 202403L
+#  if defined(__glibcxx_want_all) || 
defined(__glibcxx_want_constrained_equality)
+#   define __cpp_lib_constrained_equality 202403L
+#  endif
 # endif
 #endif /* !defined(__cpp_lib_constrained_equality) && 
defined(__glibcxx_want_constrained_equality) */
 #undef __glibcxx_want_constrained_equality
diff --git a/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc 
b/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc
index 7f6cefae7487..a079d98129fd 100644
--- a/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc
@@ -4,7 +4,7 @@
 
 #ifndef __cpp_lib_constrained_equality
 # error "Feature-test macro for constrained_equality missing in "
-#elif __cpp_lib_constrained_equality < 202411L // TODO: use final value
+#elif __cpp_lib_constrained_equality < 202411L
 # error "Feature-test macro for constrained_equality has wrong value"
 #endif


[gcc r15-9366] c++: Use G_ instead of _ around cp/errors.cc gcc-internal-format strings [PR119684]

2025-04-10 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:1f32b87117b0e2ecc33b844d929d723de3fe8085

commit r15-9366-g1f32b87117b0e2ecc33b844d929d723de3fe8085
Author: Jakub Jelinek 
Date:   Thu Apr 10 18:39:52 2025 +0200

c++: Use G_ instead of _ around cp/errors.cc gcc-internal-format strings 
[PR119684]

These pp_printf/pp_verbatim format strings should be gcc-internal-format,
they use the pretty-print.cc format specifier handling rather than libc
*printf, but pp_printf/pp_verbatim are intentionally not handled through
exgettext because not everything done through them should be translated
(e.g. its use for dump files shouldn't be).
In addition, composing translatable messages from
"in requirements " and later on "with " might make it harder to be
translated.

I've verified these strings (at least those which don't use format
specifiers added post GCC 4.3 which gettext doesn't handle) are properly
marked as gcc-internal-format in gcc.pot.  The lack of that caused
ICEs on German translation of the "%s%s%sIn instantiation of %q#D:\n"
message because it contained too many %s.

2025-04-10  Jakub Jelinek  

PR translation/119684
* error.cc (cp_print_error_function): Use G_ instead of _ for
pp_printf arguments.
(function_category): Use G_ instead of _.
(print_instantiation_full_context): Use G_ instead of _ in 
pp_verbatim
arguments.
(print_location): Likewise.
(print_instantiation_partial_context): Likewise.
(maybe_print_constexpr_context): Likewise.
(print_constrained_decl_info): Use G_() around pp_verbatim argument.
(print_concept_check_info): Likewise.
(print_constraint_context_head): Likewise.
(print_requires_expression_info): Likewise.  Merge separate 
pp_verbatim
"in requirements " and "with " into one with conditional messages.

Diff:
---
 gcc/cp/error.cc | 59 -
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index ec7527e96d18..499eb1b15a85 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -3788,18 +3788,18 @@ cp_print_error_function (diagnostic_text_output_format 
&text_output,
{
  if (text_output.show_column_p () && s.column != 0)
pp_printf (pp,
-  _("inlined from %qD at %r%s:%d:%d%R"),
+  G_("inlined from %qD at %r%s:%d:%d%R"),
   fndecl,
   "locus", s.file, s.line, s.column);
  else
pp_printf (pp,
-  _("inlined from %qD at %r%s:%d%R"),
+  G_("inlined from %qD at %r%s:%d%R"),
   fndecl,
   "locus", s.file, s.line);
 
}
  else
-   pp_printf (pp, _("inlined from %qD"),
+   pp_printf (pp, G_("inlined from %qD"),
   fndecl);
}
}
@@ -3825,22 +3825,22 @@ function_category (tree fn)
   && DECL_FUNCTION_MEMBER_P (fn))
 {
   if (DECL_STATIC_FUNCTION_P (fn))
-   return _("In static member function %qD");
+   return G_("In static member function %qD");
   else if (DECL_COPY_CONSTRUCTOR_P (fn))
-   return _("In copy constructor %qD");
+   return G_("In copy constructor %qD");
   else if (DECL_CONSTRUCTOR_P (fn))
-   return _("In constructor %qD");
+   return G_("In constructor %qD");
   else if (DECL_DESTRUCTOR_P (fn))
-   return _("In destructor %qD");
+   return G_("In destructor %qD");
   else if (LAMBDA_FUNCTION_P (fn))
-   return _("In lambda function");
+   return G_("In lambda function");
   else if (DECL_XOBJ_MEMBER_FUNCTION_P (fn))
-   return _("In explicit object member function %qD");
+   return G_("In explicit object member function %qD");
   else
-   return _("In member function %qD");
+   return G_("In member function %qD");
 }
   else
-return _("In function %qD");
+return G_("In function %qD");
 }
 
 /* Disable warnings about missing quoting in GCC diagnostics for
@@ -3867,8 +3867,8 @@ print_instantiation_full_context 
(diagnostic_text_output_format &text_output)
   char *indent = text_output.build_indent_prefix (true);
   pp_verbatim (text_output.get_printer (),
   p->list_p ()
-  ? _("%s%s%sIn substitution of %qS:\n")
-  : _("%s%s%sIn instantiation of %q#D:\n"),
+  ? G_("%s%s%sIn substitution of %qS:\n")
+  : G_("%s%s%sIn instantiation of %q#D:\n"),
   indent,
   

[gcc r14-11577] c++: ICE with nested default targ lambdas [PR119574]

2025-04-10 Thread Patrick Palka via Gcc-cvs
https://gcc.gnu.org/g:ff5fdb3cad1a76768406e0fcec2010cdd72f49fc

commit r14-11577-gff5fdb3cad1a76768406e0fcec2010cdd72f49fc
Author: Patrick Palka 
Date:   Wed Apr 9 17:55:36 2025 -0400

c++: ICE with nested default targ lambdas [PR119574]

In GCC 14 we fixed PR116567 in a more conservative way that doesn't
distinguish between the two kinds of deferred substitutions, and so
for PR119574 we instead ICE from get_innermost_template_args due to
TMPL_PARMS_DEPTH of the lambda, 2, being greater than the depth of the
augmented args, 1.

This patch works around the ICE in a best effort kind of way by guarding
the get_innermost_template_args call appropriately; I don't think it's
possible to get this completely right in GCC 14 without backporting the
proper fix for PR116567.

Note that lambda-targ13b.C present in the GCC 15 version of this patch[1]
never worked in GCC 14, and still doesn't work, which is why it's not
present in this patch.

[1]: r15-9350-gf3862ab07943d1

PR c++/119574

gcc/cp/ChangeLog:

* pt.cc (tsubst_lambda_expr): Don't call
get_innermost_template_args if we're requesting too many
levels.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-targ13.C: New test.
* g++.dg/cpp2a/lambda-targ13a.C: New test.

Diff:
---
 gcc/cp/pt.cc| 3 ++-
 gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C  | 7 +++
 gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C | 8 
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 2efc7eb19e87..5b9a9c611f24 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -19708,7 +19708,8 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
   tree ctx_parms = DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (oldfn));
   if (generic_lambda_fn_p (oldfn))
ctx_parms = TREE_CHAIN (ctx_parms);
-  args = get_innermost_template_args (args, TMPL_PARMS_DEPTH (ctx_parms));
+  if (TMPL_ARGS_DEPTH (args) > TMPL_PARMS_DEPTH (ctx_parms))
+   args = get_innermost_template_args (args, TMPL_PARMS_DEPTH (ctx_parms));
 }
 
   tree r = build_lambda_expr ();
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C 
b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C
new file mode 100644
index ..8fd0a311e056
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C
@@ -0,0 +1,7 @@
+// PR c++/119574
+// { dg-do compile { target c++20 } }
+
+template  () {})>
+void f(F op = {}) { op(); }
+
+int main() { f(); }
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C 
b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C
new file mode 100644
index ..8aaefd93356c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C
@@ -0,0 +1,8 @@
+// PR c++/119574
+// A version of lambda-targ13.C with extra template parameters.
+// { dg-do compile { target c++20 } }
+
+template  () {})>
+void f(F op = {}) { op(); }
+
+int main() { f(); }


[gcc r15-9360] hpux: Remove _GLIBCXX_USE_LONG_LONG define from hpux os_defines.h

2025-04-10 Thread John David Anglin via Gcc-cvs
https://gcc.gnu.org/g:a5a7233dfcee5eb20ed4853c8a1f3cbebe352a7b

commit r15-9360-ga5a7233dfcee5eb20ed4853c8a1f3cbebe352a7b
Author: John David Anglin 
Date:   Thu Apr 10 09:59:01 2025 -0400

hpux: Remove _GLIBCXX_USE_LONG_LONG define from hpux os_defines.h

_GLIBCXX_USE_LONG_LONG is now defined by configure.

2025-04-05  John David Anglin  

libstdc++-v3/ChangeLog:
* config/os/hpux/os_defines.h: Remove _GLIBCXX_USE_LONG_LONG
define.

Diff:
---
 libstdc++-v3/config/os/hpux/os_defines.h | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libstdc++-v3/config/os/hpux/os_defines.h 
b/libstdc++-v3/config/os/hpux/os_defines.h
index d3a6c5ab1426..acc1a022bdec 100644
--- a/libstdc++-v3/config/os/hpux/os_defines.h
+++ b/libstdc++-v3/config/os/hpux/os_defines.h
@@ -52,10 +52,7 @@
 
Also note that the compiler defines _INCLUDE_LONGLONG for C++
unconditionally, which makes intmax_t and uintmax_t long long
-   types.
-
-   We also force _GLIBCXX_USE_LONG_LONG here so that we don't have
-   to bastardize configure to deal with this sillyness.  */
+   types.  */
 
 #if __cplusplus >= 201103L
 namespace std
@@ -77,8 +74,6 @@ namespace std
 } // namespace std
 #endif // __cplusplus
 
-#define _GLIBCXX_USE_LONG_LONG 1
-
 // HPUX on IA64 requires vtable to be 64 bit aligned even at 32 bit
 // mode.  We need to pad the vtable structure to achieve this.
 #if !defined(_LP64) && defined (__ia64__)


[gcc r15-9361] libbacktrace: Add hpux fileline support

2025-04-10 Thread John David Anglin via Gcc-cvs
https://gcc.gnu.org/g:911973a784aab34e13c683545f28177d0d7716cd

commit r15-9361-g911973a784aab34e13c683545f28177d0d7716cd
Author: John David Anglin 
Date:   Thu Apr 10 10:00:13 2025 -0400

libbacktrace: Add hpux fileline support

Fixes libstdc++ stacktrace tests.

2025-04-10  John David Anglin  

libbacktrace/ChangeLog:
* fileline.c (hpux_get_executable_path): New.
(fileline_initialize): Add pass to get hpux executable path.

Diff:
---
 libbacktrace/fileline.c | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/libbacktrace/fileline.c b/libbacktrace/fileline.c
index c9fd86b8c0cd..d2900aa3c66b 100644
--- a/libbacktrace/fileline.c
+++ b/libbacktrace/fileline.c
@@ -47,6 +47,10 @@ POSSIBILITY OF SUCH DAMAGE.  */
 #include 
 #endif
 
+#ifdef __hpux__
+#include 
+#endif
+
 #ifdef HAVE_WINDOWS_H
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
@@ -66,6 +70,33 @@ POSSIBILITY OF SUCH DAMAGE.  */
 #define getexecname() NULL
 #endif
 
+#ifdef __hpux__
+static char *
+hpux_get_executable_path (struct backtrace_state *state,
+ backtrace_error_callback error_callback, void *data)
+{
+  struct shl_descriptor *desc;
+  size_t len = sizeof (struct shl_descriptor);
+
+  desc = backtrace_alloc (state, len, error_callback, data);
+  if (desc == NULL)
+return NULL;
+
+  if (shl_get_r (0, desc) == -1)
+{
+  backtrace_free (state, desc, len, error_callback, data);
+  return NULL;
+}
+
+  return desc->filename;
+}
+
+#else
+
+#define hpux_get_executable_path(state, error_callback, data) NULL
+
+#endif
+
 #if !defined (HAVE_KERN_PROC_ARGS) && !defined (HAVE_KERN_PROC)
 
 #define sysctl_exec_name1(state, error_callback, data) NULL
@@ -245,7 +276,7 @@ fileline_initialize (struct backtrace_state *state,
 
   descriptor = -1;
   called_error_callback = 0;
-  for (pass = 0; pass < 10; ++pass)
+  for (pass = 0; pass < 11; ++pass)
 {
   int does_not_exist;
 
@@ -285,6 +316,9 @@ fileline_initialize (struct backtrace_state *state,
case 9:
  filename = windows_get_executable_path (buf, error_callback, data);
  break;
+   case 10:
+ filename = hpux_get_executable_path (state, error_callback, data);
+ break;
default:
  abort ();
}


[gcc r15-9359] Darwin: Add spec substitution for static-libgcobol.

2025-04-10 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:8c703f67b77b66fc022db47bace69823617459dc

commit r15-9359-g8c703f67b77b66fc022db47bace69823617459dc
Author: Iain Sandoe 
Date:   Thu Apr 10 11:58:58 2025 +0100

Darwin: Add spec substitution for static-libgcobol.

This just follows the common pattern used for other runtime libs.

gcc/ChangeLog:

* config/darwin.h (LINK_SPEC): Add support for
-static-libgcobol.

Signed-off-by: Iain Sandoe 

Diff:
---
 gcc/config/darwin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 8c164fd4b75b..9b9a3fe40388 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -504,6 +504,7 @@ extern GTY(()) int darwin_ms_struct;
%{static|static-libgcc|static-libgfortran:%:replace-outfile(-lgfortran 
libgfortran.a%s)}\
%{static|static-libgcc|static-libquadmath:%:replace-outfile(-lquadmath 
libquadmath.a%s)}\
%{static|static-libgcc|static-libphobos:%:replace-outfile(-lgphobos 
libgphobos.a%s)}\
+   %{static|static-libgcc|static-libgcobol:%:replace-outfile(-lgcobol 
libgcobol.a%s)}\

%{static|static-libgcc|static-libstdc++|static-libgfortran:%:replace-outfile(-lgomp
 libgomp.a%s)}\
%{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ 
libstdc++.a%s)}\
%{static|static-libgm2:%:replace-outfile(-lm2pim libm2pim.a%s)}\


[gcc r14-11580] RISC-V: Fix the behavior for multilib-generator with --cmodel=large on rv32

2025-04-10 Thread Kito Cheng via Gcc-cvs
https://gcc.gnu.org/g:fb0653a0e54203eeb9ff399aee93ed904030b4bd

commit r14-11580-gfb0653a0e54203eeb9ff399aee93ed904030b4bd
Author: Kito Cheng 
Date:   Thu Apr 10 16:58:49 2025 +0800

RISC-V: Fix the behavior for multilib-generator with --cmodel=large on rv32

Large code model is only supported on RV64, so we don't need to
generate the multilibs for RV32 with --cmodel=large. And the compact
code model is something we don't supported on upstream (which is
accidentally added in the past), so we need to remove it.

gcc/ChangeLog:

* config/riscv/multilib-generator: Remove the compact code model
and check large code model for RV32.

(cherry picked from commit 72dff34bcdd6f05b64bbf07739ab815e673b5946)

Diff:
---
 gcc/config/riscv/multilib-generator | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/riscv/multilib-generator 
b/gcc/config/riscv/multilib-generator
index 25cb6762ea73..d1dcbf732fa6 100755
--- a/gcc/config/riscv/multilib-generator
+++ b/gcc/config/riscv/multilib-generator
@@ -159,8 +159,8 @@ for cmodel in cmodels:
  "e.g. rv32imafd-ilp32--" % cfg)
   sys.exit(1)
 
-# Compact code model only support rv64.
-if cmodel == "compact" and arch.startswith("rv32"):
+# Large code model only support rv64.
+if cmodel == "large" and arch.startswith("rv32"):
   continue
 
 arch = arch_canonicalize (arch, args.misa_spec)


[gcc r15-9353] RISC-V: Include local riscv_vector.h in testsuite

2025-04-10 Thread Kito Cheng via Gcc-cvs
https://gcc.gnu.org/g:9e48698228dbf1bbebba3a52d7ae2f47fee89624

commit r15-9353-g9e48698228dbf1bbebba3a52d7ae2f47fee89624
Author: Kito Cheng 
Date:   Wed Apr 9 21:58:23 2025 +0800

RISC-V: Include local riscv_vector.h in testsuite

That could prevent us including stdint.h from glibc, and that will cause
problem when the corresponding multilib isn't built.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c: Include 
local
riscv_vector.h.
* gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c: Ditto.
* gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c: 
Ditto.
* gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c: Ditto.
* gcc.target/riscv/rvv/base/abi-callee-saved-1.c: Ditto.
* gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c: 
Ditto.
* gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c: Ditto.
* gcc.target/riscv/rvv/base/abi-callee-saved-2.c: Ditto.
* gcc.target/riscv/rvv/base/bug-10-2.c: Ditto.
* gcc.target/riscv/rvv/base/bug-10.c: Ditto.
* gcc.target/riscv/rvv/base/bug-7.c: Ditto.
* gcc.target/riscv/rvv/base/bug-8.c: Ditto.
* gcc.target/riscv/rvv/base/bug-9.c: Ditto.
* gcc.target/riscv/rvv/base/pr110943.c: Ditto.
* gcc.target/riscv/rvv/base/pr112431-21.c: Ditto.
* gcc.target/riscv/rvv/base/pr114639-1.c: Ditto.
* gcc.target/riscv/rvv/base/pr115068.c: Ditto.
* gcc.target/riscv/rvv/base/pr117286.c: Ditto.
* gcc.target/riscv/rvv/base/pr117544.c: Ditto.
* gcc.target/riscv/rvv/base/pr117955.c: Ditto.
* gcc.target/riscv/rvv/base/pr118872.c: Ditto.
* gcc.target/riscv/rvv/base/vlmul_ext-1.c: Ditto.
* gcc.target/riscv/rvv/base/vssubu-1.c: Ditto.
* gcc.target/riscv/rvv/base/vssubu-2.c: Ditto.
* gcc.target/riscv/rvv/base/vwaddsub-1.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/pr111234.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/pr115214.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-24.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl_bug-3.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl_bug-4.c: Ditto.
* gcc.target/riscv/rvv/xtheadvector/pr116591.c: Ditto.
* gcc.target/riscv/rvv/xtheadvector/pr116592.c: Ditto.
* gcc.target/riscv/rvv/xtheadvector/pr118357.c: Ditto.
* gcc.target/riscv/rvv/xtheadvector/vsext.c: Ditto.
* gcc.target/riscv/rvv/xtheadvector/vzext.c: Ditto.

Diff:
---
 gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c| 2 +-
 .../gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c   | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1.c| 2 +-
 .../gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c   | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/bug-10-2.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/bug-10.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/bug-7.c | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/bug-8.c | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/bug-9.c | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr110943.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-21.c   | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr114639-1.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr115068.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr117286.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr117544.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr117955.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/pr118872.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c   | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-1.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-2.c  | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr115214.c| 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-24.c   | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetv

[gcc r15-9355] Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399]

2025-04-10 Thread Richard Sandiford via Gcc-cvs
https://gcc.gnu.org/g:4c8c373495d7d863dfb7102726ac3b4b41685df4

commit r15-9355-g4c8c373495d7d863dfb7102726ac3b4b41685df4
Author: Richard Sandiford 
Date:   Thu Apr 10 11:03:04 2025 +0100

Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399]

In r10-4803-g8489e1f45b50600c I'd used POINTER_DIFF_EXPR to subtract
the two pointers involved in an overlap test.  I'm not sure whether
I'd specifically chosen that over MINUS_EXPR or not; if so, the only
reason I can think of is that it is probably faster on targets with
PSImode pointers.  Regardless, as the PR points out, subtracting
unrelated pointers using POINTER_DIFF_EXPR is undefined behaviour.

gcc/
PR tree-optimization/119399
* tree-data-ref.cc (create_waw_or_war_checks): Use a MINUS_EXPR
on two converted pointers, rather than converting a 
POINTER_DIFF_EXPR
on the pointers.

gcc/testsuite/
PR tree-optimization/119399
* gcc.dg/vect/pr119399.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr119399.c | 10 ++
 gcc/tree-data-ref.cc |  7 ---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/pr119399.c 
b/gcc/testsuite/gcc.dg/vect/pr119399.c
new file mode 100644
index ..8d868f44b672
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr119399.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-vect-raw" } */
+
+void foo(int *p, int *q, int n)
+{
+  for (int i = 0; i < n; i++)
+p[i] = q[i] + 1;
+}
+
+/* { dg-final { scan-tree-dump-not {

[gcc r15-9354] RISC-V: Fix the behavior for multilib-generator with --cmodel=large on rv32

2025-04-10 Thread Kito Cheng via Gcc-cvs
https://gcc.gnu.org/g:72dff34bcdd6f05b64bbf07739ab815e673b5946

commit r15-9354-g72dff34bcdd6f05b64bbf07739ab815e673b5946
Author: Kito Cheng 
Date:   Thu Apr 10 16:58:49 2025 +0800

RISC-V: Fix the behavior for multilib-generator with --cmodel=large on rv32

Large code model is only supported on RV64, so we don't need to
generate the multilibs for RV32 with --cmodel=large. And the compact
code model is something we don't supported on upstream (which is
accidentally added in the past), so we need to remove it.

gcc/ChangeLog:

* config/riscv/multilib-generator: Remove the compact code model
and check large code model for RV32.

Diff:
---
 gcc/config/riscv/multilib-generator | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/riscv/multilib-generator 
b/gcc/config/riscv/multilib-generator
index 48280168b5be..6ad1cf0e5532 100755
--- a/gcc/config/riscv/multilib-generator
+++ b/gcc/config/riscv/multilib-generator
@@ -159,8 +159,8 @@ for cmodel in cmodels:
  "e.g. rv32imafd-ilp32--" % cfg)
   sys.exit(1)
 
-# Compact code model only support rv64.
-if cmodel == "compact" and arch.startswith("rv32"):
+# Large code model only support rv64.
+if cmodel == "large" and arch.startswith("rv32"):
   continue
 
 arch = arch_canonicalize (arch, args.misa_spec)


[gcc r14-11581] [PATCH] RISC-V: Bugfix for unrecognizable insn for XTheadVector

2025-04-10 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:07d4c264a000b6448d6b519110c05c3b8a64d23b

commit r14-11581-g07d4c264a000b6448d6b519110c05c3b8a64d23b
Author: Jin Ma 
Date:   Wed Nov 13 15:19:29 2024 -0700

[PATCH] RISC-V: Bugfix for unrecognizable insn for XTheadVector

error: unrecognizable insn:

(insn 35 34 36 2 (set (subreg:RVVM1SF (reg/v:RVVM1x4SF 142 [ _r ]) 0)
(unspec:RVVM1SF [
(const_vector:RVVM1SF repeat [
(const_double:SF 0.0 [0x0.0p+0])
])
(reg:DI 0 zero)
(const_int 1 [0x1])
(reg:SI 66 vl)
(reg:SI 67 vtype)
] UNSPEC_TH_VWLDST)) -1
 (nil))
during RTL pass: mode_sw

PR target/116591

gcc/ChangeLog:

* config/riscv/vector.md: Add restriction to call pred_th_whole_mov.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr116591.c: New test.

(cherry picked from commit 8564d0948c72df0a66d7eb47e15c6ab43e9b25ce)

Diff:
---
 gcc/config/riscv/vector.md |  4 ++--
 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c | 14 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 913c09ffd856..327690a71f46 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -1097,7 +1097,7 @@
- We can not leave it to TARGET_SECONDARY_RELOAD since it happens
 before spilling. The clobber scratch is used by spilling fractional
 registers in IRA/LRA so it's too early.  */
-  if (TARGET_XTHEADVECTOR)
+  if (TARGET_XTHEADVECTOR && reg_or_mem_operand (operands[1], mode))
 {
   emit_insn (gen_pred_th_whole_mov (mode, operands[0], operands[1],
RVV_VLMAX, 
GEN_INT(riscv_vector::VLMAX)));
@@ -1197,7 +1197,7 @@
(match_operand:VB 1 "general_operand"))]
   "TARGET_VECTOR"
 {
-  if (TARGET_XTHEADVECTOR)
+  if (TARGET_XTHEADVECTOR && reg_or_mem_operand (operands[1], mode))
 {
   emit_insn (gen_pred_th_whole_mov (mode, operands[0], operands[1],
RVV_VLMAX, 
GEN_INT(riscv_vector::VLMAX)));
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c
new file mode 100644
index ..dfaf82ce1ca8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c
@@ -0,0 +1,14 @@
+/* { dg-do assemble } */
+/* { dg-options "-march=rv32gc_xtheadvector -mabi=ilp32d -O2 -save-temps" { 
target { rv32 } } } */
+/* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O2 -save-temps" { 
target { rv64 } } } */
+
+#include 
+
+void
+foo (float *a, int b)
+{
+  vfloat32m1x4_t c;
+  __riscv_vsseg4e32_v_f32m1x4(a, c, b);
+}
+
+/* { dg-final { scan-assembler-times {th\.vmv\.v\.i\tv[0-9]+,0} 4 } } */


[gcc r14-11583] RISC-V: Add a new constraint to ensure that the vl of XTheadVector does not get a non-zero immediate

2025-04-10 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:2631ac38d9b2a9def13a04c1e1fefb3871e420ab

commit r14-11583-g2631ac38d9b2a9def13a04c1e1fefb3871e420ab
Author: Jin Ma 
Date:   Tue Jan 21 10:46:37 2025 -0700

RISC-V: Add a new constraint to ensure that the vl of XTheadVector does not 
get a non-zero immediate

Although we have handled the vl of XTheadVector correctly in the
expand phase and predicates, the results show that the work is
still insufficient.

In the curr_insn_transform function, the insn is transformed from:
(insn 69 67 225 12 (set (mem:RVVM8SF (reg/f:DI 218 [ _77 ]) [0  S[128, 128] 
A32])
(if_then_else:RVVM8SF (unspec:RVVMF4BI [
(const_vector:RVVMF4BI repeat [
(const_int 1 [0x1])
])
(reg:DI 209)
(const_int 0 [0])
(reg:SI 66 vl)
(reg:SI 67 vtype)
] UNSPEC_VPREDICATE)
(reg/v:RVVM8SF 143 [ _xx ])
(mem:RVVM8SF (reg/f:DI 218 [ _77 ]) [0  S[128, 128] A32])))
 (expr_list:REG_DEAD (reg/v:RVVM8SF 143 [ _xx ])
(nil)))
to
(insn 69 284 225 11 (set (mem:RVVM8SF (reg/f:DI 18 s2 [orig:218 _77 ] 
[218]) [0  S[128, 128] A32])
(if_then_else:RVVM8SF (unspec:RVVMF4BI [
(const_vector:RVVMF4BI repeat [
(const_int 1 [0x1])
])
(const_int 1 [0x1])
(const_int 0 [0])
(reg:SI 66 vl)
(reg:SI 67 vtype)
] UNSPEC_VPREDICATE)
(reg/v:RVVM8SF 104 v8 [orig:143 _xx ] [143])
(mem:RVVM8SF (reg/f:DI 18 s2 [orig:218 _77 ] [218]) [0  S[128, 
128] A32])))
 (nil))

Looking at the log for the reload pass, it is found that "Changing pseudo 
209 in
operand 3 of insn 69 on equiv 0x1".
It converts the vl operand in insn from the expected register(reg:DI 209) 
to the
constant 1(const_int 1 [0x1]).

This conversion occurs because, although the predicate for the vl operand is
restricted by "vector_length_operand" in the pattern, the constraint is 
still
"rK", which allows the transformation.

The issue is that changing the "rK" constraint to "rJ" for the constraint 
of vl
operand in the pattern would prevent this conversion, But unfortunately 
this will
conflict with RVV (RISC-V Vector Extension).

Based on the review's recommendations, the best solution for now is to 
create
a new constraint to distinguish between RVV and XTheadVector, which is 
exactly
what this patch does.

PR target/116593

gcc/ChangeLog:

* config/riscv/constraints.md (vl): New.
* config/riscv/thead-vector.md: Replacing rK with rvl.
* config/riscv/vector.md: Likewise.

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/rvv.exp: Enable testsuite of XTheadVector.
* g++.target/riscv/rvv/xtheadvector/pr116593.C: New test.

(cherry picked from commit 3024b12f2cde5db3bf52b49b07e32ef3065929fb)

Diff:
---
 gcc/config/riscv/constraints.md|   6 +
 gcc/config/riscv/thead-vector.md   |  18 +-
 gcc/config/riscv/vector.md | 500 ++---
 gcc/testsuite/g++.target/riscv/rvv/rvv.exp |   3 +
 .../g++.target/riscv/rvv/xtheadvector/pr116593.C   |  47 ++
 5 files changed, 315 insertions(+), 259 deletions(-)

diff --git a/gcc/config/riscv/constraints.md b/gcc/config/riscv/constraints.md
index a590df545d7d..a03a1d755051 100644
--- a/gcc/config/riscv/constraints.md
+++ b/gcc/config/riscv/constraints.md
@@ -188,6 +188,12 @@
   (and (match_code "const_vector")
(match_test "riscv_vector::const_vec_all_same_in_range_p (op, 0, 31)")))
 
+(define_constraint "vl"
+  "A uimm5 for Vector or zero for XTheadVector."
+  (and (match_code "const_int")
+   (ior (match_test "!TARGET_XTHEADVECTOR && satisfies_constraint_K (op)")
+   (match_test "TARGET_XTHEADVECTOR && satisfies_constraint_J (op)"
+
 (define_constraint "Wc0"
   "@internal
  A constraint that matches a vector of immediate all zeros."
diff --git a/gcc/config/riscv/thead-vector.md b/gcc/config/riscv/thead-vector.md
index 5fe9ba08c4eb..5a02debdd207 100644
--- a/gcc/config/riscv/thead-vector.md
+++ b/gcc/config/riscv/thead-vector.md
@@ -108,7 +108,7 @@
   [(set (match_operand:V_VLS_VT 0 "reg_or_mem_operand"  "=vr,vr, m")
(unspec:V_VLS_VT
  [(match_operand:V_VLS_VT 1 "reg_or_mem_operand" " vr, m,vr")
-  (match_operand 2 "vector_length_operand"   " rK, rK, rK")
+  (match_operand 2 "vector_length_operand"   "rvl,rvl,rvl")
   (match_operand 3 "const_1_operand" "  i, i, i")
   (reg:SI VL_REGNUM)
   (reg

[gcc r14-11582] RISC-V: Enable and adjust the testsuite for XTheadVector.

2025-04-10 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:319b9a385d42f529da49d2b90a98ea92bab54b39

commit r14-11582-g319b9a385d42f529da49d2b90a98ea92bab54b39
Author: Jin Ma 
Date:   Tue Jan 21 10:43:47 2025 -0700

RISC-V: Enable and adjust the testsuite for XTheadVector.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/rvv.exp: Enable testsuite of
XTheadVector.
* gcc.target/riscv/rvv/xtheadvector/pr114194.c: Adjust correctly.
* gcc.target/riscv/rvv/xtheadvector/prefix.c: Likewise.
* gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c: Likewise.
* gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c: Likewise.
* gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c: Likewise.
* gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c: Likewise.
* gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c: Likewise.
* gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c: Likewise.

(cherry picked from commit ab24171d237a9138714f0e6d2bb38fd357ccaed9)

Diff:
---
 gcc/testsuite/gcc.target/riscv/rvv/rvv.exp |  2 ++
 .../gcc.target/riscv/rvv/xtheadvector/pr114194.c   | 32 +++---
 .../gcc.target/riscv/rvv/xtheadvector/prefix.c |  2 +-
 .../gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c| 17 +++-
 .../gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c   | 17 +++-
 .../gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c| 17 +++-
 .../gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c   | 17 +++-
 .../gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c| 17 +++-
 .../gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c   | 17 +++-
 9 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp 
b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp
index 8c4e916d5b1f..b407ebfb017f 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp
+++ b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp
@@ -37,6 +37,8 @@ dg-init
 set CFLAGS "$DEFAULT_CFLAGS -O3"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/base/*.\[cS\]]] \
"" $CFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/xtheadvector/*.\[cS\]]] \
+   "" $CFLAGS
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vsetvl/*.\[cS\]]] \
"" $CFLAGS
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/*.\[cS\]]] \
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194.c
index fc2d13494256..2e53a7ecc3e7 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194.c
@@ -1,11 +1,11 @@
 /* { dg-do compile } */
-/* { dg-options "-march=rv32gc_xtheadvector" { target { rv32 } } } */
-/* { dg-options "-march=rv64gc_xtheadvector" { target { rv64 } } } */
+/* { dg-options "-march=rv32gc_xtheadvector -O2" { target { rv32 } } } */
+/* { dg-options "-march=rv64gc_xtheadvector -O2" { target { rv64 } } } */
 /* { dg-final { check-function-bodies "**" "" } } */
 
 /*
 ** foo0_1:
-** sb\tzero,0([a-x0-9]+)
+** sb\tzero,0\([a-x0-9]+\)
 ** ret
 */
 void foo0_1 (void *p)
@@ -15,13 +15,13 @@ void foo0_1 (void *p)
 
 /*
 ** foo0_7:
-** sb\tzero,0([a-x0-9]+)
-** sb\tzero,1([a-x0-9]+)
-** sb\tzero,2([a-x0-9]+)
-** sb\tzero,3([a-x0-9]+)
-** sb\tzero,4([a-x0-9]+)
-** sb\tzero,5([a-x0-9]+)
-** sb\tzero,6([a-x0-9]+)
+** sb\tzero,0\([a-x0-9]+\)
+** sb\tzero,1\([a-x0-9]+\)
+** sb\tzero,2\([a-x0-9]+\)
+** sb\tzero,3\([a-x0-9]+\)
+** sb\tzero,4\([a-x0-9]+\)
+** sb\tzero,5\([a-x0-9]+\)
+** sb\tzero,6\([a-x0-9]+\)
 ** ret
 */
 void foo0_7 (void *p)
@@ -32,7 +32,7 @@ void foo0_7 (void *p)
 /*
 ** foo1_1:
 ** li\t[a-x0-9]+,1
-** sb\t[a-x0-9]+,0([a-x0-9]+)
+** sb\t[a-x0-9]+,0\([a-x0-9]+\)
 ** ret
 */
 void foo1_1 (void *p)
@@ -43,11 +43,11 @@ void foo1_1 (void *p)
 /*
 ** foo1_5:
 ** li\t[a-x0-9]+,1
-** sb\t[a-x0-9]+,0([a-x0-9]+)
-** sb\t[a-x0-9]+,1([a-x0-9]+)
-** sb\t[a-x0-9]+,2([a-x0-9]+)
-** sb\t[a-x0-9]+,3([a-x0-9]+)
-** sb\t[a-x0-9]+,4([a-x0-9]+)
+** sb\t[a-x0-9]+,0\([a-x0-9]+\)
+** sb\t[a-x0-9]+,1\([a-x0-9]+\)
+** sb\t[a-x0-9]+,2\([a-x0-9]+\)
+** sb\t[a-x0-9]+,3\([a-x0-9]+\)
+** sb\t[a-x0-9]+,4\([a-x0-9]+\)
 ** ret
 */
 void foo1_5 (void *p)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
index eee727ef6b42..0a18e697830c 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
@@ -9,4 +9,4 @@ prefix (vint32m1_t vx, vint32m1_t vy, size_t vl)
   return __riscv_vadd_vv_i32m1 (vx, vy, vl);
 }
 
-/* { dg-final { scan-assembler {\mth\.v\M} } } */
+/* { dg-final { scan-assembler {\mth\.vadd\.vv\M} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c 
b/gcc/testsuite/gcc.target/riscv/rvv

[gcc r14-11585] RISC-V: Disable unsupported vsext/vzext patterns for XTheadVector.

2025-04-10 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:51e041a9db714215d310bf69969de7b6f1c7c2bf

commit r14-11585-g51e041a9db714215d310bf69969de7b6f1c7c2bf
Author: Jin Ma 
Date:   Mon Apr 7 14:21:50 2025 +0800

RISC-V: Disable unsupported vsext/vzext patterns for XTheadVector.

XThreadVector does not support the vsext/vzext instructions; however,
due to the reuse of RVV optimizations, it may generate these instructions
in certain cases. To prevent the error "Unknown opcode 'th.vsext.vf2',"
we should disable these patterns.

V2:
Change the value of dg-do in the test case from assemble to compile, and
remove the -save-temps option.

gcc/ChangeLog:

* config/riscv/vector.md: Disable vsext/vzext for XTheadVector.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/vsext.c: New test.
* gcc.target/riscv/rvv/xtheadvector/vzext.c: New test.

(cherry picked from commit 196b45caca0aae57a95bffcdd5c188994317de08)

Diff:
---
 gcc/config/riscv/vector.md |  6 +++---
 .../gcc.target/riscv/rvv/xtheadvector/vsext.c  | 24 ++
 .../gcc.target/riscv/rvv/xtheadvector/vzext.c  | 24 ++
 3 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 6fd169746934..80d810fbca77 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -3839,7 +3839,7 @@
  (any_extend:VWEXTI
(match_operand: 3 "register_operand" "   vr,   vr"))
  (match_operand:VWEXTI 2 "vector_merge_operand" "   vu,
0")))]
-  "TARGET_VECTOR"
+  "TARGET_VECTOR && !TARGET_XTHEADVECTOR"
   "vext.vf2\t%0,%3%p1"
   [(set_attr "type" "vext")
(set_attr "mode" "")])
@@ -3859,7 +3859,7 @@
  (any_extend:VQEXTI
(match_operand: 3 "register_operand" "   vr,   vr"))
  (match_operand:VQEXTI 2 "vector_merge_operand"   "   vu,0")))]
-  "TARGET_VECTOR"
+  "TARGET_VECTOR && !TARGET_XTHEADVECTOR"
   "vext.vf4\t%0,%3%p1"
   [(set_attr "type" "vext")
(set_attr "mode" "")])
@@ -3879,7 +3879,7 @@
  (any_extend:VOEXTI
(match_operand: 3 "register_operand" "   vr,   vr"))
  (match_operand:VOEXTI 2 "vector_merge_operand"  "   vu,0")))]
-  "TARGET_VECTOR"
+  "TARGET_VECTOR && !TARGET_XTHEADVECTOR"
   "vext.vf8\t%0,%3%p1"
   [(set_attr "type" "vext")
(set_attr "mode" "")])
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vsext.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vsext.c
new file mode 100644
index ..ecf338db5ba8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vsext.c
@@ -0,0 +1,24 @@
+/* { dg-do compile { target { rv64 } } } */
+/* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O3" } */
+
+#include 
+
+struct a
+{
+  int b[10];
+} c (vint32m4_t), d;
+
+char e;
+char *f;
+
+void g ()
+{
+  int h;
+  vint32m4_t i;
+  vint8m1_t j = __riscv_vlse8_v_i8m1 (&e, d.b[3], h);
+  vint16m2_t k = __riscv_vwadd_vx_i16m2 (j, 0, h);
+  i = __riscv_vwmacc_vx_i32m4 (i, f[0], k, h);
+  c (i);
+}
+
+/* { dg-final { scan-assembler-not {th\.vsext\.vf2} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vzext.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vzext.c
new file mode 100644
index ..753f65309147
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vzext.c
@@ -0,0 +1,24 @@
+/* { dg-do compile { target { rv64 } } } */
+/* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O3" } */
+
+#include 
+
+struct a
+{
+  int b[10];
+} c (vuint32m4_t), d;
+
+char e;
+char *f;
+
+void g ()
+{
+  int h;
+  vuint32m4_t i;
+  vuint8m1_t j = __riscv_vlse8_v_u8m1 (&e, d.b[3], h);
+  vuint16m2_t k = __riscv_vwaddu_vx_u16m2 (j, 0, h);
+  i = __riscv_vwmaccu_vx_u32m4 (i, f[0], k, h);
+  c (i);
+}
+
+/* { dg-final { scan-assembler-not {th\.vzext\.vf2} } } */


[gcc r14-11586] libstdc++: Always instantiate key_type to compute hash code [PR115285]

2025-04-10 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:6343a0fef382a6f37f50755beb239f4e1e9e83cb

commit r14-11586-g6343a0fef382a6f37f50755beb239f4e1e9e83cb
Author: François Dumont 
Date:   Tue Oct 22 19:13:34 2024 +0200

libstdc++: Always instantiate key_type to compute hash code [PR115285]

Even if it is possible to compute a hash code from the inserted arguments
we need to instantiate the key_type to guaranty hash code consistency.

Preserve the lazy instantiation of the mapped_type in the context of
associative containers.

libstdc++-v3/ChangeLog:

PR libstdc++/115285
* include/bits/hashtable.h (_S_forward_key<_Kt>): Always return a 
temporary
key_type instance.
* testsuite/23_containers/unordered_map/96088.cc: Adapt to 
additional instanciation.
Also check that mapped_type is not instantiated when there is no 
insertion.
* testsuite/23_containers/unordered_multimap/96088.cc: Adapt to 
additional
instanciation.
* testsuite/23_containers/unordered_multiset/96088.cc: Likewise.
* testsuite/23_containers/unordered_set/96088.cc: Likewise.
* testsuite/23_containers/unordered_set/pr115285.cc: New test case.

(cherry picked from commit ee030b28004eade3da872e7ae62a526a2940a705)

Diff:
---
 libstdc++-v3/include/bits/hashtable.h  |  5 +-
 .../testsuite/23_containers/unordered_map/96088.cc | 86 +++---
 .../23_containers/unordered_multimap/96088.cc  | 17 ++---
 .../23_containers/unordered_multiset/96088.cc  |  5 +-
 .../testsuite/23_containers/unordered_set/96088.cc | 15 ++--
 .../23_containers/unordered_set/pr115285.cc| 40 ++
 6 files changed, 101 insertions(+), 67 deletions(-)

diff --git a/libstdc++-v3/include/bits/hashtable.h 
b/libstdc++-v3/include/bits/hashtable.h
index f5f421d2fd32..610650e0c785 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -925,10 +925,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_insert_unique(_Kt&&, _Arg&&, const _NodeGenerator&);
 
   template
-   static __conditional_t<
- __and_<__is_nothrow_invocable<_Hash&, const key_type&>,
-__not_<__is_nothrow_invocable<_Hash&, _Kt>>>::value,
- key_type, _Kt&&>
+   key_type
_S_forward_key(_Kt&& __k)
{ return std::forward<_Kt>(__k); }
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc 
b/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
index 2065caab6c5c..b5be7d06aa03 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
@@ -29,46 +29,45 @@
 #include 
 #include 
 
-static constexpr std::initializer_list> lst = {
-{"long_str_for_dynamic_allocating", 1}
-};
+static constexpr std::initializer_list> 
lst =
+  { { "long_str_for_dynamic_allocation", "long_str_for_dynamic_allocation" } };
 
 void
 test01()
 {
   __gnu_test::counter::reset();
-  std::unordered_map um;
+  std::unordered_map um;
   um.insert(lst.begin(), lst.end());
   VERIFY( um.size() == 1 );
 
-  VERIFY( __gnu_test::counter::count() == 3 );
-  VERIFY( __gnu_test::counter::get()._M_increments == 3 );
+  VERIFY( __gnu_test::counter::count() == 4 );
+  VERIFY( __gnu_test::counter::get()._M_increments == 4 );
 
   um.insert(lst.begin(), lst.end());
   VERIFY( um.size() == 1 );
 
-  VERIFY( __gnu_test::counter::count() == 3 );
-  VERIFY( __gnu_test::counter::get()._M_increments == 4 );
+  VERIFY( __gnu_test::counter::count() == 4 );
+  VERIFY( __gnu_test::counter::get()._M_increments == 5 );
 }
 
 void
 test02()
 {
   __gnu_test::counter::reset();
-  std::unordered_map,
 std::equal_to> um;
   um.insert(lst.begin(), lst.end());
   VERIFY( um.size() == 1 );
 
-  VERIFY( __gnu_test::counter::count() == 3 );
-  VERIFY( __gnu_test::counter::get()._M_increments == 3 );
+  VERIFY( __gnu_test::counter::count() == 4 );
+  VERIFY( __gnu_test::counter::get()._M_increments == 4 );
 
   um.insert(lst.begin(), lst.end());
   VERIFY( um.size() == 1 );
 
-  VERIFY( __gnu_test::counter::count() == 3 );
-  VERIFY( __gnu_test::counter::get()._M_increments == 3 );
+  VERIFY( __gnu_test::counter::count() == 4 );
+  VERIFY( __gnu_test::counter::get()._M_increments == 5 );
 }
 
 std::size_t
@@ -84,20 +83,20 @@ test11()
   typedef std::size_t (*hash_string_t)(const std::string&) noexcept;
   __gnu_test::counter::reset();
   hash_string_t hasher = &hash_string_f;
-  std::unordered_map> um(0, hasher);
   um.insert(lst.begin(), lst.end());
   VERIFY( um.size() == 1 );
 
-  VERIFY( __gnu_test::counter::count() == 3 );
-  VERIFY( __gnu_test::counter::get()._M_increments == 3 );
+  VERIFY( __gnu_test::counter::count() == 4 );
+  VERIFY( __gnu_test::counter::get()._M_increments == 4 );
 
   um.insert(lst.begin(), lst.end());
   VERIFY( um.size() == 1 );
 
-  VERIFY( __gnu_test::counter::co

[gcc r14-11589] libstdc++: Fix conversions to key/value types for hash table insertion [PR115285]

2025-04-10 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:5cfe086bea29799c2d4eff59d2d43e30a162bf9c

commit r14-11589-g5cfe086bea29799c2d4eff59d2d43e30a162bf9c
Author: Jonathan Wakely 
Date:   Tue Nov 5 17:19:06 2024 +

libstdc++: Fix conversions to key/value types for hash table insertion 
[PR115285]

The conversions to key_type and value_type that are performed when
inserting into _Hashtable need to be fixed to do any required
conversions explicitly. The current code assumes that conversions from
the parameter to the key_type or value_type can be done implicitly,
which isn't necessarily true.

Remove the _S_forward_key function which doesn't handle all cases and
either forward the parameter if it already has type cv key_type, or
explicitly construct a temporary of type key_type.

Similarly, the _ConvertToValueType specialization for maps doesn't
handle all cases either, for std::pair arguments only some value
categories are handled. Remove _ConvertToValueType and for the _M_insert
function for unique keys, either forward the argument unchanged or
explicitly construct a temporary of type value_type.

For the _M_insert overload for non-unique keys we don't need any
conversion at all, we can just forward the argument directly to where we
construct a node.

libstdc++-v3/ChangeLog:

PR libstdc++/115285
* include/bits/hashtable.h (_Hashtable::_S_forward_key): Remove.
(_Hashtable::_M_insert_unique_aux): Replace _S_forward_key with
a static_cast to a type defined using conditional_t.
(_Hashtable::_M_insert): Replace _ConvertToValueType with a
static_cast to a type defined using conditional_t.
* include/bits/hashtable_policy.h (_ConvertToValueType): Remove.
* testsuite/23_containers/unordered_map/insert/115285.cc: New test.
* testsuite/23_containers/unordered_set/insert/115285.cc: New test.
* testsuite/23_containers/unordered_set/96088.cc: Adjust
expected number of allocations.

(cherry picked from commit 90c578654a2c96032aa6621449859243df5f641b)

Diff:
---
 libstdc++-v3/include/bits/hashtable.h  | 33 ++-
 libstdc++-v3/include/bits/hashtable_policy.h   | 34 
 .../23_containers/unordered_map/insert/115285.cc   | 47 ++
 .../testsuite/23_containers/unordered_set/96088.cc |  2 +-
 .../23_containers/unordered_set/insert/115285.cc   | 28 +
 5 files changed, 88 insertions(+), 56 deletions(-)

diff --git a/libstdc++-v3/include/bits/hashtable.h 
b/libstdc++-v3/include/bits/hashtable.h
index 610650e0c785..ab448807113e 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -924,25 +924,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::pair
_M_insert_unique(_Kt&&, _Arg&&, const _NodeGenerator&);
 
-  template
-   key_type
-   _S_forward_key(_Kt&& __k)
-   { return std::forward<_Kt>(__k); }
-
-  static const key_type&
-  _S_forward_key(const key_type& __k)
-  { return __k; }
-
-  static key_type&&
-  _S_forward_key(key_type&& __k)
-  { return std::move(__k); }
-
   template
std::pair
_M_insert_unique_aux(_Arg&& __arg, const _NodeGenerator& __node_gen)
{
+ using _Kt = decltype(_ExtractKey{}(std::forward<_Arg>(__arg)));
+ constexpr bool __is_key_type
+   = is_same<__remove_cvref_t<_Kt>, key_type>::value;
+ using _Fwd_key = __conditional_t<__is_key_type, _Kt&&, key_type>;
  return _M_insert_unique(
-   _S_forward_key(_ExtractKey{}(std::forward<_Arg>(__arg))),
+   static_cast<_Fwd_key>(_ExtractKey{}(std::forward<_Arg>(__arg))),
std::forward<_Arg>(__arg), __node_gen);
}
 
@@ -951,10 +942,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_insert(_Arg&& __arg, const _NodeGenerator& __node_gen,
  true_type /* __uks */)
{
- using __to_value
-   = __detail::_ConvertToValueType<_ExtractKey, value_type>;
+ using __detail::_Identity;
+ using _Vt = __conditional_t::value
+   || __is_pair<__remove_cvref_t<_Arg>>,
+ _Arg&&, value_type>;
  return _M_insert_unique_aux(
-   __to_value{}(std::forward<_Arg>(__arg)), __node_gen);
+  static_cast<_Vt>(std::forward<_Arg>(__arg)), __node_gen);
}
 
   template
@@ -962,10 +955,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_insert(_Arg&& __arg, const _NodeGenerator& __node_gen,
  false_type __uks)
{
- using __to_value
-   = __detail::_ConvertToValueType<_ExtractKey, value_type>;
- return _M_insert(cend(),
-   __to_value{}(std::forward<_Arg>(__arg)), __node_gen, __uks);
+ return _M_insert(cend(), std::forw

[gcc r14-11587] libstdc++: Fix test broken when using COW std::string

2025-04-10 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:9119752d3782a50effbfc1ebaed3902bae75c419

commit r14-11587-g9119752d3782a50effbfc1ebaed3902bae75c419
Author: François Dumont 
Date:   Thu Oct 24 20:30:16 2024 +0200

libstdc++: Fix test broken when using COW std::string

libstdc++-v3/ChangeLog:

* testsuite/23_containers/unordered_map/96088.cc (test03): Fix 
increments
value when _GLIBCXX_USE_CXX11_ABI is equal to 0.

(cherry picked from commit d01dc97a26d2f5034ca135f46094aa52c44cc90a)

Diff:
---
 libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc 
b/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
index b5be7d06aa03..ee41675a16ba 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
@@ -233,9 +233,8 @@ test03()
 um.insert(v.begin(), v.end());
 VERIFY( um.size() == 1 );
 
-// Allocate array of buckets, a node, the std::string value and the
-// std::string key (unless COW).
-constexpr std::size_t increments = _GLIBCXX_USE_CXX11_ABI ? 4 : 3;
+// Allocate array of buckets, a node, and the 2 std::string (unless COW).
+constexpr std::size_t increments = _GLIBCXX_USE_CXX11_ABI ? 4 : 2;
 
 VERIFY( __gnu_test::counter::count() == origin + increments );
 VERIFY( __gnu_test::counter::get()._M_increments == increments );


[gcc r15-9357] libgcobol: Allow libgcobol to use libquadmath [PR119244].

2025-04-10 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:95f10974a9190e345776604480a2df0191104308

commit r15-9357-g95f10974a9190e345776604480a2df0191104308
Author: Iain Sandoe 
Date:   Sat Mar 15 22:58:46 2025 +

libgcobol: Allow libgcobol to use libquadmath [PR119244].

Many of the changes are mechanical:
 1. 'GCOB_FP128' in place of _Float128.
 2. Using FP128_FUNC to represent the spelling of intrinsics.
 3. Using GCOB_FP128_LITERAL() to choose the suffix for literals.

This allows for:
  __float128 and 'q' as the suffix when libquadmath is configured.
   _Float128 / 'f128' when IEC-60559 is available in libc
 long double / 'l' when long double is ieee753 128b.

Add libquadmath to libgcobol.spec and its dependencies  where the
platform needs it.

PR cobol/119244

libgcobol/ChangeLog:

* Makefile.am: Add support for libquadmath.
* Makefile.in: Regenerate.
* acinclude.m4: Add support for libquadmath.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Configure libquadmath support.
* gmath.cc: Use GCOB_FP128 to represent the configured
128b floating point type.  Use FP128_FUNC to represent
the naming of intrinsics in the configure 128b floating
point type. Render literals with GCOB_FP128_LITERAL.
* intrinsic.cc: Likewise.
* libgcobol.cc: Likewise.
* libgcobol.h: Likewise.
* libgcobol-fp.h: New file.
* gfileio.cc: Include libgcobol-fp.h.
* libgcobol.spec.in: Add libquadmath configure output.

Signed-off-by: Iain Sandoe 

Diff:
---
 libgcobol/Makefile.am   |   9 +-
 libgcobol/Makefile.in   |  14 +-
 libgcobol/acinclude.m4  | 162 ++
 libgcobol/config.h.in   |  30 +++
 libgcobol/configure | 527 +---
 libgcobol/configure.ac  |  41 +++-
 libgcobol/gfileio.cc|   1 +
 libgcobol/gmath.cc  | 108 +
 libgcobol/intrinsic.cc  | 186 
 libgcobol/libgcobol-fp.h|  50 +
 libgcobol/libgcobol.cc  | 186 +---
 libgcobol/libgcobol.h   |  10 +-
 libgcobol/libgcobol.spec.in |   2 +-
 13 files changed, 1048 insertions(+), 278 deletions(-)

diff --git a/libgcobol/Makefile.am b/libgcobol/Makefile.am
index 89d0519ed062..0a17d2077f19 100644
--- a/libgcobol/Makefile.am
+++ b/libgcobol/Makefile.am
@@ -46,7 +46,7 @@ libgcobol_la_SOURCES =\
 
 WARN_CFLAGS = -W -Wall -Wwrite-strings
 
-AM_CPPFLAGS = -I. -I$(srcdir)
+AM_CPPFLAGS = -I. -I$(srcdir) $(LIBQUADINCLUDE)
 AM_CFLAGS = $(XCFLAGS)
 AM_CXXFLAGS = $(XCFLAGS)
 AM_CXXFLAGS += $(WARN_CFLAGS)
@@ -62,9 +62,8 @@ endif
 # We want to link with the c++ runtime.
 libgcobol_la_LINK = $(CXXLINK) $(libgcobol_la_LDFLAGS)
 version_arg = -version-info $(LIBGCOBOL_VERSION)
-libgcobol_la_LDFLAGS = $(LTLDFLAGS) $(LTLIBICONV) \
-   $(extra_ldflags_libgcobol) $(LIBS) \
-   $(version_arg)
-libgcobol_la_DEPENDENCIES = libgcobol.spec
+libgcobol_la_LDFLAGS = $(LTLDFLAGS) $(LIBQUADLIB) $(LTLIBICONV) \
+   $(extra_ldflags_libgcobol) $(LIBS) $(version_arg)
+libgcobol_la_DEPENDENCIES = libgcobol.spec $(LIBQUADLIB_DEP)
 
 endif BUILD_LIBGCOBOL
diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in
index 88158cbf377b..5fdc42c2a20f 100644
--- a/libgcobol/Makefile.in
+++ b/libgcobol/Makefile.in
@@ -288,6 +288,10 @@ LIBGCOBOL_VERSION = @LIBGCOBOL_VERSION@
 LIBICONV = @LIBICONV@
 LIBM = @LIBM@
 LIBOBJS = @LIBOBJS@
+LIBQUADINCLUDE = @LIBQUADINCLUDE@
+LIBQUADLIB = @LIBQUADLIB@
+LIBQUADLIB_DEP = @LIBQUADLIB_DEP@
+LIBQUADSPEC = @LIBQUADSPEC@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
@@ -317,6 +321,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SPEC_LIBGCOBOL_DEPS = @SPEC_LIBGCOBOL_DEPS@
 STRIP = @STRIP@
+USE_IEC_60559 = @USE_IEC_60559@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -402,7 +407,7 @@ gcc_version := $(shell @get_gcc_base_ver@ 
$(top_srcdir)/../gcc/BASE-VER)
 @BUILD_LIBGCOBOL_TRUE@ valconv.cc
 
 @BUILD_LIBGCOBOL_TRUE@WARN_CFLAGS = -W -Wall -Wwrite-strings
-@BUILD_LIBGCOBOL_TRUE@AM_CPPFLAGS = -I. -I$(srcdir)
+@BUILD_LIBGCOBOL_TRUE@AM_CPPFLAGS = -I. -I$(srcdir) $(LIBQUADINCLUDE)
 @BUILD_LIBGCOBOL_TRUE@AM_CFLAGS = $(XCFLAGS)
 @BUILD_LIBGCOBOL_TRUE@AM_CXXFLAGS = $(XCFLAGS) $(WARN_CFLAGS) \
 @BUILD_LIBGCOBOL_TRUE@ -DIN_TARGET_LIBS -fno-strict-aliasing
@@ -410,11 +415,10 @@ gcc_version := $(shell @get_gcc_base_ver@ 
$(top_srcdir)/../gcc/BASE-VER)
 # We want to link with the c++ runtime.
 @BUILD_LIBGCOBOL_TRUE@libgcobol_la_LINK = $(CXXLINK) $(libgcobol_la_LDFLAGS)
 @BUILD_LIBGCOBOL_TRUE@version_arg = -version-info $(LIBGCOBOL_VERSION)
-@BUILD_LIBGCOBOL_TRUE@libgcobol_la_LDFLAGS = $(LTLDFLAGS) $(LTLIBICONV) \
-@BUILD_LIBGCOBOL_TRUE@ $(extra_ldflags_libgcobol) $(LIBS) \
-@BUILD_LIBGCOBOL_TRUE@ $(version_arg)
+@BUILD_LIB

[gcc r15-9358] middle-end/119706 - allow POLY_INT_CST as is_gimple_mem_ref_addr

2025-04-10 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:bf812c6ad83ec0b241bb3fecc7e68f883b6083df

commit r15-9358-gbf812c6ad83ec0b241bb3fecc7e68f883b6083df
Author: Richard Biener 
Date:   Thu Apr 10 13:30:42 2025 +0200

middle-end/119706 - allow POLY_INT_CST as is_gimple_mem_ref_addr

We currently only INTEGER_CST, but not POLY_INT_CST, which leads
to the situation that when the POLY_INT_CST is only indrectly
present via a SSA def the IL is valid but when propagated it's not.
That's unsustainable.

PR middle-end/119706
* gimple-expr.cc (is_gimple_mem_ref_addr): Also allow
POLY_INT_CST.

Diff:
---
 gcc/gimple-expr.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc
index a670e4648d3f..c0367f490d69 100644
--- a/gcc/gimple-expr.cc
+++ b/gcc/gimple-expr.cc
@@ -884,7 +884,7 @@ bool
 is_gimple_mem_ref_addr (tree t)
 {
   return (is_gimple_reg (t)
- || TREE_CODE (t) == INTEGER_CST
+ || poly_int_tree_p (t)
  || (TREE_CODE (t) == ADDR_EXPR
  && (CONSTANT_CLASS_P (TREE_OPERAND (t, 0))
  || decl_address_invariant_p (TREE_OPERAND (t, 0);


[gcc(refs/vendors/redhat/heads/gcc-15-branch)] Merge commit 'r15-9352-g6284f555e877c75ddecc776286ec4b8c20007de2' into redhat/gcc-15-branch

2025-04-10 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:5f1acb12c814822a776336abcae1988c1e42858e

commit 5f1acb12c814822a776336abcae1988c1e42858e
Merge: 3d14ac28b1c0 6284f555e877
Author: Jakub Jelinek 
Date:   Thu Apr 10 09:05:49 2025 +0200

Merge commit 'r15-9352-g6284f555e877c75ddecc776286ec4b8c20007de2' into 
redhat/gcc-15-branch

Diff:

 ChangeLog  |10 +
 MAINTAINERS| 2 +-
 configure  |   100 +-
 configure.ac   |16 +-
 gcc/ChangeLog  |   803 +
 gcc/DATESTAMP  | 2 +-
 gcc/ada/ChangeLog  |21 +
 gcc/ada/gcc-interface/utils.cc |17 +-
 gcc/ada/gcc-interface/utils2.cc|11 +-
 gcc/ada/libgnat/a-ngcoar.adb   |42 +-
 gcc/ada/libgnat/a-ngrear.adb   |85 +-
 gcc/bitmap.cc  | 4 +-
 gcc/c-family/ChangeLog |18 +
 gcc/c-family/c.opt | 3 +-
 gcc/c-family/c.opt.urls| 9 +-
 gcc/c/ChangeLog|25 +
 gcc/c/c-decl.cc| 5 +-
 gcc/c/c-parser.cc  |44 +-
 gcc/c/c-tree.h | 1 +
 gcc/c/c-typeck.cc  |46 +-
 gcc/cfgrtl.cc  |10 +
 gcc/cobol/ChangeLog|   109 +
 gcc/cobol/Make-lang.in |20 +-
 gcc/cobol/cobol1.cc| 4 +-
 gcc/cobol/gcobolspec.cc|   131 +-
 gcc/cobol/genapi.cc|   260 +-
 gcc/cobol/gengen.cc|15 +-
 gcc/cobol/parse.y  |79 +-
 gcc/cobol/parse_ante.h | 3 +-
 gcc/cobol/symbols.cc   |11 +-
 gcc/cobol/symbols.h| 6 +
 gcc/cobol/symfind.cc   | 9 +-
 gcc/combine.cc |76 +-
 gcc/common.opt |15 +-
 gcc/common.opt.urls| 6 +
 gcc/common/config/i386/i386-common.cc  | 2 +
 gcc/config.in  | 6 +
 gcc/config/aarch64/aarch64-cores.def   |16 +
 gcc/config/aarch64/aarch64-option-extensions.def   | 2 +-
 gcc/config/aarch64/aarch64-sve-builtins.cc |37 +-
 gcc/config/aarch64/aarch64-tune.md | 2 +-
 gcc/config/aarch64/aarch64.cc  |11 +-
 gcc/config/alpha/alpha-modes.def   | 4 +
 gcc/config/alpha/alpha-protos.h| 5 +
 gcc/config/alpha/alpha.cc  |   703 +-
 gcc/config/alpha/alpha.md  |   167 +-
 gcc/config/alpha/alpha.opt | 8 +
 gcc/config/alpha/alpha.opt.urls| 6 +
 gcc/config/gcn/gcn-hsa.h   | 4 +
 gcc/config/gcn/gcn-protos.h| 2 +
 gcc/config/gcn/gcn.cc  |14 +
 gcc/config/h8300/jumpcall.md   | 8 +-
 gcc/config/i386/i386-options.cc| 7 +
 gcc/config/i386/i386.cc| 6 +-
 gcc/config/i386/i386.h |10 +-
 gcc/config/i386/i386.md|22 +-
 gcc/config/i386/sse.md |26 +-
 gcc/config/i386/x86-tune-costs.h   |57 +-
 gcc/config/i386/zn4zn5.md  |63 +-
 gcc/config/loongarch/genopts/gen-evolution.awk |20 +-
 gcc/config/loongarch/genopts/genstr.sh |57 +-
 gcc/config/mingw/winnt.cc  | 1 +
 gcc/config/nvptx/nvptx.cc  |10 +-
 gcc/config/nvptx/nvptx.opt |10 +-
 gcc/config/riscv/autovec.md|10 +-
 gcc/config/riscv/bitmanip.md   | 4 +-
 gcc/config/riscv/freebsd.h | 2 +-
 gcc/config/riscv/riscv-v.cc| 8 +-
 gcc/config/riscv/riscv-vector-builtins-types.def   |   322 +-
 gcc/config/riscv/riscv-vector-builtins.cc  |34 +-
 gcc/config/riscv/riscv-vector-switch.def   |84 +-
 gcc/config/riscv/vector-iterators.md   |   256 +-
 gcc/config/riscv/vector.md | 6 +-
 gcc/config/rs6000/rs6000-logue.cc  | 2 +
 gcc/configure 

[gcc/redhat/heads/gcc-15-branch] (329 commits) Merge commit 'r15-9352-g6284f555e877c75ddecc776286ec4b8c200

2025-04-10 Thread Jakub Jelinek via Gcc-cvs
The branch 'redhat/heads/gcc-15-branch' was updated to point to:

 5f1acb12c814... Merge commit 'r15-9352-g6284f555e877c75ddecc776286ec4b8c200

It previously pointed to:

 3d14ac28b1c0... Merge commit 'r15-9024-g3258c89fbb092412a69b689425e77972e7a

Diff:

Summary of changes (added commits):
---

  5f1acb1... Merge commit 'r15-9352-g6284f555e877c75ddecc776286ec4b8c200
  6284f55... Daily bump. (*)
  d69f73c... libstdc++: Fix constraint recursion in basic_const_iterator (*)
  f3862ab... c++: ICE with nested default targ lambdas [PR119574] (*)
  6704d95... cobol: Proper comparison of alphanumeric to refmoded numeri (*)
  f7738c3... pretty-print: Fix format specifier description (*)
  76b267b... modula2: FIx a comment typo (*)
  e081ced... libquadmath: Fix up THREEp96 constant in expq (*)
  4203060... h8300: Fix up bit test and jump splitter [PR119664] (*)
  101ac9e... Update gcc de.po (*)
  76d902a... aarch64: Add sve testcase for PR 116595 [PR116595] (*)
  cee353c... d: Fix forward referenced enums missing type names in debug (*)
  8df0de9... Update gcc.po files (*)
  3345451... Fortran: fix issue with impure elemental subroutine and int (*)
  4645d09... [RISC-V] Fix more fallout from combine.c changes (*)
  3aca82b... testsuite/x86: Correctly escape asterisk in scan-assembler (*)
  9ea6bda... deref-before-check-pr113253.c: Fix bogus warnings on lp32 (*)
  0f74d1e... [committed][RISC-V] Adjust expected output for rvv test (*)
  39deb26... riscv: Fix r15-9270 fallout on RISC-V (*)
  07d... rtl-optimization/119689 - compare-debug failure with LRA (*)
  3e3b665... d: Use CONSTRUCTOR_ZERO_PADDING_BITS in the D FE [PR117832] (*)
  24d1832... Revert "RISC-V: Refine the testcases for cond_widen_complic (*)
  6e77a83... libcpp: Fix error recovery after use of __VA_ARGS__ as macr (*)
  ac1044d... testsuite: Add -mabi to pr116595.C (*)
  f183ae0... expr: Use constant_lower_bound classifying constructor els  (*)
  ee65440... Fortran:  Fix some problems with the reduce intrinsic [PR11 (*)
  faff254... bootstrap/119680 - fix cross-compiler build with --enable-h (*)
  2d7e1d6... Fortran: Add code gen for do,concurrent's LOCAL/LOCAL_INIT  (*)
  94438ca... c++: lambda in concept [PR118698] (*)
  6ed8c17... LoongArch: Fix awk / sed usage for compatibility (*)
  ca4e6e6... Daily bump. (*)
  ed14cb2... testsuite: Update guality XFAILs for aarch64 (*)
  c3e1c23... testsuite: Fix gcc.dg/vect/pr99102.c command line (*)
  5c06ad9... Doc: Copy-edit text about -Wno-xxx [PR90468] (*)
  7767158... libphobos: Merge with upstream phobos 35977c802 (*)
  6393761... d: Fix infinite loop in isAliasThisTuple (*)
  1b5b02b... cobol: Further fixes for cobol cross-compilation from 32-bi (*)
  04918a2... simplify-rtx: Fix up POPCOUNT optimization [PR119672] (*)
  a3382d9... c: fix checking for a tag for variably modified tagged type (*)
  0f77d88... OpenMP: Fix append_args handling in modify_call_for_omp_dis (*)
  d034c78... c++: self-dependent alias template [PR117530] (*)
  f53c5cd... riscv: Fix a typo in config/riscv/freebsd.h [PR119678] (*)
  54ab0f6... GCN, nvptx: Define '_Unwind_RaiseException', '_Unwind_Resum (*)
  815abd6... GCN, nvptx: Define '_Unwind_DeleteException' (*)
  175016d... nvptx: In offloading compilation, special-case certain host (*)
  649b3cf... libgomp: Add -Wno-c-binding-type for omp_lib.f90 compilatio (*)
  1a8e821... cse: Fix up delete_trivially_dead_insns [PR119594] (*)
  15baa00... lto: Add & ~CF_SET into lto-opts.cc [PR119625] (*)
  29ed336... gccrs: nr2.0: Adjust test macro6.rs (*)
  df45e75... gccrs: nr2.0: Adjust test issue-2812.rs (*)
  a75a697... gccrs: fix ICE segfault with empty feature gate (*)
  8885e9e... gccrs: Rename label getter to unchecked (*)
  c4ec1bc... gccrs: Rename label getter in ContinueExpr (*)
  3790827... gccrs: Change optional to expected for parse_loop_label (*)
  7ae9586... gccrs: Adapt testcase to name resolution 2.0 (*)
  fb890cd... gccrs: Resolve labels within break or continue expressions (*)
  8c51fd8... gccrs: Fix unresolved label error message (*)
  827ceac... gccrs: Migrate error state to optionals (*)
  3cf4d5c... gccrs: Update ast visitor with proper check for looplabel (*)
  a314885... gccrs: Remove unused error constructor and getter (*)
  ff04ba2... gccrs: Make loop label truly optional (*)
  d7bbb92... gccrs: Visit loop label before predicate expression (*)
  d85a88a... gccrs: Add check for label (*)
  5d34589... gccrs: Resolve labels (*)
  d307ddd... gccrs: Revert part of 44ffe1193269 (*)
  72a0fb9... gccrs: refactoring rust_error_at "redefined multiple times" (*)
  89ca1e3... gccrs: nr2.0: Improve test script (*)
  2f955be... gccrs: nr2.0: Remove duplicate self visit (*)
  381da0e... gccrs: Fix ICE for reserved lifetime name (*)
  6410c1d... gccrs: hir: Add default qualifier to function, lower it pro (*)
  c5f1d57... gccrs: feature: Add min_specialization feature (*)
  568289b... gccrs: Fix ICE when hitting invalid types for generics (*)

[gcc] Created branch 'meissner/heads/work200-orig' in namespace 'refs/users'

2025-04-10 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work200-orig' was created in namespace 'refs/users' 
pointing to:

 fdbe017bc15f... cobol: sed portability fix


[gcc r14-11588] libstdc++: Define __is_pair variable template for C++11

2025-04-10 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:c4bf3291f20b8746a15ab3025c891f13f7e54298

commit r14-11588-gc4bf3291f20b8746a15ab3025c891f13f7e54298
Author: Jonathan Wakely 
Date:   Fri Nov 1 10:09:55 2024 +

libstdc++: Define __is_pair variable template for C++11

libstdc++-v3/ChangeLog:

* include/bits/stl_pair.h (__is_pair): Define for C++11 and
C++14 as well.

(cherry picked from commit dd08cdccc36d084eda0e2748c772f6bf9a7f412f)

Diff:
---
 libstdc++-v3/include/bits/stl_pair.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libstdc++-v3/include/bits/stl_pair.h 
b/libstdc++-v3/include/bits/stl_pair.h
index 45317417c9c2..3d33f68d59b0 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -1180,12 +1180,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template
 inline constexpr size_t tuple_size_v> = 2;
+#endif
 
+#if __cplusplus >= 201103L
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++14-extensions" // variable templates
+#pragma GCC diagnostic ignored "-Wc++17-extensions" // inline variables
   template
 inline constexpr bool __is_pair = false;
 
   template
 inline constexpr bool __is_pair> = true;
+#pragma GCC diagnostic pop
 #endif
 
   /// @cond undocumented


[gcc r15-9282] gccrs: Fix ICE when hitting invalid types for generics

2025-04-10 Thread Arthur Cohen via Gcc-cvs
https://gcc.gnu.org/g:568289b9f83cb1ff43b12adc4494d8cb8997b8d3

commit r15-9282-g568289b9f83cb1ff43b12adc4494d8cb8997b8d3
Author: Philip Herron 
Date:   Wed Apr 2 21:02:44 2025 +0100

gccrs: Fix ICE when hitting invalid types for generics

We need to check upfront if the type is valid or not. Then
error with a decent message.

Fixes Rust-GCC#3643
Fixes Rust-GCC#3646
Fixes Rust-GCC#3654
Fixes Rust-GCC#3663
Fixes Rust-GCC#3671

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): 
fix error msg
* typecheck/rust-substitution-mapper.cc (SubstMapper::Resolve): add 
validation
(SubstMapper::valid_type): new check
(SubstMapper::visit): check if can resolve
* typecheck/rust-substitution-mapper.h: new prototype

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 is missing type path error
* rust/compile/issue-3643.rs: New test.
* rust/compile/issue-3646.rs: New test.
* rust/compile/issue-3654.rs: New test.
* rust/compile/issue-3663.rs: New test.
* rust/compile/issue-3671.rs: New test.

Signed-off-by: Philip Herron 

Diff:
---
 gcc/rust/resolve/rust-ast-resolve-type.cc  |  2 +-
 gcc/rust/typecheck/rust-substitution-mapper.cc | 27 +-
 gcc/rust/typecheck/rust-substitution-mapper.h  |  2 ++
 gcc/testsuite/rust/compile/issue-3643.rs   |  4 
 gcc/testsuite/rust/compile/issue-3646.rs   |  7 +++
 gcc/testsuite/rust/compile/issue-3654.rs   |  3 +++
 gcc/testsuite/rust/compile/issue-3663.rs   |  6 ++
 gcc/testsuite/rust/compile/issue-3671.rs   |  2 ++
 gcc/testsuite/rust/compile/nr2/exclude |  2 ++
 9 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc 
b/gcc/rust/resolve/rust-ast-resolve-type.cc
index 5ab0c445ae70..606141cc8760 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -357,7 +357,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId 
&resolved_node_id)
{
  rust_error_at (segment->get_locus (), ErrorCode::E0412,
 "could not resolve type path %qs",
-segment->as_string ().c_str ());
+segment->get_ident_segment ().as_string ().c_str ());
  return false;
}
 }
diff --git a/gcc/rust/typecheck/rust-substitution-mapper.cc 
b/gcc/rust/typecheck/rust-substitution-mapper.cc
index 212ab3f3be54..f0bd1f8bb17f 100644
--- a/gcc/rust/typecheck/rust-substitution-mapper.cc
+++ b/gcc/rust/typecheck/rust-substitution-mapper.cc
@@ -34,6 +34,15 @@ SubstMapper::Resolve (TyTy::BaseType *base, location_t locus,
  HIR::GenericArgs *generics,
  const std::vector ®ions)
 {
+  if (!valid_type (base))
+{
+  rich_location r (line_table, locus);
+  r.add_fixit_remove (generics->get_locus ());
+  rust_error_at (r, ErrorCode::E0109,
+"generic arguments are not allowed for this type");
+  return base;
+}
+
   SubstMapper mapper (base->get_ref (), generics, regions, locus);
   base->accept_vis (mapper);
   rust_assert (mapper.resolved != nullptr);
@@ -46,6 +55,17 @@ SubstMapper::InferSubst (TyTy::BaseType *base, location_t 
locus)
   return SubstMapper::Resolve (base, locus, nullptr, {});
 }
 
+bool
+SubstMapper::valid_type (TyTy::BaseType *base)
+{
+  bool is_fn = base->is ();
+  bool is_adt = base->is ();
+  bool is_placeholder = base->is ();
+  bool is_projection = base->is ();
+
+  return is_fn || is_adt || is_placeholder || is_projection;
+}
+
 bool
 SubstMapper::have_generic_args () const
 {
@@ -103,7 +123,12 @@ SubstMapper::visit (TyTy::ADTType &type)
 void
 SubstMapper::visit (TyTy::PlaceholderType &type)
 {
-  rust_assert (type.can_resolve ());
+  if (!type.can_resolve ())
+{
+  resolved = &type;
+  return;
+}
+
   resolved = SubstMapper::Resolve (type.resolve (), locus, generics, regions);
 }
 
diff --git a/gcc/rust/typecheck/rust-substitution-mapper.h 
b/gcc/rust/typecheck/rust-substitution-mapper.h
index bc54f5614cfa..32ab71c6dfbf 100644
--- a/gcc/rust/typecheck/rust-substitution-mapper.h
+++ b/gcc/rust/typecheck/rust-substitution-mapper.h
@@ -37,6 +37,8 @@ public:
 
   bool have_generic_args () const;
 
+  static bool valid_type (TyTy::BaseType *base);
+
   void visit (TyTy::FnType &type) override;
   void visit (TyTy::ADTType &type) override;
   void visit (TyTy::PlaceholderType &type) override;
diff --git a/gcc/testsuite/rust/compile/issue-3643.rs 
b/gcc/testsuite/rust/compile/issue-3643.rs
new file mode 100644
index ..bed9ffc0c2b9
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3643.rs
@@ -0,0 +1,4 @@
+fn foo() {
+let x: usize;
+// { dg-error "generic arguments are not allowed for this t

[gcc/devel/rust/master] Revert part of 44ffe1193269

2025-04-10 Thread Thomas Schwinge via Gcc-cvs
https://gcc.gnu.org/g:227a2b77d330a0e9fc32ba5d34a81598cb68c3ef

commit 227a2b77d330a0e9fc32ba5d34a81598cb68c3ef
Author: Pierre-Emmanuel Patry 
Date:   Thu Apr 3 17:27:46 2025 +0200

Revert part of 44ffe1193269

This commit got rid of msvc specific code and remove the else clause,
this triggered warning with tl::expected::value function.

gcc/rust/ChangeLog:

* util/expected.h: Use gcc_unreachable within gcc context.

Signed-off-by: Pierre-Emmanuel Patry 

Diff:
---
 gcc/rust/util/expected.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/rust/util/expected.h b/gcc/rust/util/expected.h
index a7ddd55a88d9..6f5ef1c8754b 100644
--- a/gcc/rust/util/expected.h
+++ b/gcc/rust/util/expected.h
@@ -212,10 +212,8 @@ template 
   throw std::forward(e);
 #else
   (void)e;
-#ifdef _MSC_VER
   gcc_unreachable();
 #endif
-#endif
 }
 
 #ifndef TL_TRAITS_MUTEX
@@ -2437,4 +2435,4 @@ void swap(expected &lhs,
 }
 } // namespace tl
 
-#endif
\ No newline at end of file
+#endif


[gcc r15-9356] testsuite, cobol: Add libquadmath paths.

2025-04-10 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:f1e82c859fc205395e4f413cdc0b95f54a48ce92

commit r15-9356-gf1e82c859fc205395e4f413cdc0b95f54a48ce92
Author: Iain Sandoe 
Date:   Sun Mar 16 10:47:25 2025 +

testsuite, cobol: Add libquadmath paths.

Even when we are using IEC 128b floating point, the quadmath library can
be pulled in 'as needed'.

gcc/testsuite/ChangeLog:

* lib/cobol.exp: Add libquadmath paths.

Signed-off-by: Iain Sandoe 

Diff:
---
 gcc/testsuite/lib/cobol.exp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/gcc/testsuite/lib/cobol.exp b/gcc/testsuite/lib/cobol.exp
index 8ea91e3dcfac..723989e14394 100644
--- a/gcc/testsuite/lib/cobol.exp
+++ b/gcc/testsuite/lib/cobol.exp
@@ -122,6 +122,15 @@ proc cobol_link_flags { paths } {
}
append ld_library_path ":${gccpath}/libgcobol/.libs"
   }
+  if { [file exists "${gccpath}/libquadmath/.libs/libquadmath.a"] ||
+[file exists "${gccpath}/libquadmath/.libs/libquadmath.${shlib_ext}"] 
} {
+   if { $target_wants_B_option } {
+  append flags "-B${gccpath}/libquadmath/.libs "
+   } else {
+  append flags "-L${gccpath}/libquadmath/.libs "
+   }
+   append ld_library_path ":${gccpath}/libquadmath/.libs"
+  }
   if { [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] ||
   [file exists 
"${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] } {
if { $target_wants_B_option } {


[gcc r15-9307] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-10 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:1a8e821577dfb535aa54df311ccb282363a93355

commit r15-9307-g1a8e821577dfb535aa54df311ccb282363a93355
Author: Jakub Jelinek 
Date:   Tue Apr 8 11:55:13 2025 +0200

cse: Fix up delete_trivially_dead_insns [PR119594]

The following testcase is miscompiled by delete_trivially_dead_insns,
latently since r0-6313, actually since r15-1575.

The problem is in that r0-6313 change, which made count_reg_usage not
count uses of the pseudo which the containing SET sets.  That is needed
so we can delete those instructions as trivially dead if they are really
dead, but has the following problem.  After fwprop proper we have:
(insn 7 2 8 2 (set (reg/v:DI 101 [ g ])
(const_int -1 [0x])) "pr119594.c":8:10 95 
{*movdi_internal}
 (nil))
...
(insn 26 24 27 7 (set (reg:DI 104 [ g ])
(zero_extend:DI (subreg:SI (reg/v:DI 101 [ g ]) 0))) 
"pr119594.c":11:8 175 {*zero_extendsidi2}
 (expr_list:REG_EQUAL (const_int 4294967295 [0x])
(expr_list:REG_DEAD (reg/v:DI 101 [ g ])
(nil
(insn 27 26 28 7 (set (reg/v:DI 101 [ g ])
(zero_extend:DI (subreg:SI (reg/v:DI 101 [ g ]) 0))) 
"pr119594.c":11:8 175 {*zero_extendsidi2}
 (expr_list:REG_EQUAL (const_int 4294967295 [0x])
(expr_list:REG_UNUSED (reg/v:DI 101 [ g ])
(nil
and nothing else uses or sets the 101 and 104 pseudos.  The subpass doesn't
look at REG_UNUSED or REG_DEAD notes (correctly, as they aren't guaranteed
to be accurate).  The last change in the IL was forward propagation of
(reg:DI 104 [ g ]) value into the following insn.
Now, count_reg_usage doesn't count anything on insn 7, the SET_DEST is a
reg, so we don't count that and SET_SRC doesn't contain any regs.
On insn 26 it counts one usage of pseudo 101 (so counts[101] = 1) and
on insn 27 since r0-6313 doesn't count anything as that insn sets
pseudo 101 to something that uses it, it isn't a side-effect instruction
and can't throw.

Now, after counting reg usages the subpass walks the IL from end to start,
sees insn 27, counts[101] is non-zero, so insn_live_p is true, nothing is
deleted.  Then sees insn 26, counts[104] is zero, insn_live_p is false,
we delete the insn and decrease associated counts, in this case counts[101]
becomes zero.  And finally later we process insn 7, counts[101] is now zero,
insn_live_p is false, we delete the insn (and decrease associated counts,
which aren't any).
Except that this resulted in insn 27 staying in the IL but using a REG
which is no longer set (and worse, having a REG_EQUAL note of something we
need later in the same bb, so we then assume pseudo 101 contains 0x,
which it no longer does.

Now, if insn 26 was after insn 27, this would work just fine, we'd first
delete that and then insn 27 and then insn 7, which is why most of the time
it happens to work fine.

The following patch fixes it by detecting the cases where there are
self-references after a pseudo has been used at least once outside of the
self-references or just as REG_P SET_DEST and in that case only increases
the count for the pseudo, making it not trivially deletable.

2025-04-08  Eric Botcazou 
Jakub Jelinek  

PR rtl-optimization/119594
* cse.cc (count_reg_usage): Count even x == dest regs if they have
non-zero counts already and incr is positive.

* gcc.dg/pr119594.c: New test.

Diff:
---
 gcc/cse.cc  | 15 +--
 gcc/testsuite/gcc.dg/pr119594.c | 32 
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/gcc/cse.cc b/gcc/cse.cc
index 70d5caac4cac..7bdd3b07b1d1 100644
--- a/gcc/cse.cc
+++ b/gcc/cse.cc
@@ -6762,7 +6762,18 @@ cse_main (rtx_insn *f ATTRIBUTE_UNUSED, int nregs)
modify the liveness of DEST.
DEST is set to pc_rtx for a trapping insn, or for an insn with side effects.
We must then count uses of a SET_DEST regardless, because the insn can't be
-   deleted here.  */
+   deleted here.
+   Also count uses of a SET_DEST if it has been used by an earlier insn,
+   but in that case only when incrementing and not when decrementing, 
effectively
+   making setters of such a pseudo non-eliminable.  This is for cases like
+   (set (reg x) (expr))
+   ...
+   (set (reg y) (expr (reg (x
+   ...
+   (set (reg x) (expr (reg (x
+   where we can't eliminate the last insn because x is is still used, if y
+   is unused we can eliminate the middle insn and when considering the first 
insn
+   we used to eliminate it despite it being used in the last insn.  */
 
 static void
 count_reg_usage (rtx x, int *counts, rtx dest, int incr)
@@ -6778,7 +6789,7 @@ count_reg_usage (rtx x, int *counts, rtx dest, int incr)
   swit

[gcc r14-11590] c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687]

2025-04-10 Thread Patrick Palka via Gcc-cvs
https://gcc.gnu.org/g:93be6016dae6e2f0bfe849ee0469a0a8ae0b9d5e

commit r14-11590-g93be6016dae6e2f0bfe849ee0469a0a8ae0b9d5e
Author: Patrick Palka 
Date:   Thu Apr 10 15:49:12 2025 -0400

c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687]

With inherited CTAD the set of guides may be a two-dimensional overload
set (i.e. OVERLOADs of OVERLOADs) so alias_ctad_tweaks (which also does
the inherited CTAD transformation) needs to use the 2D-aware lkp_iterator
instead of ovl_iterator, or better yet use the more idiomatic lkp_range.

PR c++/119687

gcc/cp/ChangeLog:

* pt.cc (alias_ctad_tweaks): Use lkp_range / lkp_iterator
instead of ovl_iterator.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/class-deduction-inherited8.C: New test.

Reviewed-by: Jason Merill 
(cherry picked from commit 493974aa0ad8b94dbeb61f00d2acc57c94fd4809)

Diff:
---
 gcc/cp/pt.cc|  3 +--
 .../g++.dg/cpp23/class-deduction-inherited8.C   | 21 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 5b9a9c611f24..d41df4f230ce 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -30446,9 +30446,8 @@ alias_ctad_tweaks (tree tmpl, tree uguides)
   tree aguides = NULL_TREE;
   tree atparms = INNERMOST_TEMPLATE_PARMS (fullatparms);
   unsigned natparms = TREE_VEC_LENGTH (atparms);
-  for (ovl_iterator iter (uguides); iter; ++iter)
+  for (tree f : lkp_range (uguides))
 {
-  tree f = *iter;
   tree in_decl = f;
   location_t loc = DECL_SOURCE_LOCATION (f);
   tree ret = TREE_TYPE (TREE_TYPE (f));
diff --git a/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C 
b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C
new file mode 100644
index ..4494c701c350
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C
@@ -0,0 +1,21 @@
+// PR c++/119687
+// { dg-do compile { target c++17 } }
+
+template  class QFlagsStorage{};
+
+template  struct QFlagsStorageHelper : QFlagsStorage  {
+  using QFlagsStorage::QFlagsStorage;
+
+public:
+  QFlagsStorageHelper(Enum);
+};
+
+template  struct QFlags : public QFlagsStorageHelper {
+  using Base = QFlagsStorageHelper;
+  using Base::Base;
+  QFlags(Enum);
+};
+
+void f(int flag) {
+  QFlags{int{}};
+}


[gcc r15-9254] cobol: sed portability fix

2025-04-10 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:fdbe017bc15f8cf6f211a056c1822bc1a933ae85

commit r15-9254-gfdbe017bc15f8cf6f211a056c1822bc1a933ae85
Author: Jakub Jelinek 
Date:   Mon Apr 7 14:25:49 2025 +0200

cobol: sed portability fix

Apparently Darwin sed doesn't like 's/\(foo\|bar\|baz\)/qux/' syntax,
simplified by using a pattern which matches all libgcobol header names
except possible config.h.

2025-04-07  Jakub Jelinek  

* Make-lang.in (cobol/charmaps.cc, cobol/valconv.cc): Use a BRE
only sed regex.

Diff:
---
 gcc/cobol/Make-lang.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index d14190f07957..422ebe28b213 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -90,9 +90,7 @@ cobol1_OBJS =\
 # so that the .h files can be found.
 
 cobol/charmaps.cc cobol/valconv.cc: cobol/%.cc: $(LIB_SOURCE)/%.cc
-   -l='ec\|common-defs\|io\|gcobolio\|gfileio\|charmaps'; \
-   l=$$l'\|valconv\|exceptl'; \
-   sed -e '/^#include/s,"\('$$l'\)\.h","../../libgcobol/\1.h",' $^ > $@
+   sed -e '/^#include/s,"\([^"]*[^g"].h\)","../../libgcobol/\1",' $^ > $@
 
 LIB_SOURCE_H=$(wildcard $(LIB_SOURCE)/*.h)


[gcc r15-9290] gccrs: Resolve labels

2025-04-10 Thread Arthur Cohen via Gcc-cvs
https://gcc.gnu.org/g:5d34589597c2af26768e7e4a982622db5eb4b210

commit r15-9290-g5d34589597c2af26768e7e4a982622db5eb4b210
Author: Pierre-Emmanuel Patry 
Date:   Mon Mar 31 17:00:11 2025 +0200

gccrs: Resolve labels

gcc/rust/ChangeLog:

* hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Lower label only 
if
it exists.
* hir/tree/rust-hir-expr.cc (BlockExpr::BlockExpr): Make loop label
optional.
(BaseLoopExpr::BaseLoopExpr): Likewise.
(LoopExpr::LoopExpr): Likewise.
(WhileLoopExpr::WhileLoopExpr): Likewise.
* hir/tree/rust-hir-expr.h: Use optional for lifetime and labels.
* hir/tree/rust-hir.cc (WhileLoopExpr::as_string): Use getter.
(WhileLetLoopExpr::as_string): Likewise.
(LoopExpr::as_string): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Resolve 
labels.
* resolve/rust-late-name-resolver-2.0.h: Add visit function 
prototype
for loop labels.

Signed-off-by: Pierre-Emmanuel Patry 

Diff:
---
 gcc/rust/hir/rust-ast-lower.cc  |  6 +-
 gcc/rust/hir/tree/rust-hir-expr.cc  | 14 +-
 gcc/rust/hir/tree/rust-hir-expr.h   | 25 ++---
 gcc/rust/hir/tree/rust-hir.cc   |  6 +++---
 gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 19 +++
 gcc/rust/resolve/rust-late-name-resolver-2.0.h  |  1 +
 6 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/gcc/rust/hir/rust-ast-lower.cc b/gcc/rust/hir/rust-ast-lower.cc
index ebdf9810b34f..c14fccde0816 100644
--- a/gcc/rust/hir/rust-ast-lower.cc
+++ b/gcc/rust/hir/rust-ast-lower.cc
@@ -97,7 +97,11 @@ ASTLowering::go ()
 void
 ASTLoweringBlock::visit (AST::BlockExpr &expr)
 {
-  auto label = lower_loop_label (expr.get_label ());
+  tl::optional label;
+  if (expr.has_label ())
+label = lower_loop_label (expr.get_label ());
+  else
+label = tl::nullopt;
 
   std::vector> block_stmts;
   bool block_did_terminate = false;
diff --git a/gcc/rust/hir/tree/rust-hir-expr.cc 
b/gcc/rust/hir/tree/rust-hir-expr.cc
index bb7ebfbc617b..82a09e935887 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.cc
+++ b/gcc/rust/hir/tree/rust-hir-expr.cc
@@ -749,7 +749,7 @@ BlockExpr::BlockExpr (Analysis::NodeMapping mappings,
  std::vector> block_statements,
  std::unique_ptr block_expr, bool tail_reachable,
  AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
- LoopLabel label, location_t start_locus,
+ tl::optional label, location_t start_locus,
  location_t end_locus)
   : ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
 WithInnerAttrs (std::move (inner_attribs)),
@@ -985,7 +985,8 @@ UnsafeBlockExpr::operator= (UnsafeBlockExpr const &other)
 
 BaseLoopExpr::BaseLoopExpr (Analysis::NodeMapping mappings,
std::unique_ptr loop_block,
-   location_t locus, LoopLabel loop_label,
+   location_t locus,
+   tl::optional loop_label,
AST::AttrVec outer_attribs)
   : ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
 loop_label (std::move (loop_label)), loop_block (std::move (loop_block)),
@@ -1011,7 +1012,8 @@ BaseLoopExpr::operator= (BaseLoopExpr const &other)
 
 LoopExpr::LoopExpr (Analysis::NodeMapping mappings,
std::unique_ptr loop_block, location_t locus,
-   LoopLabel loop_label, AST::AttrVec outer_attribs)
+   tl::optional loop_label,
+   AST::AttrVec outer_attribs)
   : BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
  std::move (loop_label), std::move (outer_attribs))
 {}
@@ -1019,7 +1021,8 @@ LoopExpr::LoopExpr (Analysis::NodeMapping mappings,
 WhileLoopExpr::WhileLoopExpr (Analysis::NodeMapping mappings,
  std::unique_ptr loop_condition,
  std::unique_ptr loop_block,
- location_t locus, LoopLabel loop_label,
+ location_t locus,
+ tl::optional loop_label,
  AST::AttrVec outer_attribs)
   : BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
  std::move (loop_label), std::move (outer_attribs)),
@@ -1046,7 +1049,8 @@ WhileLetLoopExpr::WhileLetLoopExpr (
   Analysis::NodeMapping mappings,
   std::vector> match_arm_patterns,
   std::unique_ptr condition, std::unique_ptr loop_block,
-  location_t locus, LoopLabel loop_label, AST::AttrVec outer_attribs)
+  location_t locus, tl::optional loop_label,
+  AST::AttrVec outer_attribs)
   : BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,

[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] add -mfloat128 to pr67808.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:ae68f0fb43f18ad971702ae42448762547c5cd43

commit ae68f0fb43f18ad971702ae42448762547c5cd43
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:21:35 2025 -0300

[testsuite] [ppc] add -mfloat128 to pr67808.c

gcc.target/powerpc/pr67808.c in some cases expects both 128-bit long
double types to be defined, but -mlong-double-128 doesn't guarantee
that without -mfloat128 on targets that would get the IEEE128 type as
long double.  Add -mfloat128 to ensure the desired IBM 128-bit
floating-point type is available as expected.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/pr67808.c: Add -mfloat128, and tolerate
its warning.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr67808.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr67808.c 
b/gcc/testsuite/gcc.target/powerpc/pr67808.c
index 4ddadb719461..a86574141d0c 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr67808.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr67808.c
@@ -1,7 +1,8 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
-/* { dg-options "-O1 -mvsx -mdejagnu-cpu=power7 -mlong-double-128" } */
+/* { dg-options "-O1 -mvsx -mdejagnu-cpu=power7 -mfloat128 -mlong-double-128" 
} */
 /* { dg-require-effective-target powerpc_vsx } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
 /* PR 67808: LRA ICEs on simple double to long double conversion test case */
 
@@ -9,7 +10,7 @@
 /* If long double is IEEE 128-bit, we need to use the __ibm128 type instead of
long double.  We can't use __ibm128 on systems that don't support IEEE
128-bit floating point, because the type is not enabled on those
-   systems.  */
+   systems.  Without -mfloat128, the __ibm128 type may be undefined.  */
 #define LDOUBLE __ibm128
 
 #elif defined(__LONG_DOUBLE_IBM128__)


[gcc r15-9274] gccrs: Evaluate the enum's discriminant in a const context

2025-04-10 Thread Arthur Cohen via Gcc-cvs
https://gcc.gnu.org/g:db5a399d13b7fdafb7eaa7d299db777615ff0be2

commit r15-9274-gdb5a399d13b7fdafb7eaa7d299db777615ff0be2
Author: Ryutaro Okada <1015ry...@gmail.com>
Date:   Sun Mar 30 09:28:41 2025 -0700

gccrs: Evaluate the enum's discriminant in a const context

gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc: Evaluate the enum's 
discriminant in a const context

gcc/testsuite/ChangeLog:

* rust/compile/enum_discriminant1.rs: New test.

Signed-off-by: Ryutaro Okada <1015ry...@gmail.com>

Diff:
---
 gcc/rust/backend/rust-compile-resolve-path.cc| 2 ++
 gcc/testsuite/rust/compile/enum_discriminant1.rs | 7 +++
 2 files changed, 9 insertions(+)

diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc 
b/gcc/rust/backend/rust-compile-resolve-path.cc
index 115dd0464657..3cb1eb6faa50 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -105,7 +105,9 @@ ResolvePathRef::attempt_constructor_expression_lookup (
 
   // make the ctor for the union
   HIR::Expr &discrim_expr = variant->get_discriminant ();
+  ctx->push_const_context ();
   tree discrim_expr_node = CompileExpr::Compile (discrim_expr, ctx);
+  ctx->pop_const_context ();
   tree folded_discrim_expr = fold_expr (discrim_expr_node);
   tree qualifier = folded_discrim_expr;
 
diff --git a/gcc/testsuite/rust/compile/enum_discriminant1.rs 
b/gcc/testsuite/rust/compile/enum_discriminant1.rs
new file mode 100644
index ..32092b2c2a5b
--- /dev/null
+++ b/gcc/testsuite/rust/compile/enum_discriminant1.rs
@@ -0,0 +1,7 @@
+enum Foo {
+Bar = 3 + 12,
+}
+
+fn test() -> Foo { // { dg-warning "function is never used" }
+return Foo::Bar;
+}
\ No newline at end of file


[gcc r15-9373] bf-ms-attrib.c: Fix expected struct size

2025-04-10 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:7e6255edeb5a01d6ae1c2fa5bed391a836726229

commit r15-9373-g7e6255edeb5a01d6ae1c2fa5bed391a836726229
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Wed Apr 9 14:29:39 2025 +

bf-ms-attrib.c: Fix expected struct size

Both gcc and msvc agree that the struct size should
be 12, gcc is already correct.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

PR target/113633
* gcc.dg/bf-ms-attrib.c: Fix expected __ms_struct__ layout
size.

Diff:
---
 gcc/testsuite/gcc.dg/bf-ms-attrib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/bf-ms-attrib.c 
b/gcc/testsuite/gcc.dg/bf-ms-attrib.c
index 2da4f0320d6a..5208c7f882fb 100644
--- a/gcc/testsuite/gcc.dg/bf-ms-attrib.c
+++ b/gcc/testsuite/gcc.dg/bf-ms-attrib.c
@@ -32,7 +32,7 @@ main()
 /* As long as the sizes are as expected, we know attributes are working.
bf-ms-layout.c makes sure the right thing happens when the attribute
is on. */
-if (sizeof(struct one_ms) != 8)
+if (sizeof(struct one_ms) != 12)
abort();
 if (sizeof(struct one_gcc) != 8)
abort();


[gcc r15-9372] realloc-1.c: accept long long in warning for llp64

2025-04-10 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:f4cdbd619d89147cf5767ddbb10fbeee8f1b0cbc

commit r15-9372-gf4cdbd619d89147cf5767ddbb10fbeee8f1b0cbc
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Wed Apr 9 14:21:22 2025 +

realloc-1.c: accept long long in warning for llp64

llp64 targets like mingw-w64 will print:
warning: ignoring return value of ‘void* __builtin_realloc(void*, long long 
unsigned int)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
Change the regex pattern to accept it.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

* c-c++-common/analyzer/realloc-1.c: Make diagnostic accept
long long for __builtin_realloc warning.

Diff:
---
 gcc/testsuite/c-c++-common/analyzer/realloc-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c 
b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
index 04925cfe5adc..0bb846c62497 100644
--- a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
@@ -92,5 +92,5 @@ void test_9 (void *p)
 void test_10 (char *s, int n)
 {
   __builtin_realloc(s, n); /* { dg-warning "ignoring return value of 
'__builtin_realloc' declared with attribute 'warn_unused_result'" "" { target c 
} } */
-  /* { dg-warning "ignoring return value of 'void\\* 
__builtin_realloc\\(void\\*, (long )?unsigned int\\)' declared with attribute 
'warn_unused_result'" "" { target c++ } .-1 } */
+  /* { dg-warning "ignoring return value of 'void\\* 
__builtin_realloc\\(void\\*, (long )*unsigned int\\)' declared with attribute 
'warn_unused_result'" "" { target c++ } .-1 } */
 } /* { dg-warning "leak" } */


[gcc r15-9371] Doc: Discourage the use of -ffloat-store [PR14708]

2025-04-10 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:0c210fbbd70af16326ca64bf3447eb38b6fd6e0d

commit r15-9371-g0c210fbbd70af16326ca64bf3447eb38b6fd6e0d
Author: Sandra Loosemore 
Date:   Fri Apr 11 00:06:17 2025 +

Doc: Discourage the use of -ffloat-store [PR14708]

gcc/ChangeLog
PR middle-end/14708
* doc/invoke.texi (Optimize Options): List -fexcess-precision
before -ffloat-store, moving some background discussion to the
former from the latter.  Recommend using -fexcess-precision=standard
instead of -ffloat-store.

Diff:
---
 gcc/doc/invoke.texi | 42 +++---
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a040d65af0e2..05f6ca66fcef 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -15318,32 +15318,24 @@ arithmetic.  These options trade off between speed and
 correctness.  All must be specifically enabled.
 
 @table @gcctabopt
-@opindex ffloat-store
-@item -ffloat-store
-Do not store floating-point variables in registers, and inhibit other
-options that might change whether a floating-point value is taken from a
-register or memory.
-
-@cindex floating-point precision
-This option prevents undesirable excess precision on machines such as
-the 68000 where the floating registers (of the 68881) keep more
-precision than a @code{double} is supposed to have.  Similarly for the
-x86 architecture.  For most programs, the excess precision does only
-good, but a few programs rely on the precise definition of IEEE floating
-point.  Use @option{-ffloat-store} for such programs, after modifying
-them to store all pertinent intermediate computations into variables.
-
 @opindex fexcess-precision
 @item -fexcess-precision=@var{style}
-This option allows further control over excess precision on machines
+This option allows control over excess precision on machines
 where floating-point operations occur in a format with more precision or
-range than the IEEE standard and interchange floating-point types.  By
-default, @option{-fexcess-precision=fast} is in effect; this means that
+range than the IEEE standard and interchange floating-point types.
+An example of such a target is x87 floating point on x86 processors,
+which uses an 80-bit representation internally instead of the 64-bit
+IEEE format.  For most programs, the excess precision is harmless,
+but some programs may rely on the
+requirements of the C or C++ language standards for handling IEEE values.
+
+By default, @option{-fexcess-precision=fast} is in effect; this means that
 operations may be carried out in a wider precision than the types specified
 in the source if that would result in faster code, and it is unpredictable
 when rounding to the types specified in the source code takes place.
 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
-then excess precision follows the rules specified in ISO C99 or C++; in 
particular,
+then excess precision follows the rules specified in ISO C99 or C++;
+in particular,
 both casts and assignments cause values to be rounded to their
 semantic types (whereas @option{-ffloat-store} only affects
 assignments).  This option is enabled by default for C or C++ if a strict
@@ -15361,6 +15353,18 @@ or @option{-mfpmath=sse+387} is specified; in the 
former case, IEEE
 semantics apply without excess precision, and in the latter, rounding
 is unpredictable.
 
+@opindex ffloat-store
+@item -ffloat-store
+Do not store floating-point variables in registers, and inhibit other
+options that might change whether a floating-point value is taken from a
+register or memory.  This option has generally been subsumed by
+@option{-fexcess-precision=standard}, which is more general.  If you do use
+@option{-ffloat-store}, you may need to modify your program to explicitly
+store intermediate computations in temporary variables since
+@option{-ffloat-store} handles rounding to IEEE format
+only on assignments and not casts as @option{-fexcess-precision=standard}
+does.
+
 @opindex ffast-math
 @item -ffast-math
 Sets the options @option{-fno-math-errno}, 
@option{-funsafe-math-optimizations},


[gcc/aoliva/heads/testme] [testsuite] [ppc] use dg-do-if in vec-mul.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 f80291260019... [testsuite] [ppc] use dg-do-if in vec-mul.c

It previously pointed to:

 a5556692adac... [testsuite] [ppc] use dg-do-if in vec-mul.c

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  a555669... [testsuite] [ppc] use dg-do-if in vec-mul.c


Summary of changes (added commits):
---

  f802912... [testsuite] [ppc] use dg-do-if in vec-mul.c


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] use dg-do-if in vec-mul.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:f80291260019ae07cc5fac01cafacc65e7a97049

commit f80291260019ae07cc5fac01cafacc65e7a97049
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:34:31 2025 -0300

[testsuite] [ppc] use dg-do-if in vec-mul.c

The overriding of dg-do in gcc.target/powerpc/vec-mul.c I put there
last year didn't quite work.  It needed the newly-added dg-do-if to
work the way I wished.  Fix it, and simplify it.

While at that, I found out that when target matched, dg-do-if didn't
call dg-do correctly, because it dropped the leading argument early
on.  Fix that.

Finally, I realized that the first uses of dg-do-if unintentionally
disabled non-x86 platforms, so add them back.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/vec-mul.c: Use dg-do-if to fix and
improve coverage.
* lib/target-supports-dg (dg-do-if): Pass all args on to
dg-do.
* gcc.dg/vect/vect-simd-clone-16f.c: Also enable on !x86.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-20.c: Likewise.

Diff:
---
 gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c | 2 +-
 gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c | 2 +-
 gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c | 2 +-
 gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c  | 2 +-
 gcc/testsuite/gcc.target/powerpc/vec-mul.c  | 4 ++--
 gcc/testsuite/lib/target-supports-dg.exp| 5 ++---
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c 
b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c
index bb3b081b0e3d..5461fe241768 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c
@@ -1,4 +1,4 @@
-/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */
+/* { dg-do-if compile { target { { ! x86 } || { sse2_runtime && { ! 
sse4_runtime } } } } } */
 /* { dg-require-effective-target vect_simd_clones } */
 /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */
 /* { dg-additional-options "-msse4" { target sse4 } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c 
b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c
index 504465614c98..165c3cae92bf 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c
@@ -1,4 +1,4 @@
-/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */
+/* { dg-do-if compile { target { { ! x86 } || { sse2_runtime && { ! 
sse4_runtime } } } } } */
 /* { dg-require-effective-target vect_simd_clones } */
 /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */
 /* { dg-additional-options "-msse4" { target sse4 } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c 
b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c
index 0c418d432482..eda28856cad6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c
@@ -1,4 +1,4 @@
-/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */
+/* { dg-do-if compile { target { { ! x86 } || { sse2_runtime && { ! 
sse4_runtime } } } } } */
 /* { dg-require-effective-target vect_simd_clones } */
 /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */
 /* { dg-additional-options "-msse4" { target sse4 } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c 
b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c
index 3e626fc4d4d5..bb32a1aab248 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c
@@ -1,4 +1,4 @@
-/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */
+/* { dg-do-if compile { target { { ! x86 } || { sse2_runtime && { ! 
sse4_runtime } } } } } */
 /* { dg-require-effective-target vect_simd_clones } */
 /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */
 /* { dg-additional-options "-msse4" { target sse4 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-mul.c 
b/gcc/testsuite/gcc.target/powerpc/vec-mul.c
index 915c92303274..0c2ffcf46f1a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-mul.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-mul.c
@@ -1,5 +1,5 @@
-/* { dg-do compile { target { { ! vsx_hw } && powerpc_vsx } } } */
-/* { dg-do run { target vsx_hw } } */
+/* { dg-do compile { target powerpc_vsx } } */
+/* { dg-do-if run { target vsx_hw } } */
 /* { dg-options "-mvsx -O3" } */
 
 /* Test that the vec_mul builtin works as expected.  */
diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
b/gcc/testsuite/lib/target-supports-dg.exp
index 422ea8380845..2dca8e15c429 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -422,9 +422,8 @@ proc check-flags { 

[gcc r15-9271] AArch64: Add OpenMP target compile error tests

2025-04-10 Thread Tejas Belagod via Gcc-cvs
https://gcc.gnu.org/g:3651de6132d0e2379fe00243f086982dd6051946

commit r15-9271-g3651de6132d0e2379fe00243f086982dd6051946
Author: Tejas Belagod 
Date:   Mon Mar 31 16:00:31 2025 +0530

AArch64: Add OpenMP target compile error tests

Add compile-only OpenMP error tests for target clause used with SVE types.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/gomp/gomp.exp: Test driver.
* gcc.target/aarch64/sve/gomp/target-device.c: New test.
* gcc.target/aarch64/sve/gomp/target-link.c: Likewise.
* gcc.target/aarch64/sve/gomp/target.c: Likewise.

Diff:
---
 gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp |   46 +
 .../gcc.target/aarch64/sve/gomp/target-device.c|  201 ++
 .../gcc.target/aarch64/sve/gomp/target-link.c  |   57 +
 gcc/testsuite/gcc.target/aarch64/sve/gomp/target.c | 2049 
 4 files changed, 2353 insertions(+)

diff --git a/gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp 
b/gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp
new file mode 100644
index ..376985de1ff2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp
@@ -0,0 +1,46 @@
+# Copyright (C) 2006-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
+# .
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an AArch64 target.
+if {![istarget aarch64*-*-*] } then {
+  return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+if ![check_effective_target_fopenmp] {
+  return
+}
+
+if { [check_effective_target_aarch64_sve] } {
+set sve_flags ""
+} else {
+set sve_flags "-march=armv8.2-a+sve"
+}
+
+# Main loop.
+dg-runtest [lsort [find $srcdir/$subdir *.c]] "$sve_flags -fopenmp" ""
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-device.c 
b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-device.c
new file mode 100644
index ..75dd39bb24a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-device.c
@@ -0,0 +1,201 @@
+/* { dg-do compile } */
+/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */
+
+#include 
+
+#define N __ARM_FEATURE_SVE_BITS
+
+int64_t __attribute__ ((noipa))
+target_device_ptr_vla (svbool_t vp, svint32_t *vptr)
+{
+
+  int a[N], b[N], c[N];
+  svint32_t va, vb, vc;
+  int64_t res;
+  int i;
+
+#pragma omp parallel for
+  for (i = 0; i < N; i++)
+{
+  b[i] = i;
+  c[i] = i + 1;
+}
+/* { dg-error {SVE type 'svint32_t \*' not allowed in 'target' device clauses} 
"" { target *-*-* } .+1 } */
+#pragma omp target data use_device_ptr (vptr) map (to: b, c)
+/* { dg-error {SVE type 'svint32_t \*' not allowed in 'target' device clauses} 
"" { target *-*-* } .+1 } */
+#pragma omp target is_device_ptr (vptr) map (to: b, c) map (from: res)
+  for (i = 0; i < 8; i++)
+{
+  /* { dg-error "cannot reference 'svint32_t' object types in 'target' 
region" "" { target *-*-* } .+1 } */
+  vb = *vptr;
+  /* { dg-error "cannot reference 'svint32_t' object types in 'target' 
region" "" { target *-*-* } .+2 } */
+  /* { dg-error "cannot reference 'svbool_t' object types in 'target' 
region" "" { target *-*-* } .+1 } */
+  vc = svld1_s32 (vp, c);
+  /* { dg-error "cannot reference 'svint32_t' object types in 'target' 
region" "" { target *-*-* } .+1 } */
+  va = svadd_s32_z (vp, vb, vc);
+  res = svaddv_s32 (svptrue_b32 (), va);
+}
+
+  return res;
+}
+
+int64_t __attribute__ ((noipa))
+target_device_addr_vla (svbool_t vp, svint32_t *vptr)
+{
+
+  int a[N], b[N], c[N];
+  svint32_t va, vb, vc;
+  int64_t res;
+  int i;
+
+#pragma omp parallel for
+  for (i = 0; i < N; i++)
+{
+  b[i] = i;
+  c[i] = i + 1;
+}
+
+/* { dg-error "SVE type 'svint32_t' not allowed in 'target' device clauses" "" 
{  target *-*-* } .+1 } */
+#pragma omp target data use_device_addr (vb) map (to: b, c)
+/* { dg-error {SVE type 'svint32_t \*' not allowed in 'target' device clauses} 
"" { target *-*-* } .+1 } */
+#pragma omp target is_device_ptr (vptr) map (to: b, c) map (from: res)
+  for (i = 0; i < 8; i++)
+{
+  /* { dg-error "cannot reference 'svint32_t' object types in 'target' 
region" "" { target *-*-* } .+1 } */
+  vb = *vptr;
+  /* { dg-error "cannot reference 'svint32_t' object t

[gcc r15-9272] libgomp: Add AArch64 SVE target tests to libgomp.

2025-04-10 Thread Tejas Belagod via Gcc-cvs
https://gcc.gnu.org/g:a9bbb60b7ca7bf83c0e8657c61867e3786091916

commit r15-9272-ga9bbb60b7ca7bf83c0e8657c61867e3786091916
Author: Tejas Belagod 
Date:   Mon Mar 31 16:00:55 2025 +0530

libgomp: Add AArch64 SVE target tests to libgomp.

Add AArch64 SVE target exectute tests to test various workshare constructs 
and
clauses with SVE types.

libgomp/ChangeLog:

* testsuite/libgomp.c-target/aarch64/aarch64.exp: Test driver.
* testsuite/libgomp.c-target/aarch64/firstprivate.c: New test.
* testsuite/libgomp.c-target/aarch64/lastprivate.c: Likewise.
* testsuite/libgomp.c-target/aarch64/private.c: Likewise.
* testsuite/libgomp.c-target/aarch64/shared.c: Likewise.
* testsuite/libgomp.c-target/aarch64/simd-aligned.c: Likewise.
* testsuite/libgomp.c-target/aarch64/simd-nontemporal.c: Likewise.
* testsuite/libgomp.c-target/aarch64/threadprivate.c: Likewise.
* testsuite/libgomp.c-target/aarch64/udr-sve.c: Likewise.

Diff:
---
 .../testsuite/libgomp.c-target/aarch64/aarch64.exp |  57 +
 .../libgomp.c-target/aarch64/firstprivate.c| 127 ++
 .../libgomp.c-target/aarch64/lastprivate.c | 169 +
 .../testsuite/libgomp.c-target/aarch64/private.c   | 105 
 .../testsuite/libgomp.c-target/aarch64/shared.c| 264 +
 .../libgomp.c-target/aarch64/simd-aligned.c|  49 
 .../libgomp.c-target/aarch64/simd-nontemporal.c|  49 
 .../libgomp.c-target/aarch64/threadprivate.c   |  45 
 .../testsuite/libgomp.c-target/aarch64/udr-sve.c   |  98 
 9 files changed, 963 insertions(+)

diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/aarch64.exp 
b/libgomp/testsuite/libgomp.c-target/aarch64/aarch64.exp
new file mode 100644
index ..02d5503c48b4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/aarch64.exp
@@ -0,0 +1,57 @@
+# Copyright (C) 2006-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
+# .
+
+# Load support procs.
+load_lib libgomp-dg.exp
+load_gcc_lib gcc-dg.exp
+
+# Exit immediately if this isn't an AArch64 target.
+if {![istarget aarch64*-*-*] } then {
+  return
+}
+
+lappend ALWAYS_CFLAGS "compiler=$GCC_UNDER_TEST"
+
+if { [check_effective_target_aarch64_sve] } {
+set sve_flags ""
+} else {
+set sve_flags "-march=armv8.2-a+sve"
+}
+
+# Initialize `dg'.
+dg-init
+
+#if ![check_effective_target_fopenmp] {
+#  return
+#}
+
+# Turn on OpenMP.
+lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
+
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.c]]
+
+set ld_library_path $always_ld_library_path
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+# Main loop.
+dg-runtest $tests "" $sve_flags
+
+# All done.
+dg-finish
diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c 
b/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c
new file mode 100644
index ..930ca6215b60
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c
@@ -0,0 +1,127 @@
+/* { dg-do run { target aarch64_sve256_hw } } */
+/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */
+
+#include 
+#include 
+
+static void __attribute__ ((noipa))
+vec_compare (svint32_t *x, svint32_t y)
+{
+  svbool_t p = svnot_b_z (svptrue_b32 (), svcmpeq_s32 (svptrue_b32 (), *x, y));
+
+  if (svptest_any (svptrue_b32 (), p))
+__builtin_abort ();
+}
+
+void __attribute__ ((noipa))
+firstprivate_sections ()
+{
+  int b[8], c[8];
+  svint32_t vb, vc;
+  int i;
+
+#pragma omp parallel for
+  for (i = 0; i < 8; i++)
+{
+  b[i] = i;
+  c[i] = i + 1;
+}
+
+  vb = svld1_s32 (svptrue_b32 (), b);
+  vc = svld1_s32 (svptrue_b32 (), c);
+
+#pragma omp parallel sections firstprivate (vb, vc)
+  {
+#pragma omp section
+vec_compare (&vb, svindex_s32 (0, 1));
+vec_compare (&vc, svindex_s32 (1, 1));
+
+#pragma omp section
+vec_compare (&vb, svindex_s32 (0, 1));
+vec_compare (&vc, svindex_s32 (1, 1));
+  }
+
+}
+
+void __attribute__ ((noipa))
+firstprivate_for ()
+{
+
+  int a[32], b[32], c[32];
+  svint32_t va, vb, vc;
+  int i;
+
+#pragma omp parallel for
+  for (i = 0; i < 32; i++)
+{
+  b[i] = i;
+  c[i] = i + 1;
+}

[gcc r14-11544] LoongArch: Make gen-evolution.awk compatible with FreeBSD awk

2025-04-10 Thread LuluCheng via Gcc-cvs
https://gcc.gnu.org/g:fd7d5a6b775090c93158b1cc3244c190e51b2dd3

commit r14-11544-gfd7d5a6b775090c93158b1cc3244c190e51b2dd3
Author: Xi Ruoyao 
Date:   Wed Apr 2 10:41:18 2025 +0800

LoongArch: Make gen-evolution.awk compatible with FreeBSD awk

Avoid using gensub that FreeBSD awk lacks, use gsub and split those each
of gawk, mawk, and FreeBSD awk provides.

Reported-by: mp...@vip.163.com
Link: https://man.freebsd.org/cgi/man.cgi?query=awk

gcc/ChangeLog:

* config/loongarch/genopts/gen-evolution.awk: Avoid using gensub
that FreeBSD awk lacks.

(cherry picked from commit 92ca72b41a74aef53978cadbda33dd38b69d3ed3)

Diff:
---
 gcc/config/loongarch/genopts/gen-evolution.awk | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/config/loongarch/genopts/gen-evolution.awk 
b/gcc/config/loongarch/genopts/gen-evolution.awk
index 1c8004e4146c..a2ecd9a8bcf5 100644
--- a/gcc/config/loongarch/genopts/gen-evolution.awk
+++ b/gcc/config/loongarch/genopts/gen-evolution.awk
@@ -33,10 +33,12 @@ BEGIN {
 {
 cpucfg_word[NR] = $1
 cpucfg_bit_in_word[NR] = $2
-name[NR] = gensub(/-/, "_", "g", $3)
+name[NR] = $3
+gsub("-", "_", name[NR])
 name_capitalized[NR] = toupper(name[NR])
-isa_version_major[NR] = gensub(/^([1-9][0-9]*)\.([0-9]+)$/, "\\1", 1, $4)
-isa_version_minor[NR] = gensub(/^([1-9][0-9]*)\.([0-9]+)$/, "\\2", 1, $4)
+split($4, isa_ver, "\\.")
+isa_version_major[NR] = isa_ver[1]
+isa_version_minor[NR] = isa_ver[2]
 
 $1 = $2 = $3 = $4 = ""
 sub (/^\s*/, "")


[gcc r14-11593] c++: nested lambda capture pack [PR119345]

2025-04-10 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:779e002a1dc4ee7c688b7fb497375185cbcfec87

commit r14-11593-g779e002a1dc4ee7c688b7fb497375185cbcfec87
Author: Jason Merrill 
Date:   Thu Apr 10 14:34:35 2025 -0400

c++: nested lambda capture pack [PR119345]

tsubst_stmt already registers a local capture proxy as a
local_specialization of both an outer capture proxy and the captured
variable; we also need to do that in add_extra_args.

PR c++/119345

gcc/cp/ChangeLog:

* pt.cc (add_extra_args): Also register a specialization
of the captured variable.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-targ14.C: New test.

(cherry picked from commit 5957b9919c9ecda6e4ca198086f8bb9ea215232c)

Diff:
---
 gcc/cp/pt.cc   |  2 ++
 gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C | 12 
 2 files changed, 14 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 3a5ffd8b683e..a4028a545a33 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -13520,6 +13520,8 @@ add_extra_args (tree extra, tree args, tsubst_flags_t 
complain, tree in_decl)
  inst = local;
  /* else inst is already a full instantiation of the pack.  */
  register_local_specialization (inst, gen);
+ if (is_normal_capture_proxy (gen))
+   register_local_specialization (inst, DECL_CAPTURED_VARIABLE (gen));
}
   gcc_assert (!TREE_PURPOSE (extra));
   extra = TREE_VALUE (extra);
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C 
b/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C
new file mode 100644
index ..debb15e83f61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C
@@ -0,0 +1,12 @@
+// PR c++/119345
+// { dg-do compile { target c++20 } }
+
+void f(auto... args) {
+  [args...] {
+(..., [args...] { i; });
+  }.template operator()<0>();
+}
+
+int main() {
+  f();
+}


[gcc r14-11546] [RISC-V][PR target/116256] Fix incorrect return value for predicate

2025-04-10 Thread Kito Cheng via Gcc-cvs
https://gcc.gnu.org/g:47b509fef536455d59aeb7b8e97851099c6b29a5

commit r14-11546-g47b509fef536455d59aeb7b8e97851099c6b29a5
Author: Jeff Law 
Date:   Tue Jan 21 06:56:27 2025 -0700

[RISC-V][PR target/116256] Fix incorrect return value for predicate

Another bug found while chasing paths to fix the remaining issues in 
pr116256.

This case is sometimes benign when the optimizers are enabled.  But could 
show
up in a -O0 compile with some patterns I was playing around with.

Basically we have a predicate that is meant to return true if bits set in 
the
operand are all consecutive.

That predicate would return the wrong value when presented with (const_int 
0)
indicating it had a run of on bits when obviously no bits are on 😉

It's pretty obvious once you look at the implementation.

if (exact_log2 ((val >> ctz_hwi (val)) + 1) < 0)
  return false
return true;

The right shift is always going to produce 0.  0 + 1 = 1 which is a power 
of 2.
So exact_log2 returns 0 and we get a true result rather than a false result.

The fix is trivial.  "<=".  While inside we might as well fix the 
formatting.

Tested on rv32 and rv64 in my tester.  Waiting on upstream pre-commit 
testing
to render a verdict.

PR target/116256
gcc/
* config/riscv/predicates.md (consecutive_bits_operand): Properly
handle (const_int 0).

Diff:
---
 gcc/config/riscv/predicates.md | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index 539e0f7379b7..1e2df96707aa 100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -413,11 +413,11 @@
 (define_predicate "consecutive_bits_operand"
   (match_code "const_int")
 {
-   unsigned HOST_WIDE_INT val = UINTVAL (op);
-   if (exact_log2 ((val >> ctz_hwi (val)) + 1) < 0)
-   return false;
+  unsigned HOST_WIDE_INT val = UINTVAL (op);
+  if (exact_log2 ((val >> ctz_hwi (val)) + 1) <= 0)
+return false;
 
-   return true;
+  return true;
 })
 
 ;; CORE-V Predicates:


[gcc r15-9367] c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687]

2025-04-10 Thread Patrick Palka via Gcc-cvs
https://gcc.gnu.org/g:493974aa0ad8b94dbeb61f00d2acc57c94fd4809

commit r15-9367-g493974aa0ad8b94dbeb61f00d2acc57c94fd4809
Author: Patrick Palka 
Date:   Thu Apr 10 15:49:12 2025 -0400

c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687]

With inherited CTAD the set of guides may be a two-dimensional overload
set (i.e. OVERLOADs of OVERLOADs) so alias_ctad_tweaks (which also does
the inherited CTAD transformation) needs to use the 2D-aware lkp_iterator
instead of ovl_iterator, or better yet use the more idiomatic lkp_range.

PR c++/119687

gcc/cp/ChangeLog:

* pt.cc (alias_ctad_tweaks): Use lkp_range / lkp_iterator
instead of ovl_iterator.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/class-deduction-inherited8.C: New test.

Reviewed-by: Jason Merill 

Diff:
---
 gcc/cp/pt.cc|  3 +--
 .../g++.dg/cpp23/class-deduction-inherited8.C   | 21 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 63c2ec0c59b3..805b274069bf 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -30936,9 +30936,8 @@ alias_ctad_tweaks (tree tmpl, tree uguides)
   tree aguides = NULL_TREE;
   tree atparms = INNERMOST_TEMPLATE_PARMS (fullatparms);
   unsigned natparms = TREE_VEC_LENGTH (atparms);
-  for (ovl_iterator iter (uguides); iter; ++iter)
+  for (tree f : lkp_range (uguides))
 {
-  tree f = *iter;
   tree in_decl = f;
   location_t loc = DECL_SOURCE_LOCATION (f);
   tree ret = TREE_TYPE (TREE_TYPE (f));
diff --git a/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C 
b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C
new file mode 100644
index ..4494c701c350
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C
@@ -0,0 +1,21 @@
+// PR c++/119687
+// { dg-do compile { target c++17 } }
+
+template  class QFlagsStorage{};
+
+template  struct QFlagsStorageHelper : QFlagsStorage  {
+  using QFlagsStorage::QFlagsStorage;
+
+public:
+  QFlagsStorageHelper(Enum);
+};
+
+template  struct QFlags : public QFlagsStorageHelper {
+  using Base = QFlagsStorageHelper;
+  using Base::Base;
+  QFlags(Enum);
+};
+
+void f(int flag) {
+  QFlags{int{}};
+}


[gcc r15-9368] libgomp: Update SVE tests

2025-04-10 Thread Richard Sandiford via Gcc-cvs
https://gcc.gnu.org/g:733a6a4c1115080a0ee3cf7e6678c0fb9ffd0a56

commit r15-9368-g733a6a4c1115080a0ee3cf7e6678c0fb9ffd0a56
Author: Richard Sandiford 
Date:   Thu Apr 10 21:09:07 2025 +0100

libgomp: Update SVE tests

The new SVE tests didn't explicitly force SVE to be enabled,
which meant that they wouldn't work on targets that aren't
configured for SVE by default.  The least invasive way of
fixing that is to add a pragma, which works for most tests.
However, for udr-sve.c, the global:

 #pragma omp declare reduction (+:svint32_t: omp_out = svadd_s32_z 
(svptrue_b32(), omp_in, omp_out)) \
initializer (omp_priv = svindex_s32 (0, 0))

does not work with an earlier:

 #pragma GCC target "+sve"

which is interesting, and maybe worthy of a PR if there isn't one
already.  It seems we have to force SVE (and thus an architecture)
on the command line instead.

However, with that fixed, udr-sve.c fails execution.  One problem
seems to be a missing accumulation in for_reduction.  Fixing that
is enough to reach the final inscan_reduction_incl, but that fails
for reasons I haven't investigated yet.  I would need to read up
more to understand what the loop is doing.

It also looks like there might be a missing "+" in simd_reduction:

  #pragma omp simd reduction (+:va, i)
  for (j = 0; j < 16; j++)
va = svld1_s32 (svptrue_b32 (), a);

  res = svaddv_s32 (svptrue_b32 (), va);

  if (res != 8)
__builtin_abort ();

since AFAICT the loop is not doing a reduction as things stand.
But perhaps that's deliberate, since it does match the != 8 test.

libgomp/
* testsuite/libgomp.c-target/aarch64/firstprivate.c: Add +sve 
pragma.
* testsuite/libgomp.c-target/aarch64/lastprivate.c: Likewise.
* testsuite/libgomp.c-target/aarch64/private.c: Likewise.
* testsuite/libgomp.c-target/aarch64/shared.c: Likewise.
* testsuite/libgomp.c-target/aarch64/simd-aligned.c: Likewise.
* testsuite/libgomp.c-target/aarch64/simd-nontemporal.c: Likewise.
* testsuite/libgomp.c-target/aarch64/threadprivate.c: Likewise.
* testsuite/libgomp.c-target/aarch64/udr-sve.c: Add an -march 
option.
(for_reduction): Use "+=" in the reduction loop.

Diff:
---
 libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c | 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/lastprivate.c  | 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/private.c  | 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/shared.c   | 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/simd-aligned.c | 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/simd-nontemporal.c | 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/threadprivate.c| 2 ++
 libgomp/testsuite/libgomp.c-target/aarch64/udr-sve.c  | 4 ++--
 8 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c 
b/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c
index 930ca6215b60..58674e23dbb5 100644
--- a/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c
@@ -1,6 +1,8 @@
 /* { dg-do run { target aarch64_sve256_hw } } */
 /* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */
 
+#pragma GCC target "+sve"
+
 #include 
 #include 
 
diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/lastprivate.c 
b/libgomp/testsuite/libgomp.c-target/aarch64/lastprivate.c
index be5a618c1b8c..2f93d7bb3125 100644
--- a/libgomp/testsuite/libgomp.c-target/aarch64/lastprivate.c
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/lastprivate.c
@@ -1,6 +1,8 @@
 /* { dg-do run { target aarch64_sve256_hw } } */
 /* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */
 
+#pragma GCC target "+sve"
+
 #include 
 #include 
 
diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/private.c 
b/libgomp/testsuite/libgomp.c-target/aarch64/private.c
index 0ca74fe4e4bf..fed5370c8d04 100644
--- a/libgomp/testsuite/libgomp.c-target/aarch64/private.c
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/private.c
@@ -1,6 +1,8 @@
 /* { dg-do run { target aarch64_sve256_hw } } */
 /* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */
 
+#pragma GCC target "+sve"
+
 #include 
 #include 
 
diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/shared.c 
b/libgomp/testsuite/libgomp.c-target/aarch64/shared.c
index dec41b800387..340a668c0f3a 100644
--- a/libgomp/testsuite/libgomp.c-target/aarch64/shared.c
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/shared.c
@@ -1,6 +1,8 @@
 /* { dg-do run { target aarch64_sve256_hw } } */
 /* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */
 
+#pragma GCC target "+sve"
+
 #include 
 #include 
 #include 
diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/simd-aligned.c 
b/

[gcc r14-11584] RISC-V: unrecognizable insn ICE in xtheadvector/pr114194.c on 32bit targets

2025-04-10 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:f2e2e255004dc35beef9d8b5800d69d228f7eec1

commit r14-11584-gf2e2e255004dc35beef9d8b5800d69d228f7eec1
Author: Jin Ma 
Date:   Tue Feb 11 21:28:05 2025 +0800

RISC-V: unrecognizable insn ICE in xtheadvector/pr114194.c on 32bit targets

This is a follow-up to the patch below to avoid generating unrecognized
vsetivl instructions for XTheadVector.

https://gcc.gnu.org/pipermail/gcc-patches/2025-January/674185.html

PR target/118601

gcc/ChangeLog:

* config/riscv/riscv-string.cc (expand_block_move): Check with new
constraint 'vl' instead of 'K'.
(expand_vec_setmem): Likewise.
(expand_vec_cmpmem): Likewise.
* config/riscv/riscv-v.cc (force_vector_length_operand): Likewise.
(expand_load_store): Likewise.
(expand_strided_load): Likewise.
(expand_strided_store): Likewise.
(expand_lanes_load_store): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr114194.c: Move to...
* gcc.target/riscv/rvv/xtheadvector/pr114194-rv64.c: ...here.
* gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c: New test.
* gcc.target/riscv/rvv/xtheadvector/pr118601.c: New test.

Reported-by: Edwin Lu 
(cherry picked from commit 580f571be6ce80aa71fb80e7b16e01824f088229)

Diff:
---
 gcc/config/riscv/riscv-string.cc   |  2 +-
 gcc/config/riscv/riscv-v.cc|  8 ++--
 .../riscv/rvv/xtheadvector/pr114194-rv32.c | 51 ++
 .../xtheadvector/{pr114194.c => pr114194-rv64.c}   |  5 +--
 .../gcc.target/riscv/rvv/xtheadvector/pr118601.c   |  9 
 5 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/gcc/config/riscv/riscv-string.cc b/gcc/config/riscv/riscv-string.cc
index b09b51d7526b..1cb9f832bb54 100644
--- a/gcc/config/riscv/riscv-string.cc
+++ b/gcc/config/riscv/riscv-string.cc
@@ -969,7 +969,7 @@ expand_block_move (rtx dst_in, rtx src_in, rtx length_in)
   machine_mode mask_mode = riscv_vector::get_vector_mode
(BImode, GET_MODE_NUNITS (vmode)).require ();
   rtx mask =  CONSTM1_RTX (mask_mode);
-  if (!satisfies_constraint_K (cnt))
+  if (!satisfies_constraint_vl (cnt))
cnt= force_reg (Pmode, cnt);
   rtx m_ops[] = {vec, mask, src};
   emit_nonvlmax_insn (code_for_pred_mov (vmode),
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index fe51e2fe9b83..bb38d8b42c70 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -2075,7 +2075,7 @@ get_unknown_min_value (machine_mode mode)
 static rtx
 force_vector_length_operand (rtx vl)
 {
-  if (CONST_INT_P (vl) && !satisfies_constraint_K (vl))
+  if (CONST_INT_P (vl) && !satisfies_constraint_vl (vl))
 return force_reg (Pmode, vl);
   return vl;
 }
@@ -3864,7 +3864,7 @@ expand_load_store (rtx *ops, bool is_load)
 }
   else
 {
-  if (!satisfies_constraint_K (len))
+  if (!satisfies_constraint_vl (len))
len = force_reg (Pmode, len);
   if (is_load)
{
@@ -4309,7 +4309,7 @@ expand_lanes_load_store (rtx *ops, bool is_load)
 }
   else
 {
-  if (!satisfies_constraint_K (len))
+  if (!satisfies_constraint_vl (len))
len = force_reg (Pmode, len);
   if (is_load)
{
@@ -5108,7 +5108,7 @@ can_be_broadcasted_p (rtx op)
   && !satisfies_constraint_Wdm (op))
 return false;
 
-  if (satisfies_constraint_K (op) || register_operand (op, mode)
+  if (satisfies_constraint_vl (op) || register_operand (op, mode)
   || satisfies_constraint_Wdm (op) || rtx_equal_p (op, CONST0_RTX (mode)))
 return true;
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c
new file mode 100644
index ..0bee5ec33de8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c
@@ -0,0 +1,51 @@
+/* { dg-do compile { target rv32 } } */
+/* { dg-options "-march=rv32gc_xtheadvector -O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** foo0_1:
+** sb\tzero,0\([a-x0-9]+\)
+** ret
+*/
+void foo0_1 (void *p)
+{
+  __builtin_memset (p, 0, 1);
+}
+
+/*
+** foo0_7:
+** li\t[a-x0-9]+,7
+** th.vsetvli\tzero,[a-x0-9]+,e8,m1
+** th\.vmv\.v\.i\tv[0-9],0
+** th\.vse\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void foo0_7 (void *p)
+{
+  __builtin_memset (p, 0, 7);
+}
+
+/*
+** foo1_1:
+** li\t[a-x0-9]+,1
+** sb\t[a-x0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void foo1_1 (void *p)
+{
+  __builtin_memset (p, 1, 1);
+}
+
+/*
+** foo1_5:
+** li\t[a-x0-9]+,5
+** th.vsetvli\tzero,[a-x0-9]+,e8,m1
+** th\.vmv\.v\.i\tv[0-9],1
+** th\.vse\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+
+void foo1_5 (void *p)
+{
+  __builtin_memset (p, 1, 5);
+}
diff --git a/gcc/testsuite/gcc.targ

[gcc r14-11591] c++: self-dependent alias template [PR117530]

2025-04-10 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:708c393774188d74399ec75ef20a522444b09f92

commit r14-11591-g708c393774188d74399ec75ef20a522444b09f92
Author: Jason Merrill 
Date:   Mon Apr 7 14:35:14 2025 -0400

c++: self-dependent alias template [PR117530]

Here, instantiating B means instantiating A, which means
instantiating B.  And then when we go to register the initial
instantiation, it conflicts with the inner one.  Fixed by checking after
tsubst whether there's already something in the hash table.  We already did
something much like this in tsubst_decl, but that doesn't handle this case.

PR c++/117530

gcc/cp/ChangeLog:

* pt.cc (instantiate_template): Check retrieve_specialization after
tsubst.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-uneval27.C: New test.

(cherry picked from commit d034c78c7be613db3c25fddec1dd50222327117b)

Diff:
---
 gcc/cp/pt.cc |  9 +
 gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C | 10 ++
 2 files changed, 19 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index d41df4f230ce..3a5ffd8b683e 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -22258,6 +22258,15 @@ instantiate_template (tree tmpl, tree orig_args, 
tsubst_flags_t complain)
   return error_mark_node;
 }
 
+  /* Substituting the type might have recursively instantiated this
+ same alias (c++/117530).  */
+  if (DECL_ALIAS_TEMPLATE_P (gen_tmpl)
+  && (spec = retrieve_specialization (gen_tmpl, targ_ptr, hash)))
+{
+  pop_deferring_access_checks ();
+  return spec;
+}
+
   /* The DECL_TI_TEMPLATE should always be the immediate parent
  template, not the most general template.  */
   DECL_TI_TEMPLATE (fndecl) = tmpl;
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C 
b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C
new file mode 100644
index ..941fe636f6d5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C
@@ -0,0 +1,10 @@
+// PR c++/117530
+// { dg-do compile { target c++20 } }
+
+template  struct A;
+template  using B = decltype([]() -> A::X { return 0; });
+template  struct A {
+  typedef int X;
+  typedef B U;
+};
+B b;


[gcc r14-11592] c++: lambda in constraint of lambda [PR119175]

2025-04-10 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:e13143ab02172adf7b9a4a848c5c17f62579b9cf

commit r14-11592-ge13143ab02172adf7b9a4a848c5c17f62579b9cf
Author: Jason Merrill 
Date:   Wed Apr 9 13:22:56 2025 -0400

c++: lambda in constraint of lambda [PR119175]

Here when we went to mangle the constraints of from<0>, the outer lambda has
no mangling scope, but the inner one was treated as having the outer one as
its scope.  And mangling the outer one means mangling its constraints, which
include the inner one.  So infinite recursion.

But a lambda closure type isn't a scope that anything should have for
mangling, the inner lambda should also have no mangling scope.

PR c++/119175

gcc/cp/ChangeLog:

* mangle.cc (decl_mangling_context): Look through lambda type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-lambda23.C: New test.

(cherry picked from commit 39892d9618ee0f06dd09271589878b0df7b1e75d)

Diff:
---
 gcc/cp/mangle.cc   |  6 ++
 gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C | 12 
 2 files changed, 18 insertions(+)

diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 556f0db4269a..fe8e5a0fa288 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -1049,6 +1049,12 @@ decl_mangling_context (tree decl)
   tree extra = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (decl));
   if (extra)
return extra;
+  tcontext = CP_DECL_CONTEXT (decl);
+  if (LAMBDA_TYPE_P (tcontext))
+   /* Lambda type context means this lambda appears between the
+  lambda-introducer and the open brace of another lambda (c++/119175).
+  That isn't a real scope; look further into the enclosing scope.  */
+   return decl_mangling_context (TYPE_NAME (tcontext));
 }
   else if (template_type_parameter_p (decl))
  /* template type parms have no mangling context.  */
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C 
b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C
new file mode 100644
index ..f44212031dd7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C
@@ -0,0 +1,12 @@
+// PR c++/119175
+// { dg-do compile { target c++20 } }
+
+template
+static void from() requires requires {
+  [] requires requires { [] {}; } {};
+}
+{}
+
+int main() {
+  from();
+}


[gcc r15-9314] OpenMP: Fix append_args handling in modify_call_for_omp_dispatch

2025-04-10 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:0f77d88fdf797842ac0134a4013b4227dd5a658f

commit r15-9314-g0f77d88fdf797842ac0134a4013b4227dd5a658f
Author: Tobias Burnus 
Date:   Tue Apr 8 13:47:53 2025 +0200

OpenMP: Fix append_args handling in modify_call_for_omp_dispatch

At tree level, the addr ref is also required for array dummy arguments,
contrary to C; the GOMP_interop calls in modify_call_for_omp_dispatch
were updated accordingly (using build_fold_addr_expr).

As the GOMP_interop calls had no location data associated with them,
the init call happened as soon as executing the previous line of code,
which was confusing; solution: use the location data of the function
call itself.

PR middle-end/119662

gcc/ChangeLog:

* gimplify.cc (modify_call_for_omp_dispatch): Fix GOMP_interop
arg passing; add location info to function calls.

libgomp/ChangeLog:

* testsuite/libgomp.c/append-args-fr-1.c: New test.
* testsuite/libgomp.c/append-args-fr.h: New test.

gcc/testsuite/ChangeLog:
* c-c++-common/gomp/append-args-interop.c: Update for fixed
GOMP_interop call.
* g++.dg/gomp/append-args-8.C: Likewise.
* gfortran.dg/gomp/append-args-interop.f90: Likewise.

Diff:
---
 gcc/gimplify.cc|  32 ++-
 .../c-c++-common/gomp/append-args-interop.c|   4 +-
 gcc/testsuite/g++.dg/gomp/append-args-8.C  |   8 +-
 .../gfortran.dg/gomp/append-args-interop.f90   |   4 +-
 libgomp/testsuite/libgomp.c/append-args-fr-1.c | 232 
 libgomp/testsuite/libgomp.c/append-args-fr.h   | 305 +
 6 files changed, 563 insertions(+), 22 deletions(-)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 51595f6f51e4..4f385b1b779b 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -3887,6 +3887,7 @@ static tree
 modify_call_for_omp_dispatch (tree expr, tree dispatch_clauses,
  bool want_value, bool pointerize)
 {
+  location_t loc = EXPR_LOCATION (expr);
   tree fndecl = get_callee_fndecl (expr);
 
   /* Skip processing if we don't get the expected call form.  */
@@ -4081,14 +4082,17 @@ modify_call_for_omp_dispatch (tree expr, tree 
dispatch_clauses,
}
}
 
+ objs = build_fold_addr_expr (objs);
+ target_tgtsync = build_fold_addr_expr (target_tgtsync);
+ prefer_type = prefer_type ? build_fold_addr_expr (prefer_type)
+   : null_pointer_node;
  tree fn = builtin_decl_explicit (BUILT_IN_GOMP_INTEROP);
  tree create
-   = build_call_expr (fn, 11, dispatch_device_num,
-  nobjs, objs, target_tgtsync,
-  prefer_type ? prefer_type : null_pointer_node,
-  integer_zero_node, null_pointer_node,
-  integer_zero_node, null_pointer_node,
-  integer_zero_node, null_pointer_node);
+   = build_call_expr_loc (loc, fn, 11, dispatch_device_num,
+  nobjs, objs, target_tgtsync, prefer_type,
+  integer_zero_node, null_pointer_node,
+  integer_zero_node, null_pointer_node,
+  integer_zero_node, null_pointer_node);
  if (init_code)
init_code = build2 (COMPOUND_EXPR, TREE_TYPE (create),
init_code, create);
@@ -4096,12 +4100,12 @@ modify_call_for_omp_dispatch (tree expr, tree 
dispatch_clauses,
init_code = create;
 
  cleanup
-   = build_call_expr (fn, 11, dispatch_device_num,
-  integer_zero_node, null_pointer_node,
-  null_pointer_node, null_pointer_node,
-  integer_zero_node, null_pointer_node,
-  nobjs, objs,
-  integer_zero_node, null_pointer_node);
+   = build_call_expr_loc (loc, fn, 11, dispatch_device_num,
+  integer_zero_node, null_pointer_node,
+  null_pointer_node, null_pointer_node,
+  integer_zero_node, null_pointer_node,
+  nobjs, objs,
+  integer_zero_node, null_pointer_node);
  if (clobbers)
cleanup = build2 (COMPOUND_EXPR, TREE_TYPE (clobbers),
  cleanup, clobbers);
@@ -4282,8 +4286,8 @@ modify_call_for_omp_dispatch (tree expr, tree 
dispatch_clauses,
   actual_ptr);
}
  tree fn = builtin_decl_explicit (BUILT_IN_OMP_GET_MAPPED_PTR);
- tree mapped_arg = build_call_expr (fn, 2, actual_ptr,
- 

[gcc(refs/users/omachota/heads/rtl-ssa-dce)] rtl-ssa-dce: fix eh

2025-04-10 Thread Ondrej Machota via Gcc-cvs
https://gcc.gnu.org/g:a8b182971c47e3793df08c7fbab6cde116bfcc4b

commit a8b182971c47e3793df08c7fbab6cde116bfcc4b
Author: Ondřej Machota 
Date:   Tue Apr 8 18:00:34 2025 +0200

rtl-ssa-dce: fix eh

Diff:
---
 gcc/dce.cc | 67 +-
 1 file changed, 27 insertions(+), 40 deletions(-)

diff --git a/gcc/dce.cc b/gcc/dce.cc
index 6221e3b39910..c0ca89980254 100644
--- a/gcc/dce.cc
+++ b/gcc/dce.cc
@@ -1351,7 +1351,7 @@ bool is_rtx_prelive(const_rtx insn) {
   switch (GET_CODE(insn)) {
 case PREFETCH:
 case UNSPEC:
-case TRAP_IF:
+case TRAP_IF: /* testsuite/gcc.c-torture/execute/20020418-1.c */
   return true;
 
 default:
@@ -1372,7 +1372,6 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
 /* Don't delete calls that may throw if we cannot do so.  */
 && can_delete_call (insn))
   return false;
-  // return !find_call_stack_args (as_a  (insn), false, fast, 
arg_stores);
 
   if (!NONJUMP_INSN_P (insn))
 /* This handles jumps, notes, call_insns, debug_insns, ... */
@@ -1396,10 +1395,6 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
 case CLOBBER: // gcc/gcc/testsuite/gcc.c-torture/compile/2605-1.c
 case USE:
 case VAR_LOCATION:
-/* Following cases might be removed since they are part of is_rtx_prelive 
*/
-case PREFETCH:
-case TRAP_IF: /* testsuite/gcc.c-torture/execute/20020418-1.c */
-case UNSPEC:
   return true;
 
 case PARALLEL:
@@ -1415,13 +1410,19 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
 
 bool is_prelive(insn_info *insn)
 {
-  /* Phi insns are never prelive, bb head + end also are artificial */
+  /* Phi insns are never prelive, bb head and end contain artificial uses that
+ we need to mark as prelive */
+  if (insn->is_bb_head() || insn->is_bb_end())
+return true;
+
   if (insn->is_artificial() || insn->is_debug_insn())
 return false;
 
   gcc_assert (insn->is_real());
   auto rtl = insn->rtl();
 
+  /* I guess that a lot of conditions bellow are captured by artificial uses
+ of bb head and end insns. */
   for (def_info * def : insn->defs()) {
 /* The purpose of this pass is not to eliminate stores to memory... */
 if (def->is_mem())
@@ -1431,59 +1432,44 @@ bool is_prelive(insn_info *insn)
 gcc_assert(def->is_reg());
 /* this ignores clobbers, which is probably fine */
 
-/* TODO : find something similar to mark_artificial_uses to mark only
-   artificially-used registers.
-   - df_get_regular_block_artificial_uses
-   That should fix following test as assume
-   gcc.c-torture/execute/2503-1.c - flags register is unused. Not all
+/* gcc.c-torture/execute/2503-1.c - flags register is unused. Not all
hard registers should be marked... */
 if (def->kind() != access_kind::SET)
   continue;
 
 /* This might be messed up a bit */
-if (def->regno() == FRAME_POINTER_REGNUM
-|| def->regno() == STACK_POINTER_REGNUM)
-  return true;
+// if (def->regno() == FRAME_POINTER_REGNUM
+// || def->regno() == STACK_POINTER_REGNUM)
+//   return true;
 
 /* needed by gcc.c-torture/execute/pr51447.c */
 if (HARD_REGISTER_NUM_P (def->regno())
 && global_regs[def->regno()])
-return true;
+// { std::cout << "marked global reg: " << def->regno() << " in " << 
insn->uid() << '\n';
+  return true;
+// }
 
-if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
-&& def->regno() == HARD_FRAME_POINTER_REGNUM)
-  return true;
+// if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+// && def->regno() == HARD_FRAME_POINTER_REGNUM)
+//   return true;
 
-if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
-&& fixed_regs[ARG_POINTER_REGNUM]
-&& def->regno() == ARG_POINTER_REGNUM)
-  return true;
+// if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+// && fixed_regs[ARG_POINTER_REGNUM]
+// && def->regno() == ARG_POINTER_REGNUM)
+//   return true;
 
 unsigned int picreg = PIC_OFFSET_TABLE_REGNUM;
 if (picreg != INVALID_REGNUM
 && fixed_regs[picreg]
 && def->regno() == picreg)
 return true;
-
-// TODO : eh?
-
-/*
-if (def->kind() == access_kind::SET 
-&& (HARD_REGISTER_NUM_P(def->regno())
-|| (pic_offset_table_rtx != nullptr 
-  && def->regno() == REGNO (pic_offset_table_rtx)
-  && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER))
-  ) {
-  // find_reg_note(insn->rtl(), REG_UNUSED, def->regno())
-  return true;
-} */
   }
 
   return is_rtx_insn_prelive(rtl);
 }
 
 static void
-rtl_ssa_dce_mark_prelive(insn_info *info, vec &worklist, 
+rtl_ssa_dce_mark_prelive_insn(insn_info *info, vec &worklist, 
   std::unordered_set &marked)
 {
   if (dump_file)
@@ -1494,12 +1480,12 @@ rtl_ssa_dce_mark_prelive(insn_info *info, vec &worklist,
 }
 
 static auto_vec
-rtl_ssa_dce_prelive(std::unordered_set &marked)
+rtl_ssa_dce

[gcc(refs/users/alfierichards/heads/fmv_c)] Add get_clone_versions and get_version functions.

2025-04-10 Thread Alfie Richards via Gcc-cvs
https://gcc.gnu.org/g:17c466b660b798e22702e8ac5e3d6f840e1c6896

commit 17c466b660b798e22702e8ac5e3d6f840e1c6896
Author: Alfie Richards 
Date:   Fri Jan 31 10:51:14 2025 +

Add get_clone_versions and get_version functions.

This is a reimplementation of get_target_clone_attr_len,
get_attr_str, and separate_attrs using string_slice and auto_vec to make
memory management and use simpler.

This also adds get_version which is a helper function to get the version
string from a decl.

gcc/c-family/ChangeLog:

* c-attribs.cc (handle_target_clones_attribute): Change to use
get_clone_versions.

gcc/ChangeLog:

* tree.cc (get_clone_versions): New function.
(get_clone_attr_versions): New function.
(get_version): New function.
* tree.h (get_clone_versions): New function.
(get_clone_attr_versions): New function.
(get_version): New function.

Diff:
---
 gcc/c-family/c-attribs.cc |  4 +++-
 gcc/tree.cc   | 57 +++
 gcc/tree.h| 11 +
 3 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index 5a0e3d328ba7..5dff489fccae 100644
--- a/gcc/c-family/c-attribs.cc
+++ b/gcc/c-family/c-attribs.cc
@@ -6132,7 +6132,9 @@ handle_target_clones_attribute (tree *node, tree name, 
tree ARG_UNUSED (args),
}
}
 
-  if (get_target_clone_attr_len (args) == -1)
+  auto_vec versions= get_clone_attr_versions (args, NULL);
+
+  if (versions.length () == 1)
{
  warning (OPT_Wattributes,
   "single % attribute is ignored");
diff --git a/gcc/tree.cc b/gcc/tree.cc
index eccfcc89da40..ddbe98e1a74f 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -15372,6 +15372,63 @@ get_target_clone_attr_len (tree arglist)
   return str_len_sum;
 }
 
+/* Returns an auto_vec of string_slices containing the version strings from
+   ARGLIST.  DEFAULT_COUNT is incremented for each default version found.  */
+
+auto_vec
+get_clone_attr_versions (const tree arglist, int *default_count)
+{
+  gcc_assert (TREE_CODE (arglist) == TREE_LIST);
+  auto_vec versions;
+
+  static const char separator_str[] = {TARGET_CLONES_ATTR_SEPARATOR, 0};
+  string_slice separators = string_slice (separator_str);
+
+  for (tree arg = arglist; arg; arg = TREE_CHAIN (arg))
+{
+  string_slice str = string_slice (TREE_STRING_POINTER (TREE_VALUE (arg)));
+  while (str.is_valid ())
+   {
+ string_slice attr = string_slice::tokenize (&str, separators);
+ attr = attr.strip ();
+
+ if (attr == "default" && default_count)
+   (*default_count)++;
+ versions.safe_push (attr);
+   }
+}
+  return versions;
+}
+
+/* Returns an auto_vec of string_slices containing the version strings from
+   the target_clone attribute from DECL.  DEFAULT_COUNT is incremented for each
+   default version found.  */
+auto_vec
+get_clone_versions (const tree decl, int *default_count)
+{
+  tree attr = lookup_attribute ("target_clones", DECL_ATTRIBUTES (decl));
+  if (!attr)
+return auto_vec ();
+  tree arglist = TREE_VALUE (attr);
+  return get_clone_attr_versions (arglist, default_count);
+}
+
+/* Only works for target_version due to target attributes allowing multiple
+   string arguments to specify one target.  */
+string_slice
+get_target_version (const tree decl)
+{
+  gcc_assert (!TARGET_HAS_FMV_TARGET_ATTRIBUTE);
+
+  tree attr = lookup_attribute ("target_version", DECL_ATTRIBUTES (decl));
+
+  if (!attr)
+return string_slice::invalid ();
+
+  return string_slice (TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr
+  .strip ();
+}
+
 void
 tree_cc_finalize (void)
 {
diff --git a/gcc/tree.h b/gcc/tree.h
index 55f97f9f9994..e34a49a9ed9e 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "tree-core.h"
 #include "options.h"
+#include "vec.h"
 
 /* Convert a target-independent built-in function code to a combined_fn.  */
 
@@ -7041,4 +7042,14 @@ extern tree get_attr_nonstring_decl (tree, tree * = 
NULL);
 
 extern int get_target_clone_attr_len (tree);
 
+/* Returns the version string for a decl with target_version attribute.
+   Returns an invalid string_slice if no attribute is present.  */
+extern string_slice get_target_version (const tree);
+/* Returns a vector of the version strings from a target_clones attribute on
+   a decl.  Can also record the number of default versions found.  */
+extern auto_vec get_clone_versions (const tree, int * = NULL);
+/* Returns a vector of the version strings from a target_clones attribute
+   directly.  */
+extern auto_vec get_clone_attr_versions (const tree, int *);
+
 #endif  /* GCC_TREE_H  */


[gcc r15-9308] libgomp: Add -Wno-c-binding-type for omp_lib.f90 compilation

2025-04-10 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:649b3cf32aee7c22f24033d0f6f8c74196b74a19

commit r15-9308-g649b3cf32aee7c22f24033d0f6f8c74196b74a19
Author: Tobias Burnus 
Date:   Tue Apr 8 12:04:59 2025 +0200

libgomp: Add -Wno-c-binding-type for omp_lib.f90 compilation

Silence the overeager "Warning: Variable 'depobj_list' at (1) is a dummy
argument of the BIND(C) procedure ... but may not be C interoperable
[-Wc-binding-type]" when compiling omp_lib.f90(.in).

The argument is of integer kind 'omp_depend_kind = @OMP_DEPEND_KIND@'.

libgomp/ChangeLog:

* Makefile.am (%.mod): Add -Wno-c-binding-type.
* Makefile.in: Regenerate.

Diff:
---
 libgomp/Makefile.am | 2 +-
 libgomp/Makefile.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 855f0affddf5..e3202aeb0e05 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -97,7 +97,7 @@ openacc_kinds.mod: openacc.mod
 openacc.mod: openacc.lo
:
 %.mod: %.f90
-   $(FC) $(FCFLAGS) -cpp -fopenmp -fsyntax-only $<
+   $(FC) $(FCFLAGS) -cpp -fopenmp -fsyntax-only -Wno-c-binding-type $<
 fortran.lo: libgomp_f.h
 fortran.o: libgomp_f.h
 env.lo: libgomp_f.h
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 25cb6fcd3c14..2a0a842af52d 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -1388,7 +1388,7 @@ openacc_kinds.mod: openacc.mod
 openacc.mod: openacc.lo
:
 %.mod: %.f90
-   $(FC) $(FCFLAGS) -cpp -fopenmp -fsyntax-only $<
+   $(FC) $(FCFLAGS) -cpp -fopenmp -fsyntax-only -Wno-c-binding-type $<
 fortran.lo: libgomp_f.h
 fortran.o: libgomp_f.h
 env.lo: libgomp_f.h


[gcc r15-9374] Doc: Add missing documentation for -ftree-cselim [PR87909]

2025-04-10 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:f6b0dc1b1c5f1736e77a42512085f9ab290775fd

commit r15-9374-gf6b0dc1b1c5f1736e77a42512085f9ab290775fd
Author: Sandra Loosemore 
Date:   Fri Apr 11 03:16:26 2025 +

Doc: Add missing documentation for -ftree-cselim [PR87909]

gcc/ChangeLog
PR tree-optimization/87909
* common.opt.urls: Regenerate.
* doc/invoke.texi (Option Summary): Add -ftree-cselim.
(Optimize Options): Likewise.

Diff:
---
 gcc/common.opt.urls |  3 +++
 gcc/doc/invoke.texi | 10 --
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls
index 860ebd01ace2..a4b14f5241fc 100644
--- a/gcc/common.opt.urls
+++ b/gcc/common.opt.urls
@@ -1459,6 +1459,9 @@ 
UrlSuffix(gcc/Optimize-Options.html#index-ftree-coalesce-vars)
 ftree-copy-prop
 UrlSuffix(gcc/Optimize-Options.html#index-ftree-copy-prop)
 
+ftree-cselim
+UrlSuffix(gcc/Optimize-Options.html#index-ftree-cselim)
+
 ftree-switch-conversion
 UrlSuffix(gcc/Optimize-Options.html#index-ftree-switch-conversion)
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 05f6ca66fcef..ffde9df85fd3 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -642,8 +642,8 @@ Objective-C and Objective-C++ Dialects}.
 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
 -fthread-jumps  -ftracer  -ftree-bit-ccp
--ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
--ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
+-ftree-builtin-call-dce  -ftree-ccp  -ftree-ch  -ftree-coalesce-vars
+-ftree-copy-prop  -ftree-cselim  -ftree-dce  -ftree-dominator-opts
 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
 -ftree-loop-if-convert  -ftree-loop-im
 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
@@ -14072,6 +14072,12 @@ in this pass can
 be limited using @option{max-tail-merge-comparisons} parameter and
 @option{max-tail-merge-iterations} parameter.
 
+@opindex ftree-cselim
+@item -ftree-cselim
+Perform conditional store elimination on trees.  This flag is enabled by
+default at @option{-O1} and higher on targets that have conditional
+move instructions.
+
 @opindex ftree-dce
 @item -ftree-dce
 Perform dead code elimination (DCE) on trees.  This flag is enabled by


[gcc r15-9375] aarch64: Add test case.

2025-04-10 Thread Jennifer Schmitz via Gcc-cvs
https://gcc.gnu.org/g:f6e6e6d9ba1d71fdd02a2c570d60217db6c5a31b

commit r15-9375-gf6e6e6d9ba1d71fdd02a2c570d60217db6c5a31b
Author: Jennifer Schmitz 
Date:   Thu Apr 10 06:46:15 2025 -0700

aarch64: Add test case.

This patch adds a test case to the testsuite for PR119706.
The bug was already fixed by
https://gcc.gnu.org/pipermail/gcc-patches/2025-April/680573.html.

OK for mainline?

Signed-off-by: Jennifer Schmitz 

gcc/testsuite/
PR tree-optimization/119706
* g++.target/aarch64/sve/pr119706.C: New test.

Diff:
---
 gcc/testsuite/g++.target/aarch64/sve/pr119706.C | 178 
 1 file changed, 178 insertions(+)

diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr119706.C 
b/gcc/testsuite/g++.target/aarch64/sve/pr119706.C
new file mode 100644
index ..40fefe5f4fb2
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr119706.C
@@ -0,0 +1,178 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mcpu=neoverse-v2 
--param=aarch64-autovec-preference=sve-only -w" } */
+
+namespace a {
+typedef long unsigned b;
+typedef int c;
+template  struct e { using f = d; };
+template  using h = typename e::f;
+template  class> struct i {
+  using f = aa;
+};
+template  class j> using k = i;
+template  class j>
+using l = typename k::f;
+} // namespace a
+inline void *operator new(a::b, void *ab) { return ab; }
+namespace a {
+template  class ac {
+public:
+  typedef b m;
+  template  void ae(ad *ab, n... w) {
+new (ab) ad(w...);
+  }
+};
+template  using x = ac;
+template  class af : public x {
+public:
+  typedef d o;
+  template  struct ag { typedef af ah; };
+};
+struct ai {};
+struct aj : ai {};
+struct ak : aj {};
+template  struct al;
+template  struct al {
+  typedef ak an;
+  typedef c ao;
+  typedef d ap;
+};
+template  typename aq ::an ar(aq) { return typename aq ::an(); }
+template  typename as ::ao at(as au, as av, ak) { return av - au; 
}
+template  typename aw ::ao ax(aw au, aw av) {
+  return at(au, av, ar(au));
+}
+template  struct ay { typedef c ao; };
+} // namespace a
+namespace az {
+template  class ba {
+  am bb;
+  typedef a::al bc;
+
+public:
+  typedef typename bc::an an;
+  typedef typename bc::ao ao;
+  typedef typename bc::ap ap;
+  ba(am bd) : bb(bd) {}
+  ap operator*() { return *bb; }
+  ba operator++() {
+++bb;
+return *this;
+  }
+  am base() { return bb; }
+};
+template 
+bool operator!=(ba bh, ba p) {
+  return bh.base() != p.base();
+}
+template 
+auto operator-(ba bh, ba p) {
+  return bh.base() - p.base();
+}
+} // namespace az
+namespace a {
+struct bi {
+  template  struct bj {
+using f = typename d::ag::ah;
+  };
+  template  using bk = b;
+  template  static constexpr bool bl = false;
+  template  static constexpr bool bm = bl<>;
+  template  static constexpr bool bn = bm;
+};
+template  using bp = typename bi::bj::f;
+template  struct bq : bi {
+  typedef typename bo::o o;
+  using br = l;
+  template  struct bt { using f = typename ay::ao; 
};
+  template  struct bv { using f = typename bu::m; };
+  using ao = typename bt::f;
+  using m = typename bv::f;
+  template  using bw = bp;
+  static br allocate(bo, m);
+  template 
+  static h> ae(bo ci, d ab, n... w) {
+ci.ae(ab, w...);
+  }
+};
+template  struct bx {
+  static bool by(d &bz) try { d(bz.begin(), bz.ca(), bz.cb()); } catch (...) {
+  }
+};
+} // namespace a
+namespace az {
+template  struct cc : a::bq {
+  typedef a::bq q;
+  template  struct ag { typedef typename q::bw ah; };
+};
+} // namespace az
+enum cd {};
+using ce = double;
+namespace a {
+template 
+cg cj(aw au, cf av, cg ck, ch cl) {
+  typedef az::cc cx;
+  for (; au != av; ++au, ++ck)
+cx::ae(cl, ck, *au);
+}
+template  struct cm {
+  typedef typename az::cc::ag::ah cn;
+  typedef typename az::cc::br br;
+  struct co {
+br db;
+br cp;
+  };
+  struct cq : cn, co {
+cq(cn) {}
+  } typedef cr;
+  cn cs();
+  cr cb() noexcept;
+  cm(cr ci) : ct(ci) {}
+  cq ct;
+  br cu(b cv) {
+typedef az::cc cw;
+return cv ? cw::allocate(ct, cv) : c();
+  }
+};
+template > class cy : cm {
+  typedef cm cz;
+
+public:
+  typedef typename cz::br br;
+  typedef az::ba da;
+  typedef b m;
+  typedef bo cr;
+  cz::cs;
+  template  cy(aw au, aw av, cr ci) : cz(ci) {
+dg(au, av, ar(au));
+  }
+  cz::cb;
+  da begin() { return this->ct.db; }
+  da ca() { return this->ct.cp; }
+  void r() { s(); }
+  void clear() { t(this->ct.db); }
+  template  void dg(cg au, cg av, ai) { y(au, av, ax(au, av)); }
+  template  void y(am au, cf av, m cv) {
+br z = this->cu(dc(cv, cs()));
+cj(au, av, z, cs());
+  }
+  bool s();
+  m dc(m cv, cr) { return cv; }
+  void t(br dd) {
+if (this->ct.cp - dd)
+  this->ct.cp = dd;
+  }
+};
+template  bool cy::s() { bx::by(*this); }
+namespace basic {
+class u {
+  using de = ce;
+  void v(cd, b);
+  cy df;
+};
+void u::v(cd, b) {
+  df.clear();
+  df.r();
+}
+} // namespace basic
+} // namespace a
\ No n

[gcc r15-9376] bitintlower: Fix up handling of nested casts in m_upward_2limbs cases [PR119707]

2025-04-10 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:b57d7ef4bdda8f939d804bfe40123cb9e4b447b3

commit r15-9376-gb57d7ef4bdda8f939d804bfe40123cb9e4b447b3
Author: Jakub Jelinek 
Date:   Fri Apr 11 08:27:55 2025 +0200

bitintlower: Fix up handling of nested casts in m_upward_2limbs cases 
[PR119707]

The following testcase is miscompiled I believe starting with
PR112941 r14-6742.  That commit fixed the bitint-55.c testcase.
The m_first initialization for such conversion initializes 2 SSA_NAMEs,
one is PHI result on the loop (m_data[save_data_cnt]) and the other
(m_data[save_data_cnt+1]) is the argument of that PHI from the latch
edge initialized somewhere in the loop.  Both of these are used to
propagate sign extension (i.e. either 0 or all ones limb) from the
iteration with the sign bit of a narrower type to following iterations.
The bitint-55.c testcase was ICEing with invalid SSA forms as it was
using unconditionally the PHI argument SSA_NAME even in places which
weren't dominated by that.  And the code which was touched is about
handling constant idx, so if e.g. there are nested casts and the
outer one does conditional code based on index comparison with
a particular constant index.
In the following testcase there are 2 nested casts, one from signed
_BitInt(129) to unsigned _BitInt(255) and the outer from unsigned
_BitInt(255) to unsigned _BitInt(256).  The m_upward_2limbs case which
is used for handling mergeable arithmetics (like +-|&^ and casts etc.)
one loop iteration handles 2 limbs, the first half the even ones, the
second half the odd ones.
And for these 2 conversions, the special one for the inner conversion
on x86_64 is with index 2 where the sign bit of _BitInt(129) is present,
while for the outer one index 3 where we need to mask off the most
significant bit.
The r15-6742 change started using m_data[save_data_cnt] for all constant
indexes if it is still inside of the loop (and it is sign extension).
But that doesn't work correctly for the case where the inner conversion
produces the sign extension limb in the loop for an even index and
the outer conversion needs to special case the immediately next conversion,
because in that case using the PHI result will see still 0 there rather
than the updated value from the handling of previous limb.
So the following patch special cases this and uses the other SSA_NAME.

Commented IL, trying to lower
  _1 = (unsigned _BitInt(255)) y_4(D);
  _2 = (unsigned _BitInt(256)) _1;
  _3 = _2 + x_5(D);
   = _3;
we were emitting
   [local count: 1073741824]:
  # _8 = PHI <0(2), _9(12)> // This is the limb index
  # _10 = PHI <0(2), _11(12)>   // Sign extension limb from inner cast (0 
or ~0UL)
  # _22 = PHI <0(2), _23(12)>   // Overflow bit from addition of previous 
limb
  if (_8 <= 2)
goto ; [80.00%]
  else
goto ; [20.00%]

   [local count: 1073741824]:
  if (_8 == 2)
goto ; [20.00%]
  else
goto ; [80.00%]

   [local count: 1073741824]:
  _12 = VIEW_CONVERT_EXPR(y)[_8]; // Full limbs in y
  goto ; [100.00%]

   [local count: 214748360]:
  _13 = MEM  [(_BitInt(129) *)&y + 16B]; // y[2] which
  _14 = () _13;   // needs to be
  _15 = (unsigned long) _14;// sign extended
  _16 = (signed long) _15;  // to full
  _17 = _16 >> 63;  // limb
  _18 = (unsigned long) _17;

   [local count: 1073741824]:
  # _19 = PHI <_12(5), _10(3), _15(6)>  // Limb to add for result of casts
  # _20 = PHI <0(5), _10(3), _18(6)>// Sign extension limb from 
previous limb
  _11 = _20;// PHI _10 argument above
  _21 = VIEW_CONVERT_EXPR(x)[_8];
  _24 = .UADDC (_19, _21, _22);
  _25 = IMAGPART_EXPR <_24>;
  _26 = REALPART_EXPR <_24>;
  VIEW_CONVERT_EXPR()[_8] = _26;
  _27 = _8 + 1;
  if (_27 == 3) // For the outer cast limb 3 is special
goto ; [20.00%]
  else
goto ; [80.00%]

   [local count: 1073741824]:
  if (_27 < 2)
goto ; [80.00%]
  else
goto ; [20.00%]

   [local count: 1073741824]:
  _28 = VIEW_CONVERT_EXPR(y)[_27];// These are used 
in full

   [local count: 1073741824]:
  # _29 = PHI <_28(9), _11(8)>
  goto ; [100.00%]

   [local count: 214748360]:
// And HERE is the actual bug.  Using _10 for idx 3 will mean it is always
// zero there and doesn't contain the _18 value propagated to it.
// It should be
// _30 = () _11;
// Now if the outer conversion had special iteration say 5, we could
// have used _10 fine here, by that time it already propagates through
// the PHI.
  _30 = () _10;
  _31 = (unsigned l

[gcc r14-11595] [PATCH v2] RISC-V: Fixbug for slli + addw + zext.w into sh[123]add + zext.w

2025-04-10 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:889e40576fec9938bdc52fee7ccebe2e97ed28f5

commit r14-11595-g889e40576fec9938bdc52fee7ccebe2e97ed28f5
Author: Jin Ma 
Date:   Wed Apr 2 13:37:07 2025 -0600

[PATCH v2] RISC-V: Fixbug for slli + addw + zext.w into sh[123]add + zext.w

Assuming we have the following variables:

unsigned long long a0, a1;
unsigned int a2;

For the expression:

a0 = (a0 << 50) >> 49;  // slli a0, a0, 50 + srli a0, a0, 49
a2 = a1 + a0;   // addw a2, a1, a0 + slli a2, a2, 32 + srli a2, a2, 
32

In the optimization process of ZBA (combine pass), it would be optimized to:

a2 = a0 << 1 + a1;  // sh1add a2, a0, a1 + zext.w a2, a2

This is clearly incorrect, as it overlooks the fact that a0=a0&0x7ffe, 
meaning
that the bits a0[32:14] are set to zero.

gcc/ChangeLog:

* config/riscv/bitmanip.md: The optimization can only be applied if
the high bit of operands[3] is set to 1.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zba-shNadd-09.c: New test.
* gcc.target/riscv/zba-shNadd-10.c: New test.

(cherry picked from commit dd6ebc0a3473a830115995bdcaf8f797ebd085a3)

Diff:
---
 gcc/config/riscv/bitmanip.md   |  4 +++-
 gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c | 12 
 gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c | 21 +
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md
index 0612e69fcb3b..f2d256f44198 100644
--- a/gcc/config/riscv/bitmanip.md
+++ b/gcc/config/riscv/bitmanip.md
@@ -80,7 +80,9 @@
(match_operand:DI 3 
"consecutive_bits_operand")) 0)
 (subreg:SI (match_operand:DI 4 
"register_operand") 0]
   "TARGET_64BIT && TARGET_ZBA
-   && riscv_shamt_matches_mask_p (INTVAL (operands[2]), INTVAL (operands[3]))"
+   && riscv_shamt_matches_mask_p (INTVAL (operands[2]), INTVAL (operands[3]))
+   /* Ensure the mask includes all the bits in SImode.  */
+   && ((INTVAL (operands[3]) & (HOST_WIDE_INT_1U << 31)) != 0)"
   [(set (match_dup 0) (plus:DI (ashift:DI (match_dup 1) (match_dup 2)) 
(match_dup 4)))
(set (match_dup 0) (zero_extend:DI (subreg:SI (match_dup 0) 0)))])
 
diff --git a/gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c 
b/gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c
new file mode 100644
index ..303f3cbb8630
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zba -mabi=lp64" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */
+
+long long sub (unsigned long long a, unsigned long long b)
+{
+  b = (b << 50) >> 49;
+  unsigned int x = a + b;
+  return x;
+}
+
+/* { dg-final { scan-assembler-not {\msh1add} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c 
b/gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c
new file mode 100644
index ..883cce271ca1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c
@@ -0,0 +1,21 @@
+/* { dg-do run { target { rv64 } } } */
+/* { dg-options "-march=rv64gc_zba -mabi=lp64d -O2" } */
+
+struct {
+  unsigned a : 14;
+  unsigned b : 3;
+} c;
+
+unsigned long long d;
+void e (unsigned long long *f, long p2) { *f = p2; }
+signed g;
+long i;
+
+int main () {
+  c.b = 4;
+  i = -(-c.a - (3023282U + c.a + g));
+  e (&d, i);
+  if (d != 3023282)
+__builtin_abort ();
+  __builtin_exit (0);
+}


[gcc r15-9302] gccrs: Rename label getter to unchecked

2025-04-10 Thread Arthur Cohen via Gcc-cvs
https://gcc.gnu.org/g:8885e9e109b664977479b23d8b976fdfaa576665

commit r15-9302-g8885e9e109b664977479b23d8b976fdfaa576665
Author: Pierre-Emmanuel Patry 
Date:   Thu Apr 3 15:43:40 2025 +0200

gccrs: Rename label getter to unchecked

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::visit): Update label
getter call.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc (BreakExpr::as_string): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* ast/rust-expr.h: Add optional getter and rename label getter to
get_label_unchecked.

Signed-off-by: Pierre-Emmanuel Patry 

Diff:
---
 gcc/rust/ast/rust-ast-collector.cc  | 2 +-
 gcc/rust/ast/rust-ast-visitor.cc| 2 +-
 gcc/rust/ast/rust-ast.cc| 2 +-
 gcc/rust/ast/rust-expr.h| 7 +--
 gcc/rust/hir/rust-ast-lower-expr.cc | 2 +-
 gcc/rust/resolve/rust-ast-resolve-expr.cc   | 2 +-
 gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 2 +-
 7 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-collector.cc 
b/gcc/rust/ast/rust-ast-collector.cc
index 165b7617fe4a..8ee63752f325 100644
--- a/gcc/rust/ast/rust-ast-collector.cc
+++ b/gcc/rust/ast/rust-ast-collector.cc
@@ -1287,7 +1287,7 @@ TokenCollector::visit (BreakExpr &expr)
 {
   push (Rust::Token::make (BREAK, expr.get_locus ()));
   if (expr.has_label ())
-visit (expr.get_label ());
+visit (expr.get_label_unchecked ());
   if (expr.has_break_expr ())
 visit (expr.get_break_expr ());
 }
diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc
index 702a176b266a..9d524c3cc4c8 100644
--- a/gcc/rust/ast/rust-ast-visitor.cc
+++ b/gcc/rust/ast/rust-ast-visitor.cc
@@ -486,7 +486,7 @@ DefaultASTVisitor::visit (AST::BreakExpr &expr)
 {
   visit_outer_attrs (expr);
   if (expr.has_label ())
-visit (expr.get_label ());
+visit (expr.get_label_unchecked ());
 
   if (expr.has_break_expr ())
 visit (expr.get_break_expr ());
diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc
index 670e6d2413d1..06e0e7b0fbc6 100644
--- a/gcc/rust/ast/rust-ast.cc
+++ b/gcc/rust/ast/rust-ast.cc
@@ -2183,7 +2183,7 @@ BreakExpr::as_string () const
   std::string str ("break ");
 
   if (has_label ())
-str += get_label ().as_string () + " ";
+str += get_label_unchecked ().as_string () + " ";
 
   if (has_break_expr ())
 str += break_expr->as_string ();
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 4c832f9a06f4..84cdfdb46780 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -2982,8 +2982,11 @@ public:
 outer_attrs = std::move (new_attrs);
   }
 
-  LoopLabel &get_label () { return label.value (); }
-  const LoopLabel &get_label () const { return label.value (); }
+  LoopLabel &get_label_unchecked () { return label.value (); }
+  const LoopLabel &get_label_unchecked () const { return label.value (); }
+
+  tl::optional &get_label () { return label; }
+  const tl::optional &get_label () const { return label; }
 
   Expr::Kind get_expr_kind () const override { return Expr::Kind::Break; }
 
diff --git a/gcc/rust/hir/rust-ast-lower-expr.cc 
b/gcc/rust/hir/rust-ast-lower-expr.cc
index 944c0bbf4d15..3784e744f654 100644
--- a/gcc/rust/hir/rust-ast-lower-expr.cc
+++ b/gcc/rust/hir/rust-ast-lower-expr.cc
@@ -599,7 +599,7 @@ ASTLoweringExpr::visit (AST::BreakExpr &expr)
 {
   tl::optional break_label = tl::nullopt;
   if (expr.has_label ())
-break_label = lower_lifetime (expr.get_label ().get_lifetime ());
+break_label = lower_lifetime (expr.get_label_unchecked ().get_lifetime ());
 
   HIR::Expr *break_expr
 = expr.has_break_expr ()
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc 
b/gcc/rust/resolve/rust-ast-resolve-expr.cc
index 54d92854128c..8070fc1b07cc 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc
@@ -471,7 +471,7 @@ ResolveExpr::visit (AST::BreakExpr &expr)
 {
   if (expr.has_label ())
 {
-  auto label = expr.get_label ().get_lifetime ();
+  auto label = expr.get_label_unchecked ().get_lifetime ();
   if (label.get_lifetime_type () != AST::Lifetime::LifetimeType::NAMED)
{
  rust_error_at (label.get_locus (),
diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc 
b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
index b22be2a1a2d1..f743e1e03f34 100644
--- a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
@@ -188,7 +188,7 @@ void
 Late::visit (AST::BreakExpr &expr)
 {
   if (expr.has_label ())
-resolve_label (expr.get_label

[gcc/aoliva/heads/testme] (363 commits) [testsuite] [ppc] use dg-do-if in vec-mul.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 a5556692adac... [testsuite] [ppc] use dg-do-if in vec-mul.c

It previously pointed to:

 1a1cadba643d... [testsuite] [riscv] limit vwaddsub-1.c to rv64

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  1a1cadb... [testsuite] [riscv] limit vwaddsub-1.c to rv64
  5d5cf8e... [testsuite] [riscv] limit mcpu-xiangshan-nanhu.c to rv64
  2653791... [testsuite] [riscv] xfail some [PR113281] tests
  79f6390... [testsuite] [riscv] xfail update-threading on riscv [PR1106
  c4601db... [testsuite] [riscv] xfail ssa-dom-cse-2 on riscv64


Summary of changes (added commits):
---

  a555669... [testsuite] [ppc] use dg-do-if in vec-mul.c
  edcce17... [testsuite] [ppc] require ifunc for target_clones test
  4f7f491... [testsuite] [ppc] adjust vsx-builtin-7.c xxpermdi count for
  b7c549d... [testsuite] [ppc] require vsx for vec-cmpne tests
  cad5de7... [testsuite] [ppc] tolerate -mfloat128 warning in pr99708.c
  19953f0... [testsuite] [ppc] allow implicit fuction declarations in pr
  ae68f0f... [testsuite] [ppc] add -mfloat128 to pr67808.c
  8e55b1c... [testsuite] [ppc] add -mdejagnu-cpu=power7 to pr17381.c
  d6bd882... [testsuite] [ppc] add -mno-strict-align to pr111449-1.c
  1484e4c... [testsuite] [ppc] add -maltivec to pr111380-2.c
  99caade... [testsuite] [ppc] skip -msoft-float tests when testing with
  750f45c... [testsuite] [ppc] disable -mpowerpc64 for various ilp32 asm
  8dd47ff... [testsuite] [ppc] newlib sets FE_VXSOFT on raise FE_INVALID
  7e3b458... [testsuite] [ppc] block-cmp-8 should require powerpc64
  8af5f7b... [testsuite] [ppc] add -mfloat128 to __ieee128-using bfp tes
  7375e3e... [testsuite] [ppc] xfail pr52451.c on ppc [PR58684]
  9e6f595... [testsuite] [ppc] pr87600, pr89313: test for __PPC__ as wel
  6b8e609... [testsuite] [ppc] ipa-sra-19.c: pass -Wno-psabi on powerpc-
  ee34cca... [testsuite] [ppc] require float128 available for copysign
  ade8fda... [testsuite] [ppc] compile [PR112822] with -mvsx
  5957b99... c++: nested lambda capture pack [PR119345] (*)
  733a6a4... libgomp: Update SVE tests (*)
  493974a... c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687] (*)
  1f32b87... c++: Use G_ instead of _ around cp/errors.cc gcc-internal-f (*)
  bb323ec... libstdc++: Adjust value of __cpp_lib_constrained_equality f (*)
  6fd19b2... Darwin, libgcobol: Enable for x86_64 Darwin. (*)
  6ddcbb3... cobol: New testcases for reference modification. (*)
  39892d9... c++: lambda in constraint of lambda [PR119175] (*)
  911973a... libbacktrace: Add hpux fileline support (*)
  a5a7233... hpux: Remove _GLIBCXX_USE_LONG_LONG define from hpux os_def (*)
  8c703f6... Darwin: Add spec substitution for static-libgcobol. (*)
  bf812c6... middle-end/119706 - allow POLY_INT_CST as is_gimple_mem_ref (*)
  95f1097... libgcobol: Allow libgcobol to use libquadmath [PR119244]. (*)
  f1e82c8... testsuite, cobol: Add libquadmath paths. (*)
  4c8c373... Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399] (*)
  72dff34... RISC-V: Fix the behavior for multilib-generator with --cmod (*)
  9e48698... RISC-V: Include local riscv_vector.h in testsuite (*)
  6284f55... Daily bump. (*)
  d69f73c... libstdc++: Fix constraint recursion in basic_const_iterator (*)
  f3862ab... c++: ICE with nested default targ lambdas [PR119574] (*)
  6704d95... cobol: Proper comparison of alphanumeric to refmoded numeri (*)
  f7738c3... pretty-print: Fix format specifier description (*)
  76b267b... modula2: FIx a comment typo (*)
  e081ced... libquadmath: Fix up THREEp96 constant in expq (*)
  4203060... h8300: Fix up bit test and jump splitter [PR119664] (*)
  101ac9e... Update gcc de.po (*)
  76d902a... aarch64: Add sve testcase for PR 116595 [PR116595] (*)
  cee353c... d: Fix forward referenced enums missing type names in debug (*)
  8df0de9... Update gcc.po files (*)
  3345451... Fortran: fix issue with impure elemental subroutine and int (*)
  4645d09... [RISC-V] Fix more fallout from combine.c changes (*)
  3aca82b... testsuite/x86: Correctly escape asterisk in scan-assembler (*)
  9ea6bda... deref-before-check-pr113253.c: Fix bogus warnings on lp32 (*)
  0f74d1e... [committed][RISC-V] Adjust expected output for rvv test (*)
  39deb26... riscv: Fix r15-9270 fallout on RISC-V (*)
  07d... rtl-optimization/119689 - compare-debug failure with LRA (*)
  3e3b665... d: Use CONSTRUCTOR_ZERO_PADDING_BITS in the D FE [PR117832] (*)
  24d1832... Revert "RISC-V: Refine the testcases for cond_widen_complic (*)
  6e77a83... libcpp: Fix error recovery after use of __VA_ARGS__ as macr (*)
  ac1044d... testsuite: Add -mabi to pr116595.C (*)
  f183ae0... expr: Use constant_lower_bound classifying constructor els  (*)
  ee65440... Fortran:  Fix some problems with the reduce intrinsic [PR11 (*)
  faff254... bootstrap/119680 - fix cross-compiler build with --enable-h (

[gcc/aoliva/heads/testbase] (343 commits) c++: nested lambda capture pack [PR119345]

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 5957b9919c9e... c++: nested lambda capture pack [PR119345]

It previously pointed to:

 5ac4be28822a... c++: optimize push_to_top_level [PR64500]

Diff:

Summary of changes (added commits):
---

  5957b99... c++: nested lambda capture pack [PR119345] (*)
  733a6a4... libgomp: Update SVE tests (*)
  493974a... c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687] (*)
  1f32b87... c++: Use G_ instead of _ around cp/errors.cc gcc-internal-f (*)
  bb323ec... libstdc++: Adjust value of __cpp_lib_constrained_equality f (*)
  6fd19b2... Darwin, libgcobol: Enable for x86_64 Darwin. (*)
  6ddcbb3... cobol: New testcases for reference modification. (*)
  39892d9... c++: lambda in constraint of lambda [PR119175] (*)
  911973a... libbacktrace: Add hpux fileline support (*)
  a5a7233... hpux: Remove _GLIBCXX_USE_LONG_LONG define from hpux os_def (*)
  8c703f6... Darwin: Add spec substitution for static-libgcobol. (*)
  bf812c6... middle-end/119706 - allow POLY_INT_CST as is_gimple_mem_ref (*)
  95f1097... libgcobol: Allow libgcobol to use libquadmath [PR119244]. (*)
  f1e82c8... testsuite, cobol: Add libquadmath paths. (*)
  4c8c373... Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399] (*)
  72dff34... RISC-V: Fix the behavior for multilib-generator with --cmod (*)
  9e48698... RISC-V: Include local riscv_vector.h in testsuite (*)
  6284f55... Daily bump. (*)
  d69f73c... libstdc++: Fix constraint recursion in basic_const_iterator (*)
  f3862ab... c++: ICE with nested default targ lambdas [PR119574] (*)
  6704d95... cobol: Proper comparison of alphanumeric to refmoded numeri (*)
  f7738c3... pretty-print: Fix format specifier description (*)
  76b267b... modula2: FIx a comment typo (*)
  e081ced... libquadmath: Fix up THREEp96 constant in expq (*)
  4203060... h8300: Fix up bit test and jump splitter [PR119664] (*)
  101ac9e... Update gcc de.po (*)
  76d902a... aarch64: Add sve testcase for PR 116595 [PR116595] (*)
  cee353c... d: Fix forward referenced enums missing type names in debug (*)
  8df0de9... Update gcc.po files (*)
  3345451... Fortran: fix issue with impure elemental subroutine and int (*)
  4645d09... [RISC-V] Fix more fallout from combine.c changes (*)
  3aca82b... testsuite/x86: Correctly escape asterisk in scan-assembler (*)
  9ea6bda... deref-before-check-pr113253.c: Fix bogus warnings on lp32 (*)
  0f74d1e... [committed][RISC-V] Adjust expected output for rvv test (*)
  39deb26... riscv: Fix r15-9270 fallout on RISC-V (*)
  07d... rtl-optimization/119689 - compare-debug failure with LRA (*)
  3e3b665... d: Use CONSTRUCTOR_ZERO_PADDING_BITS in the D FE [PR117832] (*)
  24d1832... Revert "RISC-V: Refine the testcases for cond_widen_complic (*)
  6e77a83... libcpp: Fix error recovery after use of __VA_ARGS__ as macr (*)
  ac1044d... testsuite: Add -mabi to pr116595.C (*)
  f183ae0... expr: Use constant_lower_bound classifying constructor els  (*)
  ee65440... Fortran:  Fix some problems with the reduce intrinsic [PR11 (*)
  faff254... bootstrap/119680 - fix cross-compiler build with --enable-h (*)
  2d7e1d6... Fortran: Add code gen for do,concurrent's LOCAL/LOCAL_INIT  (*)
  94438ca... c++: lambda in concept [PR118698] (*)
  6ed8c17... LoongArch: Fix awk / sed usage for compatibility (*)
  ca4e6e6... Daily bump. (*)
  ed14cb2... testsuite: Update guality XFAILs for aarch64 (*)
  c3e1c23... testsuite: Fix gcc.dg/vect/pr99102.c command line (*)
  5c06ad9... Doc: Copy-edit text about -Wno-xxx [PR90468] (*)
  7767158... libphobos: Merge with upstream phobos 35977c802 (*)
  6393761... d: Fix infinite loop in isAliasThisTuple (*)
  1b5b02b... cobol: Further fixes for cobol cross-compilation from 32-bi (*)
  04918a2... simplify-rtx: Fix up POPCOUNT optimization [PR119672] (*)
  a3382d9... c: fix checking for a tag for variably modified tagged type (*)
  0f77d88... OpenMP: Fix append_args handling in modify_call_for_omp_dis (*)
  d034c78... c++: self-dependent alias template [PR117530] (*)
  f53c5cd... riscv: Fix a typo in config/riscv/freebsd.h [PR119678] (*)
  54ab0f6... GCN, nvptx: Define '_Unwind_RaiseException', '_Unwind_Resum (*)
  815abd6... GCN, nvptx: Define '_Unwind_DeleteException' (*)
  175016d... nvptx: In offloading compilation, special-case certain host (*)
  649b3cf... libgomp: Add -Wno-c-binding-type for omp_lib.f90 compilatio (*)
  1a8e821... cse: Fix up delete_trivially_dead_insns [PR119594] (*)
  15baa00... lto: Add & ~CF_SET into lto-opts.cc [PR119625] (*)
  29ed336... gccrs: nr2.0: Adjust test macro6.rs (*)
  df45e75... gccrs: nr2.0: Adjust test issue-2812.rs (*)
  a75a697... gccrs: fix ICE segfault with empty feature gate (*)
  8885e9e... gccrs: Rename label getter to unchecked (*)
  c4ec1bc... gccrs: Rename label getter in ContinueExpr (*)
  3790827... gccrs: Change optional to expected for parse_loop_label (*)
  7ae9586... gccrs: Adapt testcase to name resolution 2.0 (*)
  fb890c

[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] ipa-sra-19.c: pass -Wno-psabi on powerpc-*-elf as well

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:6b8e6096b5f86a4f4076c7dce3ab688af4eea7b4

commit 6b8e6096b5f86a4f4076c7dce3ab688af4eea7b4
Author: Alexandre Oliva 
Date:   Thu Apr 10 16:51:01 2025 -0300

[testsuite] [ppc] ipa-sra-19.c: pass -Wno-psabi on powerpc-*-elf as well

Like other ppc targets, powerpc-*-elf needs -Wno-psabi to compile
gcc.dg/ipa/ipa-sra-19.c without an undesired warning about vector
argument passing.


for  gcc/testsuite/ChangeLog

* gcc.dg/ipa/ipa-sra-19.c: Add -Wno-psabi on ppc-elf too.

Diff:
---
 gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c 
b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c
index c34c89eeacad..39874addfdb0 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2"  } */
 /* { dg-additional-options "-msse2" { target ia32 } } */
-/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* 
powerpc-wrs-vxworks* } } */
+/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* 
powerpc-wrs-vxworks* powerpc-*-elf } } */
 
 typedef int __attribute__((__vector_size__(16))) vectype;


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] newlib sets FE_VXSOFT on raise FE_INVALID

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:8dd47ffbe849b33f569dac943a36706c3fb79978

commit 8dd47ffbe849b33f569dac943a36706c3fb79978
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:04:34 2025 -0300

[testsuite] [ppc] newlib sets FE_VXSOFT on raise FE_INVALID

The implementation of the fe*except primitives in newlib sets the
FE_VXSOFT bit when raising FE_INVALID, and the test doesn't expect
that.  Skip it: the tested builtin expansions are for glibc only
anyway.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-2.c:
Skip on newlib/ppc.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/gcc/testsuite/gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-2.c 
b/gcc/testsuite/gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-2.c
index 28c2a00ec520..b9260a123d77 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-2.c
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-require-effective-target fenv_exceptions } */
 /* { dg-options "-lm -fno-builtin" } */
+/* { dg-skip-if "raise FE_INVALID sets FE_VXSOFT on newlib" { powerpc*-*-e* } 
} */
 
 /* This testcase ensures that the builtins are correctly expanded and match the
expected result.


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] compile [PR112822] with -mvsx

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:ade8fda5115643835b2f4d2e7b4a2049e0ad

commit ade8fda5115643835b2f4d2e7b4a2049e0ad
Author: Alexandre Oliva 
Date:   Thu Apr 10 16:47:03 2025 -0300

[testsuite] [ppc] compile [PR112822] with -mvsx

g++.dg/pr112822.C uses altivec vectors explicitly, but it expects this
feature to be enabled by default on targets that recognize the
attribute, which is not a given on older ppc cpus, where the compiler
recommends recompiling with -mvsx.

Since it's just a compilation test, we don't seem to need to test for
e.g. assembler support.


for  gcc/testsuite/ChangeLog

PR tree-optimization/112822
* g++.dg/pr112822.C: Compile with -mvsx on ppc.

Diff:
---
 gcc/testsuite/g++.dg/pr112822.C | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/g++.dg/pr112822.C b/gcc/testsuite/g++.dg/pr112822.C
index a8557522467d..9ec5707eb4c4 100644
--- a/gcc/testsuite/g++.dg/pr112822.C
+++ b/gcc/testsuite/g++.dg/pr112822.C
@@ -1,6 +1,8 @@
 /* PR tree-optimization/112822 */
 /* { dg-do compile { target c++17 } } */
 /* { dg-options "-w -O2" } */
+/* Required for altivec double vectors.  */
+/* { dg-additional-options "-mvsx" { target powerpc*-*-* } } */
 
 /* Verify we do not ICE on the following noisy creduced test case.  */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] require float128 available for copysign

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:ee34ccae9b8a6e949864093fb952eb241a7464ea

commit ee34ccae9b8a6e949864093fb952eb241a7464ea
Author: Alexandre Oliva 
Date:   Thu Apr 10 16:47:28 2025 -0300

[testsuite] [ppc] require float128 available for copysign

The rs6000.md copysign3 expander requires the mode to satisfy
FLOAT128_IEEE_P, so requiring float128 on ppc for ifn_copysign
effective target is hopefully a close-enough approximation.

gcc.dg/fold-copysign-1.c and gcc.dg/pr55152-2.c fail on ppc-elf
without this.


for  gcc/testsuite/ChangeLog

* lib/target-supports.exp (check_effective_target_ifn_copysign):
Require float128 on ppc.

Diff:
---
 gcc/testsuite/lib/target-supports.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ee4138aa6971..1c64472bbc24 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8379,7 +8379,8 @@ proc check_effective_target_ifn_copysign { } {
  && [is-effective-target sse])
 || ([istarget loongarch*-*-*]
 && [check_effective_target_hard_float])
-|| [istarget powerpc*-*-*]
+|| ([istarget powerpc*-*-*]
+&& [check_ppc_float128_sw_available])
 || [istarget alpha*-*-*]
 || [istarget aarch64*-*-*]
 || [is-effective-target arm_neon]


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] xfail pr52451.c on ppc [PR58684]

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:7375e3e2545ec328f9a767e841a47800c1063cd7

commit 7375e3e2545ec328f9a767e841a47800c1063cd7
Author: Alexandre Oliva 
Date:   Thu Apr 10 16:52:29 2025 -0300

[testsuite] [ppc] xfail pr52451.c on ppc [PR58684]

Like pr91323.c, pr52451.c fails on all powerpc variants (except where
already skipped), because it uses fcmpu even when qNaNs should flag FP
exceptions.


for  gcc/testsuite/ChangeLog

PR target/58684
* gcc.dg/torture/pr52451.c: Expect execution fail on
powerpc*-*-*.

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr52451.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/torture/pr52451.c 
b/gcc/testsuite/gcc.dg/torture/pr52451.c
index aa19c1bc39a5..c611aeeb53f8 100644
--- a/gcc/testsuite/gcc.dg/torture/pr52451.c
+++ b/gcc/testsuite/gcc.dg/torture/pr52451.c
@@ -1,4 +1,5 @@
-/* { dg-do run } */
+/* { dg-do run { xfail powerpc*-*-* } } */
+/* remove the xfail for powerpc when pr58684 is fixed */
 /* { dg-add-options ieee } */
 /* { dg-require-effective-target fenv_exceptions_long_double } */
 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] block-cmp-8 should require powerpc64

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:7e3b45891114fb62ea5160594aee74f830030d9d

commit 7e3b45891114fb62ea5160594aee74f830030d9d
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:03:48 2025 -0300

[testsuite] [ppc] block-cmp-8 should require powerpc64

gcc.target/powerpc/block-cmp-8.c is an execution test on ilp32.  It
tests for support for the 64-bit ISA in the compiler, but not for the
ability to execute powerpc64 instructions, so the test fails on 32-bit
hardware.  Require powerpc64 instead.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/block-cmp-8.c: Require powerpc64
instruction execution support.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/block-cmp-8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c 
b/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c
index 22a48c8fadfc..0f353338 100644
--- a/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c
@@ -1,6 +1,6 @@
 /* { dg-do run { target ilp32 } } */
 /* { dg-options "-O2 -mpowerpc64" } */
-/* { dg-require-effective-target has_arch_ppc64 } */
+/* { dg-require-effective-target powerpc64 } */
 /* { dg-timeout-factor 2 } */
 
 /* Verify memcmp on m32 mpowerpc64 */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] pr87600, pr89313: test for __PPC__ as well

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:9e6f595818a2ba860a220627aa45c1492954be75

commit 9e6f595818a2ba860a220627aa45c1492954be75
Author: Alexandre Oliva 
Date:   Thu Apr 10 16:51:45 2025 -0300

[testsuite] [ppc] pr87600, pr89313: test for __PPC__ as well

gcc.dg/pr87600.h and gcc.dg/pr89313.c test for __powerpc__ and
__POWERPC__ to choose ppc register names, but ppc-elf defines neither;
it defines __PPC__, so test for that as well.


for  gcc/testsuite/ChangeLog

* pr87600.h (REG1, REG2): Test for __PPC__ as well.
* pr89313.c (REG): Likewise.

Diff:
---
 gcc/testsuite/gcc.dg/pr87600.h | 2 +-
 gcc/testsuite/gcc.dg/pr89313.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/pr87600.h b/gcc/testsuite/gcc.dg/pr87600.h
index af91f6345cd4..c89071eb7891 100644
--- a/gcc/testsuite/gcc.dg/pr87600.h
+++ b/gcc/testsuite/gcc.dg/pr87600.h
@@ -7,7 +7,7 @@
 #elif defined (__i386__)
 # define REG1 "%eax"
 # define REG2 "%edx"
-#elif defined (__powerpc__) || defined (__POWERPC__)
+#elif defined (__powerpc__) || defined (__POWERPC__) || defined (__PPC__)
 # define REG1 "r3"
 # define REG2 "r4"
 #elif defined (__s390__)
diff --git a/gcc/testsuite/gcc.dg/pr89313.c b/gcc/testsuite/gcc.dg/pr89313.c
index 76cb0910b967..7de64da6f5b5 100644
--- a/gcc/testsuite/gcc.dg/pr89313.c
+++ b/gcc/testsuite/gcc.dg/pr89313.c
@@ -8,7 +8,7 @@
 # define REG "r0"
 #elif defined (__i386__)
 # define REG "%eax"
-#elif defined (__powerpc__) || defined (__POWERPC__)
+#elif defined (__powerpc__) || defined (__POWERPC__) || defined (__PPC__)
 # define REG "r3"
 #elif defined (__s390__)
 # define REG "0"


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] add -mdejagnu-cpu=power7 to pr17381.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:8e55b1cb5fddb7f8cd8772ca47d765dc8aee1a2c

commit 8e55b1cb5fddb7f8cd8772ca47d765dc8aee1a2c
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:21:09 2025 -0300

[testsuite] [ppc] add -mdejagnu-cpu=power7 to pr17381.c

Below power7, it seems to be more profitable to compress the
floating-point constants and use an additional fp register move to
"extend" it.  Only at power7 and above do we keep the constants
separate and load them, getting to the expected 'fmr' count.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/pr17381.c: Compile for power7.  Justify.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr17381.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr17381.c 
b/gcc/testsuite/gcc.target/powerpc/pr17381.c
index e6222c130af1..b137c687776e 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr17381.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr17381.c
@@ -1,6 +1,8 @@
 /* PR target/17381 - Unnecessary register move for float extend */
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-mdejagnu-cpu=power7 -O2" } */
+/* Up to power6, we compress the floating-point constant 1.0 and share it with
+   1.0f, but the float_extend comes out as a second fmr.  */
 
 double d;
 float test1(float fParm)


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] require vsx for vec-cmpne tests

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:b7c549df677728ea642c0330499a771833f07481

commit b7c549df677728ea642c0330499a771833f07481
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:31:00 2025 -0300

[testsuite] [ppc] require vsx for vec-cmpne tests

The gcc.target/powerpc/vec-cmpne.c and .../vec-cmpne-runnable.c tests
need both vsx and vmx support, but vsx is taken for granted, which
doesn't hold on ppc-elf.  Add the appropriate requirements and
options.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/vec-cmpne.c: Require vsx compile-time
support.  Add -mvsx.
* gcc.target/powerpc/vec-cmpne-runnable.c: Require vsx runtime
support.  Add -mvsx.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/vec-cmpne-runnable.c | 3 ++-
 gcc/testsuite/gcc.target/powerpc/vec-cmpne.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cmpne-runnable.c 
b/gcc/testsuite/gcc.target/powerpc/vec-cmpne-runnable.c
index c7fff12c69e0..c072ef16b1c0 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cmpne-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cmpne-runnable.c
@@ -1,6 +1,7 @@
 /* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
 /* { dg-require-effective-target vmx_hw } */
-/* { dg-options "-maltivec -O2 " } */
+/* { dg-options "-mvsx -maltivec -O2 " } */
 
 /* Test that the vec_cmpne builtin works as expected.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c 
b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c
index ad93abdb9c37..248981ddcea1 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-maltivec -O2" } */
+/* { dg-options "-mvsx -maltivec -O2" } */
 /* { dg-require-effective-target powerpc_altivec } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
 /* Test that the vec_cmpne builtin generates the expected Altivec
instructions.  */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] tolerate -mfloat128 warning in pr99708.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:cad5de7e6cf5f00ebaeb30f57e2502604b9621f2

commit cad5de7e6cf5f00ebaeb30f57e2502604b9621f2
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:28:34 2025 -0300

[testsuite] [ppc] tolerate -mfloat128 warning in pr99708.c

gcc.target/powerpc/pr99708.c uses -mfloat128, and that causes the
usual "may not be fully supported" warning that we need to prune on
such tests.  Tolerate it.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/pr99708.c: Prune -mfloat128 warning.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr99708.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr99708.c 
b/gcc/testsuite/gcc.target/powerpc/pr99708.c
index 5d2f435a746b..8eb36f5c938f 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr99708.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr99708.c
@@ -2,6 +2,7 @@
 /* { dg-skip-if "" { powerpc*-*-darwin* powerpc-ibm-aix* } } */
 /* { dg-require-effective-target ppc_float128_sw } */
 /* { dg-options "-O2 -mvsx -mfloat128" } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
 /*
  * PR target/99708


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] add -mno-strict-align to pr111449-1.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:d6bd882d36795a34409858cf1f95bbdcdc5f523e

commit d6bd882d36795a34409858cf1f95bbdcdc5f523e
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:18:23 2025 -0300

[testsuite] [ppc] add -mno-strict-align to pr111449-1.c

gcc.target/powerpc/pr111449-1.c's expected results only come about
without strict alignment, so disable it explicitly.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/pr111449-1.c: Add -mno-strict-align.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr111449-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr111449-1.c 
b/gcc/testsuite/gcc.target/powerpc/pr111449-1.c
index e65794c7ae76..1a81befa9689 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr111449-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr111449-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2" } */
+/* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2 -mno-strict-align" } */
 /* { dg-require-effective-target powerpc_vsx } */
 
 /* Ensure vector mode is used for 16-byte by pieces equality compare.  */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] add -mfloat128 to __ieee128-using bfp tests

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:8af5f7b9befb0777144aaf5010dc0d31c4c98bf8

commit 8af5f7b9befb0777144aaf5010dc0d31c4c98bf8
Author: Alexandre Oliva 
Date:   Thu Apr 10 16:52:54 2025 -0300

[testsuite] [ppc] add -mfloat128 to __ieee128-using bfp tests

Some ppc bfp tests use __ieee128 without ensuring it's available.
Require ppc_ieee128_ok, add -mfloat128 to get the type defined,
and tolerate the warning that this option may trigger.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/bfp/scalar-extract-sig-5.c: Require
ppc_ieee128_ok, add -mfloat128, tolerate its warning.
* gcc.target/powerpc/bfp/scalar-insert-exp-11.c: Likewise.
* gcc.target/powerpc/bfp/scalar-insert-exp-8.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-data-class-11.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-neg-5.c: Likewise.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c  | 4 +++-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c  | 4 +++-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c  | 4 +++-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c   | 4 +++-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c | 4 +++-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c | 4 +++-
 6 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c 
b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c
index 672aac7ed373..b3aca034cc0c 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c
@@ -1,7 +1,9 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
-/* { dg-options "-mdejagnu-cpu=power9 -mvsx" } */
+/* { dg-options "-mdejagnu-cpu=power9 -mvsx -mfloat128" } */
 /* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target ppc_ieee128_ok } */
 /* { dg-require-effective-target powerpc_vsx } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
 /* This test only runs on 32-bit configurations, where a compiler error
should be issued because this builtin is not available on
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c 
b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c
index 5b6d763a26f5..97b2b7e9a642 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c
@@ -1,7 +1,9 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
-/* { dg-options "-mdejagnu-cpu=power9 -mvsx" } */
+/* { dg-options "-mdejagnu-cpu=power9 -mvsx -mfloat128" } */
 /* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target ppc_ieee128_ok } */
 /* { dg-require-effective-target powerpc_vsx } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
 /* This test only runs on 32-bit configurations, producing a compiler
error because the builtin requires 64 bits.  */
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c 
b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c
index 3a0529ed9a1b..3a556740516f 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c
@@ -1,7 +1,9 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
-/* { dg-options "-mdejagnu-cpu=power9 -mvsx" } */
+/* { dg-options "-mdejagnu-cpu=power9 -mvsx -mfloat128" } */
 /* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target ppc_ieee128_ok } */
 /* { dg-require-effective-target powerpc_vsx } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
 /* This test only runs on 32-bit configurations, where a compiler error
should be issued because this builtin is not available on
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c 
b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c
index d9984c7678f3..9427f89d18f2 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c
@@ -1,7 +1,9 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
-/* { dg-options "-mdejagnu-cpu=power9 -mvsx" } */
+/* { dg-options "-mdejagnu-cpu=power9 -mvsx -mfloat128" } */
 /* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target ppc_ieee128_ok } */
 /* { dg-require-effective-target powerpc_vsx } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
 /* This test only runs on 32-bit configurations, where a compiler error
should be issued because this builtin is not available on
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c 
b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
index 8da98569de8a..132058304cd

[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] skip -msoft-float tests when testing with -mhard-float

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:99caade8d670158c89a698e10b9b2f1d7762cc2e

commit 99caade8d670158c89a698e10b9b2f1d7762cc2e
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:17:24 2025 -0300

[testsuite] [ppc] skip -msoft-float tests when testing with -mhard-float

Testing ppc-elf with -mhard-float conflicts with explicit -msoft-float
in gcc.target/powerpc/ppc-fma-6.c and gcc.target/powerpc/pr105334.c.
Skip these tests under -mhard-float.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/ppc-fma-6.c: Skip on -mhard-float.
* gcc.target/powerpc/pr105334.c: Likewise.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/ppc-fma-6.c | 1 +
 gcc/testsuite/gcc.target/powerpc/pr105334.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fma-6.c 
b/gcc/testsuite/gcc.target/powerpc/ppc-fma-6.c
index 9d6c15300970..f29d84545e87 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-fma-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-fma-6.c
@@ -4,6 +4,7 @@
 /* { dg-options "-O2 -mdejagnu-cpu=power5 -std=c99 -msoft-float" } */
 /* { dg-final { scan-assembler-not "fmadd" } } */
 /* { dg-final { scan-assembler-not "xsfmadd" } } */
+/* { dg-skip-if "" { *-*-* } { "-mhard-float" } } */
 
 /* Test whether -msoft-float turns off the macros math.h uses for
FP_FAST_FMA{,F,L}.  */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr105334.c 
b/gcc/testsuite/gcc.target/powerpc/pr105334.c
index 7664e033dd0d..2d7a1a8e50ba 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr105334.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr105334.c
@@ -2,6 +2,7 @@
incompatible and warns it.  */
 /* { dg-skip-if "aix long-double-128 soft-float" { powerpc*-*-aix* } } */
 /* { dg-options "-mlong-double-128 -msoft-float" } */
+/* { dg-skip-if "" { *-*-* } { "-mhard-float" } } */
 
 /* Verify there is no ICE.  */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] disable -mpowerpc64 for various ilp32 asm-out checks

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:750f45c7814968f41142c83ce30719c89eadf9f2

commit 750f45c7814968f41142c83ce30719c89eadf9f2
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:04:58 2025 -0300

[testsuite] [ppc] disable -mpowerpc64 for various ilp32 asm-out checks

Multiple tests on ilp32 get TARGET_POWERPC64 enabled by -mdejagnu-cpu
options, but the results they expect are only attained without
enabling it, so disable it explicitly.


for  gcc/testsuite/ChangeLog

* gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-2.c:
Compile with -mno-powerpc64 on ilp32.
* gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-2.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-5.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/builtins-1.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/loop_align.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/ppc-target-4.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/pr79251.p7.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/pr79251.p8.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/pr79251.p9.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/pr96933-2.c: Likewise.
* gcc/testsuite/gcc.target/powerpc/vsu/vec-xl-len-13.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/vsu/vec-xst-len-13.c:
Likewise.
* gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c: Likewise.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-2.c | 2 +-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-2.c  | 2 +-
 gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-5.c  | 2 +-
 gcc/testsuite/gcc.target/powerpc/builtins-1.c   | 2 ++
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c | 3 ++-
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c   | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c   | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c| 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c| 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c  | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c  | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c  | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c| 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c| 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c  | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c | 1 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-ins

[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] add -maltivec to pr111380-2.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:1484e4c67c3f6822e3e41e420cdfa8c518b9abfb

commit 1484e4c67c3f6822e3e41e420cdfa8c518b9abfb
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:18:00 2025 -0300

[testsuite] [ppc] add -maltivec to pr111380-2.c

gcc.target/powerpc/pr111380-2.c requires altivec to be enabled to hit
the expected option mismatch and inline error, so enable it after
checking for compiler support.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/pr111380-2.c: Add -maltivec, require it.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr111380-2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr111380-2.c 
b/gcc/testsuite/gcc.target/powerpc/pr111380-2.c
index 7b363940643b..bf7cb3a5c8bf 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr111380-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr111380-2.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target vect_int } */
-/* { dg-options "-O2 -mno-vsx" } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O2 -mno-vsx -maltivec" } */
 
 /* Verify it emits error message on inlining even without LTO.  */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] allow implicit fuction declarations in pr92661.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:19953f014038b061e7b272e489540080ea8cabc4

commit 19953f014038b061e7b272e489540080ea8cabc4
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:28:09 2025 -0300

[testsuite] [ppc] allow implicit fuction declarations in pr92661.c

gcc.target/powerpc/pr92661.c expects and tolerates errors about dfp
builtins when dfp is not supported, but the C front end no longer
accepts calls of undeclared functions by default, even with -w.
Adding -fpermissive would do, but I thought it would be too broad, so
I went for -Wno-error=implicit-function-declaration.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/pr92661.c: Allow implicit function decls.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr92661.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr92661.c 
b/gcc/testsuite/gcc.target/powerpc/pr92661.c
index d9500dbfdb71..0eb3c654d2d3 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr92661.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr92661.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-w -O2 -mdejagnu-cpu=power9" } */
+/* { dg-options "-w -O2 -mdejagnu-cpu=power9 
-Wno-error=implicit-function-declaration" } */
 
 /* PR92661: The following tests should not ICE, regardless of
whether the target supports DFP or not.  */


[gcc r15-9323] Daily bump.

2025-04-10 Thread GCC Administrator via Gcc-cvs
https://gcc.gnu.org/g:ca4e6e6317ae0ceada8c46ef5db5ece165a6d1c4

commit r15-9323-gca4e6e6317ae0ceada8c46ef5db5ece165a6d1c4
Author: GCC Administrator 
Date:   Wed Apr 9 00:18:02 2025 +

Daily bump.

Diff:
---
 gcc/ChangeLog   |  80 
 gcc/DATESTAMP   |   2 +-
 gcc/c/ChangeLog |   9 ++
 gcc/cobol/ChangeLog |  18 +++
 gcc/cp/ChangeLog|   6 +
 gcc/d/ChangeLog |   4 +
 gcc/rust/ChangeLog  | 319 
 gcc/testsuite/ChangeLog | 145 ++
 libgcc/ChangeLog|  12 ++
 libgomp/ChangeLog   |  23 
 libphobos/ChangeLog |   7 ++
 libstdc++-v3/ChangeLog  |   8 ++
 12 files changed, 632 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cd6efd2a2684..a3e03331bf70 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,83 @@
+2025-04-08  Sandra Loosemore  
+
+   PR c++/90468
+   * doc/invoke.texi (Warning Options): Clean up text describing
+   -Wno-xxx.
+
+2025-04-08  Jakub Jelinek  
+
+   PR rtl-optimization/119672
+   * simplify-rtx.cc (simplify_context::simplify_relational_operation_1):
+   For POPCOUNT == 0 or != 0 optimizations use
+   CONST0_RTX (GET_MODE (XEXP (op0, 0))) rather than const0_rtx.
+
+2025-04-08  Tobias Burnus  
+
+   PR middle-end/119662
+   * gimplify.cc (modify_call_for_omp_dispatch): Fix GOMP_interop
+   arg passing; add location info to function calls.
+
+2025-04-08  Jakub Jelinek  
+
+   PR target/119678
+   * config/riscv/freebsd.h (LINK_SPEC): Use FBSD_LINK_PG_NOTE rather
+   than non-existing FBSD_LINK_PG_NOTES.
+
+2025-04-08  Thomas Schwinge  
+
+   * config/nvptx/nvptx.cc (nvptx_asm_output_def_from_decls)
+   [!ACCEL_COMPILER]: Don't define label 'emit_ptx_alias'.
+
+2025-04-08  Jakub Jelinek  
+
+   PR rtl-optimization/119594
+   * cse.cc (count_reg_usage): Count even x == dest regs if they have
+   non-zero counts already and incr is positive.
+
+2025-04-08  Jakub Jelinek  
+
+   PR lto/119625
+   * lto-opts.cc (lto_write_options): Mask of CF_SET from
+   global_options.x_flag_cf_protection.
+
+2025-04-08  Tejas Belagod  
+   Andrea Corallo  
+
+   * target.h (type_context_kind): Add new context kinds for target 
clauses.
+   (omp_type_context): Query if the context is of OMP kind.
+   * config/aarch64/aarch64-sve-builtins.cc (verify_type_context): Diagnose
+   SVE types for a given OpenMP context.
+   (omp_type_context): New.
+   * gimplify.cc (omp_notice_variable): Diagnose implicitly-mapped SVE
+   objects in OpenMP regions.
+   (gimplify_scan_omp_clauses): Diagnose SVE types for various target
+   clauses.
+
+2025-04-08  Tejas Belagod  
+
+   * tree.h (strip_pointer_types): New.
+
+2025-04-08  Richard Sandiford  
+   Tejas Belagod  
+
+   PR middle-end/101018
+   * poly-int.h (can_and_p): New function.
+   * fold-const.cc (poly_int_binop): Use it to optimize BIT_AND_EXPRs
+   involving POLY_INT_CSTs.
+   * gimplify.cc (omp_notice_variable): Use poly_int_tree_p instead
+   of INTEGER_CST when checking for constant-sized omp data.
+   (gimplify_adjust_omp_clauses_1): Likewise.
+   (gimplify_adjust_omp_clauses): Likewise.
+   * omp-low.cc (scan_sharing_clauses): Likewise.
+
+2025-04-08  Haochen Jiang  
+
+   * config/i386/i386.h (PTA_DIAMONDRAPIDS): Add PTA_AVX10_1_256.
+
+2025-04-08  Jin Ma  
+
+   * config/riscv/vector.md: Disable vsext/vzext for XTheadVector.
+
 2025-04-07  Iain Sandoe  
 
PR target/113257
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index fd8dd2cde24c..cb38c2c30be3 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250408
+20250409
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 7be4f543e52d..dec9f164aef8 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,12 @@
+2025-04-08  Martin Uecker  
+
+   PR c/119612
+   * c-tree.h (c_type_tag): Add prototype.
+   * c-typeck.cc (c_type_tag): New function.
+   (tagged_types_tu_compatible_p, composite_type_internal): Use
+   c_type_tag.
+   * c-decl.cc (c_struct_hasher::hash, previous_tag): Use c_type_tag.
+
 2025-04-02  Jakub Jelinek  
 
PR c/119582
diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog
index ec3ced680a98..e386591865ed 100644
--- a/gcc/cobol/ChangeLog
+++ b/gcc/cobol/ChangeLog
@@ -1,3 +1,21 @@
+2025-04-08  Jakub Jelinek  
+
+   PR cobol/119364
+   * genapi.cc (function_handle_from_name): Use sizeof_pointer.
+   (parser_file_add): Use int_size_in_bytes(VOID_P) and
+   int_size_in_bytes(int).
+   (inspect_tally): Use int_size_in_bytes(VOID_P).
+   (inspect_replacing): Likewise.
+   (gg_array_of_field_pointers): Likewise.
+   (gg_array_of_file_pointers): Likewise.
+   (parser_set_pointers): Use sizeof_pointer.
+   * cobol1.cc (create_our_type_nodes_init): Use
+

[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] adjust vsx-builtin-7.c xxpermdi count for ilp32

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:4f7f4910c1ef8d90952c9c38e7adf881d4df3e80

commit 4f7f4910c1ef8d90952c9c38e7adf881d4df3e80
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:33:20 2025 -0300

[testsuite] [ppc] adjust vsx-builtin-7.c xxpermdi count for ilp32

gcc.target/powerpc/vsx-builtin-7.c uses fewer xxpermdi insns than
expected on ilp32.  Adjust.


for gcc/testsuite/ChangeLog

* gcc.target/powerpc/vsx-builtin-7.c: Adjust xxpermdi count on
ilp32.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
index 4de240c6a95d..20e4483c1aa7 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
@@ -194,8 +194,9 @@ vector unsigned __int128 splat_uint128 (unsigned __int128 
x) { return vec_splats
 /* { dg-final { scan-assembler-times {\mrldic\M} 0  { target { be && ilp32 } } 
} } */
 /* { dg-final { scan-assembler-times {\mrldic\M} 65 { target { be && lp64 } } 
} } */
 /* { dg-final { scan-assembler-times {\mrldic\M} 65 { target le } } } */
-/* { dg-final { scan-assembler-times "xxpermdi" 33 { target be } } } */
-/* { dg-final { scan-assembler-times "xxpermdi" 35 { target le } } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 32 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 33 { target { be && lp64 } } } 
} */
+/* { dg-final { scan-assembler-times "xxpermdi" 35 { target { le && lp64 } } } 
} */
 /* { dg-final { scan-assembler-times "vspltisb" 2 } } */
 /* { dg-final { scan-assembler-times "vspltish" 2 } } */
 /* { dg-final { scan-assembler-times "vspltisw" 2 { target be } } } */


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] require ifunc for target_clones test

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:edcce170f2a2d281354a46f92cf57134cf5369b3

commit edcce170f2a2d281354a46f92cf57134cf5369b3
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:34:06 2025 -0300

[testsuite] [ppc] require ifunc for target_clones test

gcc.target/powerpc/power11-3.c uses target_clones, that depends on
ifunc.  Require ifunc support.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/power11-3.c: Require ifunc support.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/power11-3.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/gcc.target/powerpc/power11-3.c 
b/gcc/testsuite/gcc.target/powerpc/power11-3.c
index fa1aedd04299..56bf88185983 100644
--- a/gcc/testsuite/gcc.target/powerpc/power11-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c
@@ -1,5 +1,6 @@
 /* { dg-do compile }  */
 /* { dg-options "-mdejagnu-cpu=power8 -O2" }  */
+/* { dg-require-ifunc "" } */
 
 /* Check if we can set the power11 target via a target_clones attribute.  */


[gcc r15-9286] gccrs: nr2.0: Remove duplicate self visit

2025-04-10 Thread Arthur Cohen via Gcc-cvs
https://gcc.gnu.org/g:2f955bea137ac20963f781a22b16ced584e110ff

commit r15-9286-g2f955bea137ac20963f781a22b16ced584e110ff
Author: Owen Avery 
Date:   Tue Apr 1 17:50:32 2025 -0400

gccrs: nr2.0: Remove duplicate self visit

gcc/rust/ChangeLog:

* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Remove explicit visitation of a
function's self parameter, as if it exists it'll be visited as
one of the function parameters.

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: Remove entry.

Signed-off-by: Owen Avery 

Diff:
---
 gcc/rust/ast/rust-ast-visitor.cc   | 2 --
 gcc/testsuite/rust/compile/nr2/exclude | 1 -
 2 files changed, 3 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc
index ba5f87bc2ebb..9a8c24f17d84 100644
--- a/gcc/rust/ast/rust-ast-visitor.cc
+++ b/gcc/rust/ast/rust-ast-visitor.cc
@@ -824,8 +824,6 @@ DefaultASTVisitor::visit (AST::Function &function)
   visit (function.get_qualifiers ());
   for (auto &generic : function.get_generic_params ())
 visit (generic);
-  if (function.has_self_param ())
-visit (function.get_self_param ());
   for (auto ¶m : function.get_function_params ())
 visit (param);
   if (function.has_return_type ())
diff --git a/gcc/testsuite/rust/compile/nr2/exclude 
b/gcc/testsuite/rust/compile/nr2/exclude
index adc199e59e38..76ef39f982d3 100644
--- a/gcc/testsuite/rust/compile/nr2/exclude
+++ b/gcc/testsuite/rust/compile/nr2/exclude
@@ -1,7 +1,6 @@
 canonical_paths1.rs
 cfg1.rs
 generics9.rs
-issue-2043.rs
 issue-2812.rs
 issue-3315-2.rs
 lookup_err1.rs


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [ppc] use dg-do-if in vec-mul.c

2025-04-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:a5556692adac25d7fc097f2973901e25a428184c

commit a5556692adac25d7fc097f2973901e25a428184c
Author: Alexandre Oliva 
Date:   Thu Apr 10 17:34:31 2025 -0300

[testsuite] [ppc] use dg-do-if in vec-mul.c

The overriding of dg-do in gcc.target/powerpc/vec-mul.c I put there
last year didn't quite work.  It needed the newly-added dg-do-if to
work the way I wished.  Fix it, and simplify it.


for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/vec-mul.c: Use dg-do-if to fix and
improve coverage.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/vec-mul.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/vec-mul.c 
b/gcc/testsuite/gcc.target/powerpc/vec-mul.c
index 915c92303274..0c2ffcf46f1a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-mul.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-mul.c
@@ -1,5 +1,5 @@
-/* { dg-do compile { target { { ! vsx_hw } && powerpc_vsx } } } */
-/* { dg-do run { target vsx_hw } } */
+/* { dg-do compile { target powerpc_vsx } } */
+/* { dg-do-if run { target vsx_hw } } */
 /* { dg-options "-mvsx -O3" } */
 
 /* Test that the vec_mul builtin works as expected.  */


[gcc/devel/rust/master] Migrate error state to optionals

2025-04-10 Thread Thomas Schwinge via Gcc-cvs
https://gcc.gnu.org/g:46673ec062176f4c2826dabbde6a401167d73441

commit 46673ec062176f4c2826dabbde6a401167d73441
Author: Pierre-Emmanuel Patry 
Date:   Tue Apr 1 19:55:28 2025 +0200

Migrate error state to optionals

gcc/rust/ChangeLog:

* ast/rust-ast-builder.cc (Builder::self_ref_param): Remove error 
state
and use optional.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check label
before visiting.
* ast/rust-ast.cc (ContinueExpr::as_string): Retrieve label value.
(Lifetime::as_string): Retrieve lifetime value.
(ReferenceType::as_string): Likewise.
(SelfParam::as_string): Likewise.
* ast/rust-ast.h: Remove lifetime and LifetimeParam error state.
* ast/rust-desugar-for-loops.cc 
(DesugarForLoops::DesugarCtx::make_break_arm):
Use optional instead of error state.
* ast/rust-expr.h (class ContinueExpr): Make label optional.
* ast/rust-item.h (class SelfParam): Make lifetime optional.
* ast/rust-type.h (class ReferenceType): Likewise.
* backend/rust-compile-base.cc: Use optional for self param instead
of error state.
* backend/rust-compile-base.h: Update function prototype.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Use optional.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Lower
lifetime only if it exists.
* hir/rust-ast-lower-block.h: Lower loop label only if it exists.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): Remove
references to error state.
(ASTLowerTraitItem::visit): Lower self param only if it exists.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Use nullopt
for default value instead of SelfParam error state.
* hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): Lower 
label
only if it exists.
* hir/rust-hir-dump.cc (Dump::do_traitfunctiondecl): Print self 
only if
it exists.
(Dump::visit): Liewise.
* hir/tree/rust-hir-bound.h: Remove error state.
* hir/tree/rust-hir-expr.cc (ContinueExpr::ContinueExpr): Use 
optional
in constructor for loop label.
(BreakExpr::BreakExpr): Likewise.
* hir/tree/rust-hir-expr.h (class ContinueExpr): Remove error state
implementation.
(class BreakExpr): Likewise.
* hir/tree/rust-hir-generic-param.h: Likewise.
* hir/tree/rust-hir-item.cc (SelfParam::SelfParam): Make lifetime
optional.
(Function::Function): Make self param optional.
* hir/tree/rust-hir-item.h (class Function): Likewise.
* hir/tree/rust-hir-type.cc (ReferenceType::ReferenceType): Make
lifetime optional.
* hir/tree/rust-hir-type.h (class ReferenceType): Likewise.
* hir/tree/rust-hir.cc (ContinueExpr::as_string): Use new getter.
(BreakExpr::as_string): Likewise.
(Lifetime::as_string): Likewise.
(ReferenceType::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(SelfParam::as_string): Remove error state checking.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Adapt to
optional.
(Parser::parse_lifetime_params): Likewise.
(Parser::parse_lifetime_params_objs): Likewise.
(Parser::parse_lifetime_param): Likewise.
(Parser::parse_lifetime_where_clause_item): Likewise.
(Parser::parse_type_param_bound): Likewise.
(Parser::parse_lifetime_bounds): Likewise.
(Parser::parse_path_generic_args): Likewise.
(Parser::parse_self_param): Likewise.
(Parser::parse_break_expr): Likewise.
(Parser::parse_continue_expr): Likewise.
(Parser::parse_reference_type_inner): Likewise.
* parse/rust-parse.h (class ParseLifetimeParamError): Add new class 
for
lifetime param parsing errors.
(class ParseLifetimeError): Add new class for lifetime parsing 
errors.
(enum ParseSelfError): Add new class for self param parsing errors.
* typecheck/rust-hir-type-check-implitem.cc 
(TypeCheckImplItem::visit):
Use unchecked getter in checked context. And make anonymous region.
* typecheck/rust-hir-type-check.cc 
(TraitItemReference::get_type_from_fn):
Likewise.

Signed-off-by: Pierre-Emmanuel Patry 

Diff:
---
 gcc/rust/ast/rust-ast-builder.cc   |   2 +-
 gcc/rust/ast/rust-ast-visitor.cc   |   6 +-
 gcc/rust/ast/rust-ast.cc   |   9 +-
 gcc/rust/ast/rust-ast.

[gcc r15-9369] c++: nested lambda capture pack [PR119345]

2025-04-10 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:5957b9919c9ecda6e4ca198086f8bb9ea215232c

commit r15-9369-g5957b9919c9ecda6e4ca198086f8bb9ea215232c
Author: Jason Merrill 
Date:   Thu Apr 10 14:34:35 2025 -0400

c++: nested lambda capture pack [PR119345]

tsubst_stmt already registers a local capture proxy as a
local_specialization of both an outer capture proxy and the captured
variable; we also need to do that in add_extra_args.

PR c++/119345

gcc/cp/ChangeLog:

* pt.cc (add_extra_args): Also register a specialization
of the captured variable.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-targ14.C: New test.

Diff:
---
 gcc/cp/pt.cc   |  2 ++
 gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C | 12 
 2 files changed, 14 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 805b274069bf..b7060b4c5aa6 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -13748,6 +13748,8 @@ add_extra_args (tree extra, tree args, tsubst_flags_t 
complain, tree in_decl)
  inst = local;
  /* else inst is already a full instantiation of the pack.  */
  register_local_specialization (inst, gen);
+ if (is_normal_capture_proxy (gen))
+   register_local_specialization (inst, DECL_CAPTURED_VARIABLE (gen));
}
   gcc_assert (!TREE_PURPOSE (extra));
   extra = TREE_VALUE (extra);
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C 
b/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C
new file mode 100644
index ..debb15e83f61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C
@@ -0,0 +1,12 @@
+// PR c++/119345
+// { dg-do compile { target c++20 } }
+
+void f(auto... args) {
+  [args...] {
+(..., [args...] { i; });
+  }.template operator()<0>();
+}
+
+int main() {
+  f();
+}


[gcc r15-9270] AArch64: Diagnose OpenMP offloading when SVE types involved.

2025-04-10 Thread Tejas Belagod via Gcc-cvs
https://gcc.gnu.org/g:b9164bd768707c305fb778f74d9d8805ffae1523

commit r15-9270-gb9164bd768707c305fb778f74d9d8805ffae1523
Author: Tejas Belagod 
Date:   Wed Mar 27 15:32:51 2024 +0530

AArch64: Diagnose OpenMP offloading when SVE types involved.

The target clause in OpenMP is used to offload loop kernels to accelarator
peripeherals.  target's 'map' clause is used to move data from and to the
accelarator.  When the data is SVE type, it may not be suitable because of
various reasons i.e. the two SVE targets may not agree on vector size or
some targets don't support variable vector size.  This makes SVE unsuitable
for use in OMP's 'map' clause.  This patch diagnoses all such cases and 
issues
an error where SVE types are not suitable.

Co-authored-by: Andrea Corallo 

gcc/ChangeLog:

* target.h (type_context_kind): Add new context kinds for target 
clauses.
(omp_type_context): Query if the context is of OMP kind.
* config/aarch64/aarch64-sve-builtins.cc (verify_type_context): 
Diagnose
SVE types for a given OpenMP context.
(omp_type_context): New.
* gimplify.cc (omp_notice_variable): Diagnose implicitly-mapped SVE
objects in OpenMP regions.
(gimplify_scan_omp_clauses): Diagnose SVE types for various target
clauses.

Diff:
---
 gcc/config/aarch64/aarch64-sve-builtins.cc | 37 ++-
 gcc/gimplify.cc| 41 +-
 gcc/target.h   | 37 ++-
 3 files changed, 112 insertions(+), 3 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 44e4807325a3..36519262efd5 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -5174,7 +5174,11 @@ bool
 verify_type_context (location_t loc, type_context_kind context,
 const_tree type, bool silent_p)
 {
-  if (!sizeless_type_p (type))
+  const_tree tmp = type;
+  if (omp_type_context (context) && POINTER_TYPE_P (type))
+tmp = strip_pointer_types (tmp);
+
+  if (!sizeless_type_p (tmp))
 return true;
 
   switch (context)
@@ -5234,6 +5238,37 @@ verify_type_context (location_t loc, type_context_kind 
context,
   if (!silent_p)
error_at (loc, "capture by copy of SVE type %qT", type);
   return false;
+
+case TCTX_OMP_MAP:
+  if (!silent_p)
+   error_at (loc, "SVE type %qT not allowed in % clause", type);
+  return false;
+
+case TCTX_OMP_MAP_IMP_REF:
+  if (!silent_p)
+   error ("cannot reference %qT object types in % region", type);
+  return false;
+
+case TCTX_OMP_PRIVATE:
+  if (!silent_p)
+   error_at (loc, "SVE type %qT not allowed in"
+ " % % clause", type);
+  return false;
+
+case TCTX_OMP_FIRSTPRIVATE:
+  if (!silent_p)
+   error_at (loc, "SVE type %qT not allowed in"
+ " % % clause", type);
+  return false;
+
+case TCTX_OMP_DEVICE_ADDR:
+  if (!silent_p)
+   error_at (loc, "SVE type %qT not allowed in"
+ " % device clauses", type);
+  return false;
+
+default:
+  break;
 }
   gcc_unreachable ();
 }
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 55cab7a74a88..51595f6f51e4 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -9222,11 +9222,18 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree 
decl, bool in_code)
  | GOVD_MAP_ALLOC_ONLY)) == flags)
{
  tree type = TREE_TYPE (decl);
+ location_t loc = DECL_SOURCE_LOCATION (decl);
 
  if (gimplify_omp_ctxp->target_firstprivatize_array_bases
  && omp_privatize_by_reference (decl))
type = TREE_TYPE (type);
- if (!omp_mappable_type (type))
+
+ if (!verify_type_context (loc, TCTX_OMP_MAP_IMP_REF, type))
+   /* Check if TYPE can appear in a target region.
+  verify_type_context has already issued an error if it
+  can't.  */
+   nflags |= GOVD_MAP | GOVD_EXPLICIT;
+ else if (!omp_mappable_type (type))
{
  error ("%qD referenced in target region does not have "
 "a mappable type", decl);
@@ -12956,6 +12963,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq 
*pre_p,
   unsigned int flags;
   tree decl;
   auto_vec addr_tokens;
+  tree op = NULL_TREE;
+  location_t loc = OMP_CLAUSE_LOCATION (c);
 
   if (grp_end && c == OMP_CLAUSE_CHAIN (grp_end))
{
@@ -12963,6 +12972,36 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq 
*pre_p,
  grp_end = NULL_TREE;
}
 
+  if (code == OMP_TARGET
+ || code == OMP_TARGET_DATA
+ || co

[gcc r15-9326] Fortran: Add code gen for do, concurrent's LOCAL/LOCAL_INIT [PR101602]

2025-04-10 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:2d7e1d6e40a13a5f160b584336795b80f193ec3b

commit r15-9326-g2d7e1d6e40a13a5f160b584336795b80f193ec3b
Author: Tobias Burnus 
Date:   Wed Apr 9 08:21:19 2025 +0200

Fortran: Add code gen for do,concurrent's LOCAL/LOCAL_INIT [PR101602]

Implement LOCAL and LOCAL_INIT; we locally replace the tree declaration by
a local declaration of the outer variable. The 'local_init' then assigns
the value at the beginning of each loop iteration from the outer
declaration.

Note that the current implementation does not handle LOCAL with types that
have a default initializer and LOCAL/LOCAL_INIT for assumed-shape arrays;
this is diagnosed with a sorry error.

PR fortran/101602

gcc/fortran/ChangeLog:

* resolve.cc (resolve_locality_spec): Remove 'sorry, unimplemented'.
* trans-stmt.cc (struct symbol_and_tree_t): New.
(gfc_trans_concurrent_locality_spec): New.
(gfc_trans_forall_1): Call it; update to handle local and 
local_init.
* trans-decl.cc (gfc_start_saved_local_decls,
gfc_stop_saved_local_decls): New; moved code from ...
(gfc_process_block_locals): ... here. Call it.
* trans.h (gfc_start_saved_local_decls,
gfc_stop_saved_local_decls): Declare.

gcc/testsuite/ChangeLog:

* gfortran.dg/do_concurrent_8_f2023.f90: Update for removed 'sorry,
unimplemented'.
* gfortran.dg/do_concurrent_9.f90: Likewise.
* gfortran.dg/do_concurrent_all_clauses.f90: Likewise.
* gfortran.dg/do_concurrent_local_init.f90: Likewise.
* gfortran.dg/do_concurrent_locality_specs.f90: Likewise.
* gfortran.dg/do_concurrent_11.f90: New test.
* gfortran.dg/do_concurrent_12.f90: New test.
* gfortran.dg/do_concurrent_13.f90: New test.
* gfortran.dg/do_concurrent_14.f90: New test.
* gfortran.dg/do_concurrent_15.f90: New test.

Diff:
---
 gcc/fortran/resolve.cc |   7 -
 gcc/fortran/trans-decl.cc  |  35 ++--
 gcc/fortran/trans-stmt.cc  | 144 +-
 gcc/fortran/trans.h|   2 +
 gcc/testsuite/gfortran.dg/do_concurrent_11.f90 |  53 ++
 gcc/testsuite/gfortran.dg/do_concurrent_12.f90 | 175 +
 gcc/testsuite/gfortran.dg/do_concurrent_13.f90 | 211 +
 gcc/testsuite/gfortran.dg/do_concurrent_14.f90 | 176 +
 gcc/testsuite/gfortran.dg/do_concurrent_15.f90 |  20 ++
 .../gfortran.dg/do_concurrent_8_f2023.f90  |   4 +-
 gcc/testsuite/gfortran.dg/do_concurrent_9.f90  |   2 +-
 .../gfortran.dg/do_concurrent_all_clauses.f90  |   1 -
 .../gfortran.dg/do_concurrent_local_init.f90   |   4 +-
 .../gfortran.dg/do_concurrent_locality_specs.f90   |   3 +-
 14 files changed, 807 insertions(+), 30 deletions(-)

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index cb3658917efb..cdf043b64115 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -8422,13 +8422,6 @@ resolve_locality_spec (gfc_code *code, gfc_namespace *ns)
  plist = &((*plist)->next);
}
 }
-
-  if (code->ext.concur.locality[LOCALITY_LOCAL]
-  || code->ext.concur.locality[LOCALITY_LOCAL_INIT])
-{
-  gfc_error ("Sorry, LOCAL and LOCAL_INIT are not yet supported for "
-"% constructs at %L", &code->loc);
-}
 }
 
 /* Resolve a list of FORALL iterators.  The FORALL index-name is constrained
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 8dd1c93dbdf8..9087221dabbf 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -8361,23 +8361,17 @@ gfc_generate_block_data (gfc_namespace * ns)
   rest_of_decl_compilation (decl, 1, 0);
 }
 
-
-/* Process the local variables of a BLOCK construct.  */
-
 void
-gfc_process_block_locals (gfc_namespace* ns)
+gfc_start_saved_local_decls ()
 {
-  tree decl;
-
+  gcc_checking_assert (current_function_decl != NULL_TREE);
   saved_local_decls = NULL_TREE;
-  has_coarray_vars_or_accessors = caf_accessor_head != NULL;
-
-  generate_local_vars (ns);
-
-  if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars_or_accessors)
-generate_coarray_init (ns);
+}
 
-  decl = nreverse (saved_local_decls);
+void
+gfc_stop_saved_local_decls ()
+{
+  tree decl = nreverse (saved_local_decls);
   while (decl)
 {
   tree next;
@@ -8390,5 +8384,20 @@ gfc_process_block_locals (gfc_namespace* ns)
   saved_local_decls = NULL_TREE;
 }
 
+/* Process the local variables of a BLOCK construct.  */
+
+void
+gfc_process_block_locals (gfc_namespace* ns)
+{
+  gfc_start_saved_local_decls ();
+  has_coarray_vars_or_accessors = caf_accessor_head != NULL;
+
+  generate_local_vars (ns);
+
+  if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars_or_accessors)