commit 7271853495d63ca18c668d325d949b9ca7579aef
Author: Jakub Jelinek
Date: Mon May 29 11:47:49 2023
Bump BASE-VER
2023-05-29 Jakub Jelinek
* BASE-VER: Set to 11.4.1.
diff --git a/gcc/BASE-VER b/gcc/BASE-VER
index 72773deb895..a6e5b12f92f 100644
--- a/gcc/BASE-VER
+++ b/gcc/BASE-VER
@@ -1 +1 @@
-11.4.0
+11.4.1
commit a6143fef34ce70bd9f414bb4eccd21f2a5f09df1
Author: GCC Administrator
Date: Mon May 29 13:16:48 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 4f495f3bb8a..5f5439b6a42 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230528
+20230529
commit 1b75c19730bdb76b1b2548d070f06958929f4172
Author: GCC Administrator
Date: Tue May 30 02:18:41 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 5f5439b6a42..9de50cecbd7 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230529
+20230530
commit ed3debbd45e1c53631ed88ad6897c12a53e09766
Author: Matthias Kretz
Date: Thu May 25 10:45:21 2023
libstdc++: Resolve -Wsign-compare issue
Signed-off-by: Matthias Kretz
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd_ppc.h (_S_bit_shift_left):
Negative __y is UB, so prefer signed compare.
(cherry picked from commit 1a1abec1d618cde709c585fcce89330bb33b07ac)
diff --git a/libstdc++-v3/include/experimental/bits/simd_ppc.h b/libstdc++-v3/include/experimental/bits/simd_ppc.h
index f1fec53cc79..6e4a6ec606e 100644
--- a/libstdc++-v3/include/experimental/bits/simd_ppc.h
+++ b/libstdc++-v3/include/experimental/bits/simd_ppc.h
@@ -64,7 +64,7 @@ template
__x = _Base::_S_bit_shift_left(__x, __y);
if constexpr (sizeof(_Tp) < sizeof(int))
{
- if (__y >= sizeof(_Tp) * __CHAR_BIT__)
+ if (__y >= int(sizeof(_Tp) * __CHAR_BIT__))
return {};
}
return __x;
commit b7ede951fbeecf54b31b84ae7b17e99ce203d4de
Author: Matthias Kretz
Date: Thu May 25 12:07:45 2023
libstdc++: Fix test assumptions on long and long double
Expect that long might not fit into the long double mantissa bits.
Signed-off-by: Matthias Kretz
libstdc++-v3/ChangeLog:
* testsuite/experimental/simd/tests/operator_cvt.cc: Make long
double <-> (u)long conversion tests conditional on sizeof(long
double) and sizeof(long).
(cherry picked from commit 291549d43e823f163fa9961e42a751b5ce0d57fb)
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/operator_cvt.cc b/libstdc++-v3/testsuite/experimental/simd/tests/operator_cvt.cc
index 8e7cfc5c25b..972888f7bcb 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/operator_cvt.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/operator_cvt.cc
@@ -220,8 +220,6 @@ template
binary_op_return_type();
binary_op_return_type();
binary_op_return_type();
- binary_op_return_type();
- binary_op_return_type();
binary_op_return_type();
binary_op_return_type();
@@ -231,8 +229,6 @@ template
binary_op_return_type, ushort>();
binary_op_return_type, int>();
binary_op_return_type, uint>();
- binary_op_return_type, long>();
- binary_op_return_type, ulong>();
binary_op_return_type, float>();
binary_op_return_type, double>();
binary_op_return_type, vf64>();
@@ -245,8 +241,6 @@ template
binary_op_return_type, ushort>();
binary_op_return_type, int>();
binary_op_return_type, uint>();
- binary_op_return_type, long>();
- binary_op_return_type, ulong>();
binary_op_return_type, float>();
binary_op_return_type, double>();
@@ -258,6 +252,24 @@ template
VERIFY((is_substitution_failure, ullong>));
VERIFY((is_substitution_failure, llong>));
VERIFY((is_substitution_failure, ullong>));
+ if constexpr (sizeof(long) == sizeof(llong))
+ {
+ VERIFY((is_substitution_failure));
+ VERIFY((is_substitution_failure));
+ VERIFY((is_substitution_failure, long>));
+ VERIFY((is_substitution_failure, ulong>));
+ VERIFY((is_substitution_failure, long>));
+ VERIFY((is_substitution_failure, ulong>));
+ }
+ else
+ {
+ binary_op_return_type();
+ binary_op_return_type();
+ binary_op_return_type, long>();
+ binary_op_return_type, ulong>();
+ binary_op_return_type, long>();
+ binary_op_return_type, ulong>();
+ }
}
else
{
@@ -267,6 +279,12 @@ template
binary_op_return_type, ullong>();
binary_op_return_type, llong>();
binary_op_return_type, ullong>();
+ binary_op_return_type();
+ binary_op_return_type();
+ binary_op_return_type, long>();
+ binary_op_return_type, ulong>();
+ binary_op_return_type, long>();
+ binary_op_return_type, ulong>();
}
VERIFY((is_substitution_failure, vldouble>));
commit c4dc05d1f617c5763be10cf53cc2fac22fa1dcd2
Author: Matthias Kretz
Date: Thu May 25 12:53:06 2023
libstdc++: Simplify calculation of expected value in simd test
This avoids a failure on PR109964.
Signed-off-by: Matthias Kretz
libstdc++-v3/ChangeLog:
* testsuite/experimental/simd/tests/integer_operators.cc:
Compute expected value differently to avoid getting turned into
a vector shift.
(cherry picked from commit 3e2689e568425f14d6728504ad6f5d32b90320ad)
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc b/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
index 7416952ad42..7a456b9f3bf 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
@@ -180,11 +180,10 @@ template
for (int j = 0; j < 100; ++j)
{
const V seq([&](auto i) -> T { return (j + i) % n_promo_bits; });
- COMPARE(V(1) >> seq, V([&](auto i) { return T(T(1) >> seq[i]); }))
- << "seq = " << seq;
- COMPARE(make_value_unknown(V(1)) >> make_value_unknown(seq),
- V([&](auto i) { return T(T(1) >> seq[i]); }))
- << "seq = " << seq;
+ const V expect([&](auto i) { return seq[i] == 0 ? T(1) : T(0); });
+ COMPARE(V(1) >> seq, expect) << "\nseq = " << seq;
+ COMPARE(make_value_unknown(V(1)) >> make_value_unknown(seq), expect)
+ << "\nseq = " << seq;
}
for_constexpr([](auto shift_ic) {
constexpr int shift = shift_ic;
commit 39a60f2d5f7bf6806a4c4d7d1f52f139e157e01a
Author: Matthias Kretz
Date: Fri May 26 12:23:44 2023
libstdc++: Correct NTTP and simd_mask ctor call
Signed-off-by: Matthias Kretz
libstdc++-v3/ChangeLog:
PR libstdc++/109822
* include/experimental/bits/simd.h (to_native): Use int NTTP
as specified in PTS2.
(to_compatible): Likewise. Add missing tag to call mask
generator ctor.
* testsuite/experimental/simd/pr109822_cast_functions.cc: New
test.
(cherry picked from commit 668d43502f465d48adbc1fe2956b979f36657e5f)
diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
index cc0f1cc509e..d5683bfcacb 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -3123,7 +3123,7 @@ template
return {__mem, vector_aligned};
}
-template
+template
_GLIBCXX_SIMD_INTRINSIC
enable_if_t<(_Np == native_simd_mask<_Tp>::size()), native_simd_mask<_Tp>>
to_native(const fixed_size_simd_mask<_Tp, _Np>& __x)
@@ -3134,7 +3134,7 @@ template
}
// to_compatible {{{2
-template
+template
_GLIBCXX_SIMD_INTRINSIC enable_if_t<(_Np == simd<_Tp>::size()), simd<_Tp>>
to_compatible(const simd<_Tp, simd_abi::fixed_size<_Np>>& __x)
{
@@ -3143,12 +3143,13 @@ template
return {__mem, vector_aligned};
}
-template
+template
_GLIBCXX_SIMD_INTRINSIC
enable_if_t<(_Np == simd_mask<_Tp>::size()), simd_mask<_Tp>>
to_compatible(const simd_mask<_Tp, simd_abi::fixed_size<_Np>>& __x)
{
return simd_mask<_Tp>(
+ __private_init,
[&](auto __i) constexpr _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { return __x[__i]; });
}
diff --git a/libstdc++-v3/testsuite/experimental/simd/pr109822_cast_functions.cc b/libstdc++-v3/testsuite/experimental/simd/pr109822_cast_functions.cc
new file mode 100644
index 00000000000..3deafbf7a1f
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/simd/pr109822_cast_functions.cc
@@ -0,0 +1,63 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include
+
+namespace stdx = std::experimental;
+
+template
+ void
+ test01()
+ {
+ using M = typename V::mask_type;
+ [[maybe_unused]] auto x = to_fixed_size(V());
+ [[maybe_unused]] auto k = to_fixed_size(M());
+ if constexpr (stdx::simd::size() == V::size())
+ {
+ [[maybe_unused]] auto xx = to_compatible(x);
+ [[maybe_unused]] auto kk = to_compatible(k);
+ x = to_fixed_size(xx);
+ k = to_fixed_size(kk);
+ }
+ if constexpr (stdx::native_simd::size() == V::size())
+ {
+ [[maybe_unused]] auto xx = to_native(x);
+ [[maybe_unused]] auto kk = to_native(k);
+ x = to_fixed_size(xx);
+ k = to_fixed_size(kk);
+ }
+ }
+
+template
+ void
+ iterate_abis()
+ {
+ test01>();
+ test01>();
+ test01>();
+ test01>();
+ test01 - 4>>();
+ }
+
+int
+main()
+{
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+ iterate_abis();
+}
commit 9318207b5c666a662f6450df469f80bed3f8e7b2
Author: GCC Administrator
Date: Wed May 31 02:19:12 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 9de50cecbd7..748e702e080 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230530
+20230531
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 19ca5d7af1d..a810cb4e260 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,42 @@
+2023-05-30 Matthias Kretz
+
+ Backported from master:
+ 2023-05-30 Matthias Kretz
+
+ PR libstdc++/109822
+ * include/experimental/bits/simd.h (to_native): Use int NTTP
+ as specified in PTS2.
+ (to_compatible): Likewise. Add missing tag to call mask
+ generator ctor.
+ * testsuite/experimental/simd/pr109822_cast_functions.cc: New
+ test.
+
+2023-05-30 Matthias Kretz
+
+ Backported from master:
+ 2023-05-30 Matthias Kretz
+
+ * testsuite/experimental/simd/tests/integer_operators.cc:
+ Compute expected value differently to avoid getting turned into
+ a vector shift.
+
+2023-05-30 Matthias Kretz
+
+ Backported from master:
+ 2023-05-30 Matthias Kretz
+
+ * testsuite/experimental/simd/tests/operator_cvt.cc: Make long
+ double <-> (u)long conversion tests conditional on sizeof(long
+ double) and sizeof(long).
+
+2023-05-30 Matthias Kretz
+
+ Backported from master:
+ 2023-05-26 Matthias Kretz
+
+ * include/experimental/bits/simd_ppc.h (_S_bit_shift_left):
+ Negative __y is UB, so prefer signed compare.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
commit d41085966d842e54fd4b528c719ed5af2e51c473
Author: GCC Administrator
Date: Thu Jun 1 02:19:07 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 748e702e080..e171f9ed053 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230531
+20230601
commit 8538e22f0004565bb95b10741bfd416961030f4c
Author: Jonathan Wakely
Date: Thu Jun 1 12:30:10 2023
doc: Fix description of x86 -m32 option [PR109954]
This option does not imply -march=i386 so it's incorrect to say it
generates code that will run on "any i386 system".
gcc/ChangeLog:
PR target/109954
* doc/invoke.texi (x86 Options): Fix description of -m32 option.
(cherry picked from commit eeb92704967875411416b0b9508aa6f49e8192fd)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f1217812280..fffa899585e 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -31757,7 +31757,7 @@ on x86-64 processors in 64-bit environments.
Generate code for a 16-bit, 32-bit or 64-bit environment.
The @option{-m32} option sets @code{int}, @code{long}, and pointer types
to 32 bits, and
-generates code that runs on any i386 system.
+generates code that runs in 32-bit mode.
The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
types to 64 bits, and generates code for the x86-64 architecture.
commit f8853ff5d20234c184b2b4a9952b0e4964ecc24a
Author: GCC Administrator
Date: Fri Jun 2 02:19:46 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 326bcd31a3a..9cb4f2c0b34 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-01 Jonathan Wakely
+
+ Backported from master:
+ 2023-06-01 Jonathan Wakely
+
+ PR target/109954
+ * doc/invoke.texi (x86 Options): Fix description of -m32 option.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index e171f9ed053..d0de28459d0 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230601
+20230602
commit bfa476528ceeac96865a48c49f3f1a15d566d209
Author: Richard Biener
Date: Wed Feb 23 13:47:01 2022
middle-end/109505 - backport match.pd ! support for GENERIC
The patch adds support for the ! modifier to GENERIC, backported
from r12-7361-gfdc46830f1b793.
2023-06-02 Richard Biener
PR tree-optimization/109505
* doc/match-and-simplify.texi: Amend ! documentation.
* genmatch.c (expr::gen_transform): Code-generate ! support
for GENERIC.
(parser::parse_expr): Allow ! for GENERIC.
diff --git a/gcc/doc/match-and-simplify.texi b/gcc/doc/match-and-simplify.texi
index e7e5a4f7299..b76aeac4121 100644
--- a/gcc/doc/match-and-simplify.texi
+++ b/gcc/doc/match-and-simplify.texi
@@ -374,8 +374,10 @@ for example
which moves the outer @code{plus} operation to the inner arms
of the @code{vec_cond} expression but only if the actual plus
-operations both simplify. Note this is currently only supported
-for code generation targeting @code{GIMPLE}.
+operations both simplify. Note that on @code{GENERIC} a simple
+operand means that the result satisfies @code{!EXPR_P} which
+can be limiting if the operation itself simplifies but the
+remaining operand is an (unrelated) expression.
As intermediate conversions are often optional there is a way to
avoid the need to repeat patterns both with and without such
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 3b99705606c..e22158665fb 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -2554,19 +2554,20 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple,
fprintf_indent (f, indent, "_r%d = fold_build%d_loc (loc, %s, %s",
depth, ops.length(), opr_name, type);
else
- {
- fprintf_indent (f, indent, "{\n");
- fprintf_indent (f, indent, " _r%d = maybe_build_call_expr_loc (loc, "
- "%s, %s, %d", depth, opr_name, type, ops.length());
- }
+ fprintf_indent (f, indent, "_r%d = maybe_build_call_expr_loc (loc, "
+ "%s, %s, %d", depth, opr_name, type, ops.length());
for (unsigned i = 0; i < ops.length (); ++i)
fprintf (f, ", _o%d[%u]", depth, i);
fprintf (f, ");\n");
if (opr->kind != id_base::CODE)
{
- fprintf_indent (f, indent, " if (!_r%d)\n", depth);
- fprintf_indent (f, indent, " goto %s;\n", fail_label);
- fprintf_indent (f, indent, "}\n");
+ fprintf_indent (f, indent, "if (!_r%d)\n", depth);
+ fprintf_indent (f, indent, " goto %s;\n", fail_label);
+ }
+ if (force_leaf)
+ {
+ fprintf_indent (f, indent, "if (EXPR_P (_r%d))\n", depth);
+ fprintf_indent (f, indent, " goto %s;\n", fail_label);
}
if (*opr == CONVERT_EXPR)
{
@@ -4300,9 +4301,6 @@ parser::parse_expr ()
&& token->type == CPP_NOT
&& !(token->flags & PREV_WHITE))
{
- if (!gimple)
- fatal_at (token, "forcing simplification to a leaf is not supported "
- "for GENERIC");
eat_token (CPP_NOT);
e->force_leaf = true;
}
commit ca4a4cc0060cb8ae1a326d6dbfcd9459452e1574
Author: Jakub Jelinek
Date: Sun May 21 13:36:56 2023
match.pd: Ensure (op CONSTANT_CLASS_P CONSTANT_CLASS_P) is simplified [PR109505]
On the following testcase we hang, because POLY_INT_CST is CONSTANT_CLASS_P,
but BIT_AND_EXPR with it and INTEGER_CST doesn't simplify and the
(x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2)
simplification actually relies on the (CST1 & CST2) simplification,
otherwise it is a deoptimization, trading 2 ops for 3 and furthermore
running into
/* Given a bit-wise operation CODE applied to ARG0 and ARG1, see if both
operands are another bit-wise operation with a common input. If so,
distribute the bit operations to save an operation and possibly two if
constants are involved. For example, convert
(A | B) & (A | C) into A | (B & C)
Further simplification will occur if B and C are constants. */
simplification which simplifies that
(x & CST2) | (CST1 & CST2) back to
CST2 & (x | CST1).
I went through all other places I could find where we have a simplification
with 2 CONSTANT_CLASS_P operands and perform some operation on those two,
while the other spots aren't that severe (just trade 2 operations for
another 2 if the two constants don't simplify, rather than as in the above
case trading 2 ops for 3), I still think all those spots really intend
to optimize only if the 2 constants simplify.
So, the following patch adds to those a ! modifier to ensure that,
even at GENERIC that modifier means !EXPR_P which is exactly what we want
IMHO.
2023-05-21 Jakub Jelinek
PR tree-optimization/109505
* match.pd ((x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2),
Combine successive equal operations with constants,
(A +- CST1) +- CST2 -> A + CST3, (CST1 - A) +- CST2 -> CST3 - A,
CST1 - (CST2 - A) -> CST3 + A): Use ! on ops with 2 CONSTANT_CLASS_P
operands.
* gcc.target/aarch64/sve/pr109505.c: New test.
(cherry picked from commit f211757f6fa9515e3fd1a4f66f1a8b48e500c9de)
diff --git a/gcc/match.pd b/gcc/match.pd
index 91a3762e320..4f83c9c2d36 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1543,7 +1543,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* (x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2) */
(simplify
(bit_and (bit_ior @0 CONSTANT_CLASS_P@1) CONSTANT_CLASS_P@2)
- (bit_ior (bit_and @0 @2) (bit_and @1 @2)))
+ (bit_ior (bit_and @0 @2) (bit_and! @1 @2)))
/* Combine successive equal operations with constants. */
(for bitop (bit_and bit_ior bit_xor)
@@ -1552,7 +1552,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (!CONSTANT_CLASS_P (@0))
/* This is the canonical form regardless of whether (bitop @1 @2) can be
folded to a constant. */
- (bitop @0 (bitop @1 @2))
+ (bitop @0 (bitop! @1 @2))
/* In this case we have three constants and (bitop @0 @1) doesn't fold
to a constant. This can happen if @0 or @1 is a POLY_INT_CST and if
the values involved are such that the operation can't be decided at
@@ -2432,13 +2432,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
forever if something doesn't simplify into a constant. */
(if (!CONSTANT_CLASS_P (@0))
(if (outer_op == PLUS_EXPR)
- (plus (view_convert @0) (inner_op @2 (view_convert @1)))
- (minus (view_convert @0) (neg_inner_op @2 (view_convert @1)))))
+ (plus (view_convert @0) (inner_op! @2 (view_convert @1)))
+ (minus (view_convert @0) (neg_inner_op! @2 (view_convert @1)))))
(if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
|| TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)))
(if (outer_op == PLUS_EXPR)
- (view_convert (plus @0 (inner_op (view_convert @2) @1)))
- (view_convert (minus @0 (neg_inner_op (view_convert @2) @1))))
+ (view_convert (plus @0 (inner_op! (view_convert @2) @1)))
+ (view_convert (minus @0 (neg_inner_op! (view_convert @2) @1))))
/* If the constant operation overflows we cannot do the transform
directly as we would introduce undefined overflow, for example
with (a - 1) + INT_MIN. */
@@ -2469,10 +2469,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* If all 3 captures are CONSTANT_CLASS_P, punt, as we might recurse
forever if something doesn't simplify into a constant. */
(if (!CONSTANT_CLASS_P (@0))
- (minus (outer_op (view_convert @1) @2) (view_convert @0)))
+ (minus (outer_op! (view_convert @1) @2) (view_convert @0)))
(if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
|| TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)))
- (view_convert (minus (outer_op @1 (view_convert @2)) @0))
+ (view_convert (minus (outer_op! @1 (view_convert @2)) @0))
(if (types_match (type, @0))
(with { tree cst = const_binop (outer_op, type, @1, @2); }
(if (cst && !TREE_OVERFLOW (cst))
@@ -2488,10 +2488,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* If all 3 captures are CONSTANT_CLASS_P, punt, as we might recurse
forever if something doesn't simplify into a constant. */
(if (!CONSTANT_CLASS_P (@0))
- (plus (view_convert @0) (minus @1 (view_convert @2))))
+ (plus (view_convert @0) (minus! @1 (view_convert @2))))
(if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
|| TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)))
- (view_convert (plus @0 (minus (view_convert @1) @2)))
+ (view_convert (plus @0 (minus! (view_convert @1) @2)))
(if (types_match (type, @0))
(with { tree cst = const_binop (MINUS_EXPR, type, @1, @2); }
(if (cst && !TREE_OVERFLOW (cst))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr109505.c b/gcc/testsuite/gcc.target/aarch64/sve/pr109505.c
new file mode 100644
index 00000000000..b975ae75ae6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr109505.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/109505 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv8.2-a+sve" } */
+
+#pragma GCC aarch64 "arm_sve.h"
+
+unsigned long
+foo (unsigned long x)
+{
+ unsigned long y = svcntb ();
+ return (x | 15) & y;
+}
commit df1252abc5b2312193a1e5f7eb3d94d42fa29fa8
Author: GCC Administrator
Date: Sat Jun 3 02:19:18 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9cb4f2c0b34..ef6969157c2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2023-06-02 Jakub Jelinek
+
+ Backported from master:
+ 2023-05-21 Jakub Jelinek
+
+ PR tree-optimization/109505
+ * match.pd ((x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2),
+ Combine successive equal operations with constants,
+ (A +- CST1) +- CST2 -> A + CST3, (CST1 - A) +- CST2 -> CST3 - A,
+ CST1 - (CST2 - A) -> CST3 + A): Use ! on ops with 2 CONSTANT_CLASS_P
+ operands.
+
+2023-06-02 Richard Biener
+
+ PR tree-optimization/109505
+ * doc/match-and-simplify.texi: Amend ! documentation.
+ * genmatch.c (expr::gen_transform): Code-generate ! support
+ for GENERIC.
+ (parser::parse_expr): Allow ! for GENERIC.
+
2023-06-01 Jonathan Wakely
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d0de28459d0..1760b75fb77 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230602
+20230603
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eb6383443fa..aa7a5f9b4c1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-02 Jakub Jelinek
+
+ Backported from master:
+ 2023-05-21 Jakub Jelinek
+
+ PR tree-optimization/109505
+ * gcc.target/aarch64/sve/pr109505.c: New test.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
commit 2beff4667009b2d720eb0238090242edef1d6aa5
Author: GCC Administrator
Date: Sun Jun 4 02:18:53 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 1760b75fb77..a5bdb7bdd09 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230603
+20230604
commit 37fdec3b7feca378693b3f12dbee422752176b24
Author: Steve Kargl
Date: Fri Jun 2 19:44:11 2023
Fortran: fix diagnostics for SELECT RANK [PR100607]
gcc/fortran/ChangeLog:
PR fortran/100607
* resolve.c (resolve_select_rank): Remove duplicate error.
(resolve_fl_var_and_proc): Prevent NULL pointer dereference and
suppress error message for temporary.
gcc/testsuite/ChangeLog:
PR fortran/100607
* gfortran.dg/select_rank_6.f90: New test.
(cherry picked from commit fae09dfc0e6bf4cfe35d817558827aea78c6426f)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 155005d30bb..bc38444ea75 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9864,11 +9864,6 @@ resolve_select_rank (gfc_code *code, gfc_namespace *old_ns)
|| gfc_expr_attr (code->expr1).pointer))
gfc_error ("RANK (*) at %L cannot be used with the pointer or "
"allocatable selector at %L", &c->where, &code->expr1->where);
-
- if (case_value == -1 && (gfc_expr_attr (code->expr1).allocatable
- || gfc_expr_attr (code->expr1).pointer))
- gfc_error ("RANK (*) at %L cannot be used with the pointer or "
- "allocatable selector at %L", &c->where, &code->expr1->where);
}
/* Add EXEC_SELECT to switch on rank. */
@@ -12806,7 +12801,10 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
if (allocatable)
{
- if (dimension && as->type != AS_ASSUMED_RANK)
+ if (dimension
+ && as
+ && as->type != AS_ASSUMED_RANK
+ && !sym->attr.select_rank_temporary)
{
gfc_error ("Allocatable array %qs at %L must have a deferred "
"shape or assumed rank", sym->name, &sym->declared_at);
diff --git a/gcc/testsuite/gfortran.dg/select_rank_6.f90 b/gcc/testsuite/gfortran.dg/select_rank_6.f90
new file mode 100644
index 00000000000..d0121777bb5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_rank_6.f90
@@ -0,0 +1,48 @@
+! { dg-do compile }
+! PR fortran/100607 - fix diagnostics for SELECT RANK
+! Contributed by T.Burnus
+
+program p
+ implicit none
+ integer, allocatable :: A(:,:,:)
+
+ allocate(a(5:6,-2:2, 99:100))
+ call foo(a)
+ call bar(a)
+
+contains
+
+ subroutine foo(x)
+ integer, allocatable :: x(..)
+ if (rank(x) /= 3) stop 1
+ if (any (lbound(x) /= [5, -2, 99])) stop 2
+
+ select rank (x)
+ rank(3)
+ if (any (lbound(x) /= [5, -2, 99])) stop 3
+ end select
+
+ select rank (x) ! { dg-error "pointer or allocatable selector at .2." }
+ rank(*) ! { dg-error "pointer or allocatable selector at .2." }
+ if (rank(x) /= 1) stop 4
+ if (lbound(x, 1) /= 1) stop 5
+ end select
+ end
+
+ subroutine bar(x)
+ integer :: x(..)
+ if (rank(x) /= 3) stop 6
+ if (any (lbound(x) /= 1)) stop 7
+
+ select rank (x)
+ rank(3)
+ if (any (lbound(x) /= 1)) stop 8
+ end select
+
+ select rank (x)
+ rank(*)
+ if (rank(x) /= 1) stop 9
+ if (lbound(x, 1) /= 1) stop 10
+ end select
+ end
+end
commit f0ab392dc24e08ec33a66630d5a432e9e7541242
Author: GCC Administrator
Date: Mon Jun 5 02:18:58 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a5bdb7bdd09..3e73975bf5e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230604
+20230605
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 16ab8effecc..025fbfe5e93 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2023-06-04 Steve Kargl
+
+ Backported from master:
+ 2023-06-02 Steve Kargl
+
+ PR fortran/100607
+ * resolve.c (resolve_select_rank): Remove duplicate error.
+ (resolve_fl_var_and_proc): Prevent NULL pointer dereference and
+ suppress error message for temporary.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aa7a5f9b4c1..bc3755e7728 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-04 Steve Kargl
+
+ Backported from master:
+ 2023-06-02 Steve Kargl
+
+ PR fortran/100607
+ * gfortran.dg/select_rank_6.f90: New test.
+
2023-06-02 Jakub Jelinek
Backported from master:
commit aec12243110ed774d61d4046e7e3dd22bfafef75
Author: GCC Administrator
Date: Tue Jun 6 02:19:56 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 3e73975bf5e..7e14e0ee146 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230605
+20230606
commit 677f68cfb0f9fa0dcbc8c602670c414806267ab6
Author: GCC Administrator
Date: Wed Jun 7 02:20:10 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 7e14e0ee146..2e61d1d960e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230606
+20230607
commit e444b8bc680ad4c70cb8c589da565e8f40f48d98
Author: GCC Administrator
Date: Thu Jun 8 02:19:38 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2e61d1d960e..73ca44c893e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230607
+20230608
commit 1ddd458217c0132b005ecb3808f5e3010e8d9506
Author: GCC Administrator
Date: Fri Jun 9 02:18:58 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 73ca44c893e..a4ca097fc3e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230608
+20230609
commit 7f875e435b23dfb439bc7784cade4aebbd5d4a69
Author: Jakub Jelinek
Date: Fri Jun 9 09:10:29 2023
fortran: Fix ICE on pr96024.f90 on big-endian hosts [PR96024]
The pr96024.f90 testcase ICEs on big-endian hosts. The problem is
that length->val.integer is accessed after checking
length->expr_type == EXPR_CONSTANT, but it is a CHARACTER constant
which uses length->val.character union member instead and on big-endian
we end up reading constant 0x100000000 rather than some small number
on little-endian and if target doesn't have enough memory for 4 times
that (i.e. 16GB allocation), it ICEs.
2023-06-09 Jakub Jelinek
PR fortran/96024
* primary.c (gfc_convert_to_structure_constructor): Only do
constant string ctor length verification and truncation/padding
if constant length has INTEGER type.
(cherry picked from commit 4cf6e322adc19f927859e0a5edfa93cec4b8c844)
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 1b93f96367f..5cad2d2682b 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -3188,10 +3188,11 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c
goto cleanup;
/* For a constant string constructor, make sure the length is
- correct; truncate of fill with blanks if needed. */
+ correct; truncate or fill with blanks if needed. */
if (this_comp->ts.type == BT_CHARACTER && !this_comp->attr.allocatable
&& this_comp->ts.u.cl && this_comp->ts.u.cl->length
&& this_comp->ts.u.cl->length->expr_type == EXPR_CONSTANT
+ && this_comp->ts.u.cl->length->ts.type == BT_INTEGER
&& actual->expr->ts.type == BT_CHARACTER
&& actual->expr->expr_type == EXPR_CONSTANT)
{
commit 92293d71135f8a4ad4097e971122ce3153de73a8
Author: Iain Sandoe
Date: Thu Jun 1 14:43:35 2023
Darwin, PPC: Fix struct layout with pragma pack [PR110044].
This bug was essentially that darwin_rs6000_special_round_type_align()
was ignoring externally-imposed capping of field alignment.
Signed-off-by: Iain Sandoe
PR target/110044
gcc/ChangeLog:
* config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
Make sure that we do not have a cap on field alignment before altering
the struct layout based on the type alignment of the first entry.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/darwin-abi-13-0.c: New test.
* gcc.target/powerpc/darwin-abi-13-1.c: New test.
* gcc.target/powerpc/darwin-abi-13-2.c: New test.
* gcc.target/powerpc/darwin-structs-0.h: New test.
(cherry picked from commit 84d080a29a780973bef47171ba708ae2f7b4ee47)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index eba5b200f6a..c3854a931da 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8077,7 +8077,8 @@ darwin_rs6000_special_round_type_align (tree type, unsigned int computed,
type = TREE_TYPE (type);
} while (AGGREGATE_TYPE_P (type));
- if (! AGGREGATE_TYPE_P (type) && type != error_mark_node)
+ if (type != error_mark_node && ! AGGREGATE_TYPE_P (type)
+ && ! TYPE_PACKED (type) && maximum_field_alignment == 0)
align = MAX (align, TYPE_ALIGN (type));
return align;
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-0.c b/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-0.c
new file mode 100644
index 00000000000..d8d3c63a083
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-0.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target powerpc*-*-darwin* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-Wno-long-long" } */
+
+#include "darwin-structs-0.h"
+
+int tcd[sizeof(cd) != 12 ? -1 : 1];
+int acd[__alignof__(cd) != 4 ? -1 : 1];
+
+int sdc[sizeof(dc) != 16 ? -1 : 1];
+int adc[__alignof__(dc) != 8 ? -1 : 1];
+
+int scL[sizeof(cL) != 12 ? -1 : 1];
+int acL[__alignof__(cL) != 4 ? -1 : 1];
+
+int sLc[sizeof(Lc) != 16 ? -1 : 1];
+int aLc[__alignof__(Lc) != 8 ? -1 : 1];
+
+int scD[sizeof(cD) != 32 ? -1 : 1];
+int acD[__alignof__(cD) != 16 ? -1 : 1];
+
+int sDc[sizeof(Dc) != 32 ? -1 : 1];
+int aDc[__alignof__(Dc) != 16 ? -1 : 1];
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-1.c b/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-1.c
new file mode 100644
index 00000000000..4d888d383fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-1.c
@@ -0,0 +1,27 @@
+/* { dg-do compile { target powerpc*-*-darwin* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-Wno-long-long" } */
+
+#pragma pack(push, 1)
+
+#include "darwin-structs-0.h"
+
+int tcd[sizeof(cd) != 9 ? -1 : 1];
+int acd[__alignof__(cd) != 1 ? -1 : 1];
+
+int sdc[sizeof(dc) != 9 ? -1 : 1];
+int adc[__alignof__(dc) != 1 ? -1 : 1];
+
+int scL[sizeof(cL) != 9 ? -1 : 1];
+int acL[__alignof__(cL) != 1 ? -1 : 1];
+
+int sLc[sizeof(Lc) != 9 ? -1 : 1];
+int aLc[__alignof__(Lc) != 1 ? -1 : 1];
+
+int scD[sizeof(cD) != 17 ? -1 : 1];
+int acD[__alignof__(cD) != 1 ? -1 : 1];
+
+int sDc[sizeof(Dc) != 17 ? -1 : 1];
+int aDc[__alignof__(Dc) != 1 ? -1 : 1];
+
+#pragma pack(pop)
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-2.c b/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-2.c
new file mode 100644
index 00000000000..3bd52c0a8f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/darwin-abi-13-2.c
@@ -0,0 +1,27 @@
+/* { dg-do compile { target powerpc*-*-darwin* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-Wno-long-long" } */
+
+#pragma pack(push, 2)
+
+#include "darwin-structs-0.h"
+
+int tcd[sizeof(cd) != 10 ? -1 : 1];
+int acd[__alignof__(cd) != 2 ? -1 : 1];
+
+int sdc[sizeof(dc) != 10 ? -1 : 1];
+int adc[__alignof__(dc) != 2 ? -1 : 1];
+
+int scL[sizeof(cL) != 10 ? -1 : 1];
+int acL[__alignof__(cL) != 2 ? -1 : 1];
+
+int sLc[sizeof(Lc) != 10 ? -1 : 1];
+int aLc[__alignof__(Lc) != 2 ? -1 : 1];
+
+int scD[sizeof(cD) != 18 ? -1 : 1];
+int acD[__alignof__(cD) != 2 ? -1 : 1];
+
+int sDc[sizeof(Dc) != 18 ? -1 : 1];
+int aDc[__alignof__(Dc) != 2 ? -1 : 1];
+
+#pragma pack(pop)
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-structs-0.h b/gcc/testsuite/gcc.target/powerpc/darwin-structs-0.h
new file mode 100644
index 00000000000..1db44f7a808
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/darwin-structs-0.h
@@ -0,0 +1,29 @@
+typedef struct _cd {
+ char c;
+ double d;
+} cd;
+
+typedef struct _dc {
+ double d;
+ char c;
+} dc;
+
+typedef struct _cL {
+ char c;
+ long long L;
+} cL;
+
+typedef struct _Lc {
+ long long L;
+ char c;
+} Lc;
+
+typedef struct _cD {
+ char c;
+ long double D;
+} cD;
+
+typedef struct _Dc {
+ long double D;
+ char c;
+} Dc;
commit 2d3b72cbbfe7fb38b0e3b8ef2119156cbce57488
Author: Alex Coplan
Date: Thu May 25 14:34:46 2023
arm: Fix ICE due to infinite splitting [PR109800]
In r11-966-g9a182ef9ee011935d827ab5c6c9a7cd8e22257d8 we introduce a
simplification to emit_move_insn that attempts to simplify moves of the form:
(set (subreg:M1 (reg:M2 ...)) (constant C))
where M1 and M2 are of equal mode size. That is problematic for the splitter
vfp.md:no_literal_pool_df_immediate in the arm backend, which tries to pun an
lvalue DFmode pseudo into DImode and assign a constant to it with
emit_move_insn, as the new transformation simply undoes this, and we end up
splitting indefinitely.
This patch changes things around in the arm backend so that we use a
DImode temporary (instead of DFmode) and first load the DImode constant
into the pseudo, and then pun the pseudo into DFmode as an rvalue in a
reg -> reg move. I believe this should be semantically equivalent but
avoids the pathalogical behaviour seen in the PR.
gcc/ChangeLog:
PR target/109800
* config/arm/arm.md (movdf): Generate temporary pseudo in DImode
instead of DFmode.
* config/arm/vfp.md (no_literal_pool_df_immediate): Rather than punning an
lvalue DFmode pseudo into DImode, use a DImode pseudo and pun it into
DFmode as an rvalue.
gcc/testsuite/ChangeLog:
PR target/109800
* gcc.target/arm/pure-code/pr109800.c: New test.
(cherry picked from commit f5298d9969b4fa34ff3aecd54b9630e22b2984a5)
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 5d3f21b91c4..6b833d2cc10 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -7466,7 +7466,7 @@
&& !arm_const_double_rtx (operands[1])
&& !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1])))
{
- rtx clobreg = gen_reg_rtx (DFmode);
+ rtx clobreg = gen_reg_rtx (DImode);
emit_insn (gen_no_literal_pool_df_immediate (operands[0], operands[1],
clobreg));
DONE;
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index c9f2f12b51e..374630d26f6 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -2128,7 +2128,7 @@
(define_insn_and_split "no_literal_pool_df_immediate"
[(set (match_operand:DF 0 "s_register_operand" "=w")
(match_operand:DF 1 "const_double_operand" "F"))
- (clobber (match_operand:DF 2 "s_register_operand" "=r"))]
+ (clobber (match_operand:DI 2 "s_register_operand" "=r"))]
"arm_disable_literal_pool
&& TARGET_VFP_BASE
&& !arm_const_double_rtx (operands[1])
@@ -2143,8 +2143,9 @@
unsigned HOST_WIDE_INT ival = zext_hwi (buf[order], 32);
ival |= (zext_hwi (buf[1 - order], 32) << 32);
rtx cst = gen_int_mode (ival, DImode);
- emit_move_insn (simplify_gen_subreg (DImode, operands[2], DFmode, 0), cst);
- emit_move_insn (operands[0], operands[2]);
+ emit_move_insn (operands[2], cst);
+ emit_move_insn (operands[0],
+ simplify_gen_subreg (DFmode, operands[2], DImode, 0));
DONE;
}
)
diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr109800.c b/gcc/testsuite/gcc.target/arm/pure-code/pr109800.c
new file mode 100644
index 00000000000..d797b790232
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pure-code/pr109800.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-options "-O2 -march=armv7-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mbig-endian -mpure-code" } */
+double f() { return 5.0; }
commit 9dccdfd1f6ca572fc7c4b0187980788b7eb14216
Author: GCC Administrator
Date: Sat Jun 10 02:19:43 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ef6969157c2..c8d120d5ea1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,25 @@
+2023-06-09 Alex Coplan
+
+ Backported from master:
+ 2023-05-25 Alex Coplan
+
+ PR target/109800
+ * config/arm/arm.md (movdf): Generate temporary pseudo in DImode
+ instead of DFmode.
+ * config/arm/vfp.md (no_literal_pool_df_immediate): Rather than punning an
+ lvalue DFmode pseudo into DImode, use a DImode pseudo and pun it into
+ DFmode as an rvalue.
+
+2023-06-09 Iain Sandoe
+
+ Backported from master:
+ 2023-06-02 Iain Sandoe
+
+ PR target/110044
+ * config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
+ Make sure that we do not have a cap on field alignment before altering
+ the struct layout based on the type alignment of the first entry.
+
2023-06-02 Jakub Jelinek
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a4ca097fc3e..dc88eb6d69e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230609
+20230610
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 025fbfe5e93..e7b9d5c735f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2023-06-09 Jakub Jelinek
+
+ Backported from master:
+ 2023-06-09 Jakub Jelinek
+
+ PR fortran/96024
+ * primary.c (gfc_convert_to_structure_constructor): Only do
+ constant string ctor length verification and truncation/padding
+ if constant length has INTEGER type.
+
2023-06-04 Steve Kargl
Backported from master:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bc3755e7728..0a2cd0dbd47 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+2023-06-09 Alex Coplan
+
+ Backported from master:
+ 2023-05-25 Alex Coplan
+
+ PR target/109800
+ * gcc.target/arm/pure-code/pr109800.c: New test.
+
+2023-06-09 Iain Sandoe
+
+ Backported from master:
+ 2023-06-02 Iain Sandoe
+
+ PR target/110044
+ * gcc.target/powerpc/darwin-abi-13-0.c: New test.
+ * gcc.target/powerpc/darwin-abi-13-1.c: New test.
+ * gcc.target/powerpc/darwin-abi-13-2.c: New test.
+ * gcc.target/powerpc/darwin-structs-0.h: New test.
+
2023-06-04 Steve Kargl
Backported from master:
commit 64524a8dddaa894ed44694f626ba1c03a94b3aba
Author: GCC Administrator
Date: Sun Jun 11 02:19:33 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index dc88eb6d69e..0f040c2846a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230610
+20230611
commit 593de8379ca15d2b7ca8433e3e21695102573009
Author: GCC Administrator
Date: Mon Jun 12 02:19:22 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 0f040c2846a..995c0c1e119 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230611
+20230612
commit 5bf1c33a5e619564e8602601cc1beebd99e1fb9e
Author: Richard Biener
Date: Mon Jun 12 10:17:26 2023
middle-end/110200 - genmatch force-leaf and convert interaction
The following fixes code GENERIC generation for (convert! ...)
which currently generates
if (TREE_TYPE (_o1[0]) != type)
_r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
if (EXPR_P (_r1))
goto next_after_fail867;
else
_r1 = _o1[0];
where obviously braces are missing.
PR middle-end/110200
* genmatch.c (expr::gen_transform): Put braces around
the if arm for the (convert ...) short-cut.
(cherry picked from commit 820d1aec89c43dbbc70d3d0b888201878388454c)
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index e22158665fb..c04ab9cff5e 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -2548,7 +2548,8 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple,
{
fprintf_indent (f, indent, "if (TREE_TYPE (_o%d[0]) != %s)\n",
depth, type);
- indent += 2;
+ fprintf_indent (f, indent + 2, "{\n");
+ indent += 4;
}
if (opr->kind == id_base::CODE)
fprintf_indent (f, indent, "_r%d = fold_build%d_loc (loc, %s, %s",
@@ -2571,7 +2572,8 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple,
}
if (*opr == CONVERT_EXPR)
{
- indent -= 2;
+ fprintf_indent (f, indent - 2, "}\n");
+ indent -= 4;
fprintf_indent (f, indent, "else\n");
fprintf_indent (f, indent, " _r%d = _o%d[0];\n", depth, depth);
}
commit b7f86c5491eb7607ce1bb4236ae8853e76500504
Author: GCC Administrator
Date: Tue Jun 13 02:19:58 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c8d120d5ea1..681673e844d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2023-06-12 Richard Biener
+
+ Backported from master:
+ 2023-06-12 Richard Biener
+
+ PR middle-end/110200
+ * genmatch.c (expr::gen_transform): Put braces around
+ the if arm for the (convert ...) short-cut.
+
2023-06-09 Alex Coplan
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 995c0c1e119..5180e2ea7c6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230612
+20230613
commit 028e40b6d6f9c3e076290ee916a0338be32fbfb4
Author: GCC Administrator
Date: Wed Jun 14 02:19:29 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 5180e2ea7c6..60b8c2b92b7 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230613
+20230614
commit fb1d3155af948314d3455476ece869bf01df34a9
Author: GCC Administrator
Date: Thu Jun 15 02:19:09 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 60b8c2b92b7..3f6866a6b54 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230614
+20230615
commit 5d30dd1ba508c49a050c71421e4dbb08e9f35b69
Author: GCC Administrator
Date: Fri Jun 16 02:19:27 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 3f6866a6b54..d8455aa601e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230615
+20230616
commit bab4704ad49317a0b49f13c367c71eae2e510fc1
Author: GCC Administrator
Date: Sat Jun 17 02:19:27 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d8455aa601e..e65e8e48ae9 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230616
+20230617
commit 694c66e1212a3bb7c6a0056f83f7cde2e9b38f2f
Author: GCC Administrator
Date: Sun Jun 18 02:19:08 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index e65e8e48ae9..8f07d5bff0e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230617
+20230618
commit 1e96427c6c5a0d7c4166cbb35dff89f0fbb8d4bb
Author: GCC Administrator
Date: Mon Jun 19 02:19:11 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 8f07d5bff0e..b45a5ceabca 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230618
+20230619
commit 9856b87fa399ad1e2cbc5c708f4c5faf444f460a
Author: GCC Administrator
Date: Tue Jun 20 02:19:45 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b45a5ceabca..414ba4c8afb 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230619
+20230620
commit bccc9960eb728bfd890c9388593bd166efcd0591
Author: Kewen Lin
Date: Mon Jun 12 08:07:52 2023
rs6000: Don't use TFmode for 128 bits fp constant in toc [PR110011]
As PR110011 shows, when encoding 128 bits fp constant into
toc, we adopts REAL_VALUE_TO_TARGET_LONG_DOUBLE which is
to find the first float mode with LONG_DOUBLE_TYPE_SIZE
bits of precision, it would be TFmode here. But the 128
bits fp constant can be with mode IFmode or KFmode, which
doesn't necessarily have the same underlying float format
as the one of TFmode, like this PR exposes, with option
-mabi=ibmlongdouble TFmode has ibm_extended_format while
KFmode has ieee_quad_format, mixing up the formats (the
encoding/decoding ways) would cause unexpected results.
This patch is to make it use constant's own mode instead
of TFmode for real_to_target call.
PR target/110011
gcc/ChangeLog:
* config/rs6000/rs6000.c (output_toc): Use the mode of the 128-bit
floating constant itself for real_to_target call.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr110011.c: New test.
(cherry picked from commit 388809f2afde874180da0669c669e241037eeba0)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c3854a931da..ade91e213d4 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -17042,7 +17042,7 @@ output_toc (FILE *file, rtx x, int labelno, machine_mode mode)
if (DECIMAL_FLOAT_MODE_P (GET_MODE (x)))
REAL_VALUE_TO_TARGET_DECIMAL128 (*CONST_DOUBLE_REAL_VALUE (x), k);
else
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (*CONST_DOUBLE_REAL_VALUE (x), k);
+ real_to_target (k, CONST_DOUBLE_REAL_VALUE (x), GET_MODE (x));
if (TARGET_64BIT)
{
diff --git a/gcc/testsuite/gcc.target/powerpc/pr110011.c b/gcc/testsuite/gcc.target/powerpc/pr110011.c
new file mode 100644
index 00000000000..5b04d3e298a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr110011.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-require-effective-target float128_runtime } */
+/* Force long double to be with IBM format here, to verify
+ _Float128 constant still uses its own format (IEEE) for
+ encoding rather than IBM format. */
+/* { dg-options "-mfp-in-toc -mabi=ibmlongdouble" } */
+/* { dg-add-options float128 } */
+
+#define MPFR_FLOAT128_MAX 0x1.ffffffffffffffffffffffffffffp+16383f128
+
+__attribute__ ((noipa))
+_Float128 f128_max ()
+{
+ return MPFR_FLOAT128_MAX;
+}
+
+typedef union
+{
+ int w[4];
+ _Float128 f128;
+} U;
+
+int main ()
+{
+
+ U umax;
+ umax.f128 = f128_max ();
+ /* ieee float128 max:
+ 7ffeffff ffffffff ffffffff ffffffff. */
+ if (umax.w[1] != 0xffffffff || umax.w[2] != 0xffffffff)
+ __builtin_abort ();
+#ifdef __LITTLE_ENDIAN__
+ if (umax.w[0] != 0xffffffff || umax.w[3] != 0x7ffeffff)
+ __builtin_abort ();
+#else
+ if (umax.w[3] != 0xffffffff || umax.w[0] != 0x7ffeffff)
+ __builtin_abort ();
+#endif
+
+ return 0;
+}
+
commit db291447877aae67979ce3655fcc6fc877f57c6a
Author: Kewen Lin
Date: Tue Jun 20 08:40:52 2023
rs6000: Guard __builtin_{un,}pack_vector_int128 with vsx [PR109932]
As PR109932 shows, builtins __builtin_{un,}pack_vector_int128
should be guarded under vsx rather than power7, as their
corresponding bif patterns have the conditions TARGET_VSX
and VECTOR_MEM_ALTIVEC_OR_VSX_P (V1TImode). This patch is to
ensure __builtin_{un,}pack_vector_int128 only available under
vsx.
PR target/109932
gcc/ChangeLog:
* config/rs6000/rs6000-builtin.def (BU_VSX_MISC_2): New macro.
({un,}pack_vector_int128): Use BU_VSX_MISC_2 instead of
BU_P7_MISC_2.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr109932-1.c: New test.
* gcc.target/powerpc/pr109932-2.c: New test.
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index b0f8c708698..09098a70ff9 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -325,6 +325,14 @@
| RS6000_BTC_SPECIAL), \
CODE_FOR_nothing) /* ICODE */
+#define BU_VSX_MISC_2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
/* VSX overloaded builtin function macros. */
#define BU_VSX_OVERLOAD_1(ENUM, NAME) \
RS6000_BUILTIN_1 (VSX_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
@@ -2843,8 +2851,8 @@ BU_LDBL128_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf)
BU_IBM128_2 (PACK_IF, "pack_ibm128", CONST, packif)
BU_IBM128_2 (UNPACK_IF, "unpack_ibm128", CONST, unpackif)
-BU_P7_MISC_2 (PACK_V1TI, "pack_vector_int128", CONST, packv1ti)
-BU_P7_MISC_2 (UNPACK_V1TI, "unpack_vector_int128", CONST, unpackv1ti)
+BU_VSX_MISC_2 (PACK_V1TI, "pack_vector_int128", CONST, packv1ti)
+BU_VSX_MISC_2 (UNPACK_V1TI, "unpack_vector_int128", CONST, unpackv1ti)
/* 2 argument DFP (Decimal Floating Point) functions added in ISA 3.0. */
BU_P9_DFP_MISC_2 (TSTSFI_LT_DD, "dtstsfi_lt_dd", CONST, dfptstsfi_lt_dd)
diff --git a/gcc/testsuite/gcc.target/powerpc/pr109932-1.c b/gcc/testsuite/gcc.target/powerpc/pr109932-1.c
new file mode 100644
index 00000000000..374d9f60618
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr109932-1.c
@@ -0,0 +1,17 @@
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -mno-vsx" } */
+
+/* Verify there is no ICE but one expected error message instead. */
+
+#include
+
+extern vector signed __int128 res_vslll;
+extern unsigned long long aull[2];
+
+void
+testVectorInt128Pack ()
+{
+ res_vslll = __builtin_pack_vector_int128 (aull[0], aull[1]); /* { dg-error "'__builtin_pack_vector_int128' requires the '-mvsx' option" } */
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr109932-2.c b/gcc/testsuite/gcc.target/powerpc/pr109932-2.c
new file mode 100644
index 00000000000..374d9f60618
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr109932-2.c
@@ -0,0 +1,17 @@
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -mno-vsx" } */
+
+/* Verify there is no ICE but one expected error message instead. */
+
+#include
+
+extern vector signed __int128 res_vslll;
+extern unsigned long long aull[2];
+
+void
+testVectorInt128Pack ()
+{
+ res_vslll = __builtin_pack_vector_int128 (aull[0], aull[1]); /* { dg-error "'__builtin_pack_vector_int128' requires the '-mvsx' option" } */
+}
+
commit 8eefa55e3b953a6783170722330ddfbfd11bb0a3
Author: GCC Administrator
Date: Wed Jun 21 02:19:11 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 681673e844d..9f9687bb222 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2023-06-20 Kewen Lin
+
+ PR target/109932
+ * config/rs6000/rs6000-builtin.def (BU_VSX_MISC_2): New macro.
+ ({un,}pack_vector_int128): Use BU_VSX_MISC_2 instead of
+ BU_P7_MISC_2.
+
+2023-06-20 Kewen Lin
+
+ Backported from master:
+ 2023-06-12 Kewen Lin
+
+ PR target/110011
+ * config/rs6000/rs6000.c (output_toc): Use the mode of the 128-bit
+ floating constant itself for real_to_target call.
+
2023-06-12 Richard Biener
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 414ba4c8afb..047f836b4f3 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230620
+20230621
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0a2cd0dbd47..18ecea9c0e8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2023-06-20 Kewen Lin
+
+ PR target/109932
+ * gcc.target/powerpc/pr109932-1.c: New test.
+ * gcc.target/powerpc/pr109932-2.c: New test.
+
+2023-06-20 Kewen Lin
+
+ Backported from master:
+ 2023-06-12 Kewen Lin
+
+ PR target/110011
+ * gcc.target/powerpc/pr110011.c: New test.
+
2023-06-09 Alex Coplan
Backported from master:
commit 11cee01d3cb06164a5f3425c978cd0b162570d9d
Author: GCC Administrator
Date: Thu Jun 22 02:18:49 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 047f836b4f3..2fa39115675 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230621
+20230622
commit 8c150c7618cc76baf0c8bb278f541b327039b160
Author: GCC Administrator
Date: Fri Jun 23 02:19:13 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2fa39115675..0d054fa2ec3 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230622
+20230623
commit 5fc6b3a03355e1f77a7c38c0fa7afb0822ad954f
Author: Jonathan Wakely
Date: Fri Mar 18 14:10:01 2022
libstdc++: Simplify constraints for std::any construction [PR104242]
Partially revert r12-4190-g6da36b7d0e43b6f9281c65c19a025d4888a25b2d
because using __and_<..., is_copy_constructible> when T is incomplete
results in an error about deriving from is_copy_constructible when
that is incomplete. I don't know how to fix that, so this simply
restores the previous constraint which worked in this case (even though
I think it's technically undefined to use is_copy_constructible with
incomplete T). This doesn't restore exactly what we had before, but uses
the is_copy_constructible_v and __is_in_place_type_v variable templates
instead of the ::value member.
libstdc++-v3/ChangeLog:
PR libstdc++/104242
* include/std/any (any(T&&)): Revert change to constraints.
* testsuite/20_util/any/cons/104242.cc: New test.
(cherry picked from commit 7a42b1fa1a090ead96cc0f94a8060a9650c810d5)
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index d96ea06c1ae..5aec4040064 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -184,8 +184,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Construct with a copy of @p __value as the contained object.
template ,
typename _Mgr = _Manager<_VTp>,
- typename = _Require<__not_<__is_in_place_type<_VTp>>,
- is_copy_constructible<_VTp>>>
+ enable_if_t
+ && !__is_in_place_type_v<_VTp>, bool> = true>
any(_Tp&& __value)
: _M_manager(&_Mgr::_S_manage)
{
diff --git a/libstdc++-v3/testsuite/20_util/any/cons/104242.cc b/libstdc++-v3/testsuite/20_util/any/cons/104242.cc
new file mode 100644
index 00000000000..8d5868b7ff9
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/any/cons/104242.cc
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++17 } }
+
+// PR libstdc++/104242 - Class with constructor from std::any is not copyable
+
+#include
+#include
+
+struct A {
+ A(const A&) = default;
+ explicit A(std::any value);
+};
+static_assert(std::is_copy_constructible_v);
commit c0bc9846d9e38bbeeef6723b3c44d5977e95b827
Author: Jonathan Wakely
Date: Mon May 15 22:41:56 2023
libstdc++: Document removal of implicit allocator rebinding extensions
Traditionally libstdc++ allowed containers to be
instantiated with allocator's that have the wrong value type, implicitly
rebinding the allocator to the container's value type. Since C++20 that
has been explicitly ill-formed, so the extension is no longer supported
in strict modes (e.g. -std=c++17) and in C++20 and later.
libstdc++-v3/ChangeLog:
* doc/xml/manual/evolution.xml: Document removal of implicit
allocator rebinding extensions in strict mode and for C++20.
* doc/html/*: Regenerate.
(cherry picked from commit 8cbaf679a3c1875c5475bd1cb0fb86fb9d03b2d4)
diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html
index 70889a583f9..617c457e155 100644
--- a/libstdc++-v3/doc/html/manual/api.html
+++ b/libstdc++-v3/doc/html/manual/api.html
@@ -368,6 +368,11 @@ now defaults to zero.
For the non-default --enable-symvers=gnu-versioned-namespace
configuration, the shared library SONAME has been changed to
libstdc++.so.8.
+
+ The extension allowing containers to be instantiated with an allocator
+ that doesn't match the container's value type is no longer allowed in
+ strict (-std=c++NN) modes, only in
+ -std=gnu++NN modes.
9
C++17 header
<memory_resource>
@@ -423,6 +428,10 @@ now defaults to zero.
and
<stop_token>
added.
+
+ The extension allowing containers to be instantiated with an allocator
+ that doesn't match the container's value type is no longer allowed in
+ C++20 mode, even in non-strict -std=gnu++20 mode.
11
The --enable-cheaders=c_std configuration
was deprecated.
diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml b/libstdc++-v3/doc/xml/manual/evolution.xml
index 55b8903baff..6ae6b5aec19 100644
--- a/libstdc++-v3/doc/xml/manual/evolution.xml
+++ b/libstdc++-v3/doc/xml/manual/evolution.xml
@@ -911,6 +911,13 @@ now defaults to zero.
libstdc++.so.8.
+
+ The extension allowing containers to be instantiated with an allocator
+ that doesn't match the container's value type is no longer allowed in
+ strict () modes, only in
+ modes.
+
+
9
@@ -994,6 +1001,12 @@ now defaults to zero.
added.
+
+ The extension allowing containers to be instantiated with an allocator
+ that doesn't match the container's value type is no longer allowed in
+ C++20 mode, even in non-strict mode.
+
+
11
commit 71aa76fd4e3bae422ea4d0b0213a5de9bff0ce0d
Author: GCC Administrator
Date: Sat Jun 24 02:18:57 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 0d054fa2ec3..cbffb8130b6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230623
+20230624
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a810cb4e260..2041fb7219a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,21 @@
+2023-06-23 Jonathan Wakely
+
+ Backported from master:
+ 2023-06-01 Jonathan Wakely
+
+ * doc/xml/manual/evolution.xml: Document removal of implicit
+ allocator rebinding extensions in strict mode and for C++20.
+ * doc/html/*: Regenerate.
+
+2023-06-23 Jonathan Wakely
+
+ Backported from master:
+ 2022-03-18 Jonathan Wakely
+
+ PR libstdc++/104242
+ * include/std/any (any(T&&)): Revert change to constraints.
+ * testsuite/20_util/any/cons/104242.cc: New test.
+
2023-05-30 Matthias Kretz
Backported from master:
commit b4bda3508a9e22638637f580f88ab4f0f06b9a21
Author: GCC Administrator
Date: Sun Jun 25 02:18:30 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index cbffb8130b6..2ee91bf4891 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230624
+20230625
commit 4a58e1510096de54a8ff25f0413bebca6d23c91f
Author: GCC Administrator
Date: Mon Jun 26 02:19:02 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2ee91bf4891..2cf61a4ffbf 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230625
+20230626
commit a0c4bd656e0fce16d62877e0eb53ac11b1924d0c
Author: Iain Buclaw
Date: Mon Jun 26 03:24:27 2023
d: Suboptimal codegen for __builtin_expect(cond, false)
Since PR96435, both boolean objects and expressions have been evaluated
in the following way.
(*(ubyte*)&obj_or_expr) & 1
It has been noted that sometimes this can cause the back-end to optimize
in non-obvious ways - in particular with __builtin_expect.
This @safe feature is now restricted to just when reading the value of a
bool field that comes from a union.
PR d/110359
gcc/d/ChangeLog:
* d-convert.cc (convert_for_rvalue): Only apply the @safe boolean
conversion to boolean fields of a union.
(convert_for_condition): Call convert_for_rvalue in the default case.
gcc/testsuite/ChangeLog:
* gdc.dg/pr110359.d: New test.
(cherry picked from commit ab98db1e8c1b997414539f41b7fb814019497d8d)
diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc
index cd6551e64f3..135aaf7e049 100644
--- a/gcc/d/d-convert.cc
+++ b/gcc/d/d-convert.cc
@@ -611,7 +611,7 @@ convert_expr (tree exp, Type *etype, Type *totype)
return result ? result : convert (build_ctype (totype), exp);
}
-/* Return a TREE represenwation of EXPR, whose type has been converted from
+/* Return a TREE representation of EXPR, whose type has been converted from
* ETYPE to TOTYPE, and is being used in an rvalue context. */
tree
@@ -627,20 +627,27 @@ convert_for_rvalue (tree expr, Type *etype, Type *totype)
case Tbool:
/* If casting from bool, the result is either 0 or 1, any other value
violates @safe code, so enforce that it is never invalid. */
- if (CONSTANT_CLASS_P (expr))
- result = d_truthvalue_conversion (expr);
- else
+ for (tree ref = expr; TREE_CODE (ref) == COMPONENT_REF;
+ ref = TREE_OPERAND (ref, 0))
{
- /* Reinterpret the boolean as an integer and test the first bit.
- The generated code should end up being equivalent to:
+ /* If the expression is a field that's part of a union, reinterpret
+ the boolean as an integer and test the first bit. The generated
+ code should end up being equivalent to:
*cast(ubyte *)&expr & 1; */
- machine_mode bool_mode = TYPE_MODE (TREE_TYPE (expr));
- tree mtype = lang_hooks.types.type_for_mode (bool_mode, 1);
- result = fold_build2 (BIT_AND_EXPR, mtype,
- build_vconvert (mtype, expr),
- build_one_cst (mtype));
+ if (TREE_CODE (TREE_TYPE (TREE_OPERAND (ref, 0))) == UNION_TYPE)
+ {
+ machine_mode bool_mode = TYPE_MODE (TREE_TYPE (expr));
+ tree mtype = lang_hooks.types.type_for_mode (bool_mode, 1);
+ result = fold_build2 (BIT_AND_EXPR, mtype,
+ build_vconvert (mtype, expr),
+ build_one_cst (mtype));
+ break;
+ }
}
+ if (result == NULL_TREE)
+ result = d_truthvalue_conversion (expr);
+
result = convert (build_ctype (tbtype), result);
break;
}
@@ -838,7 +845,7 @@ convert_for_condition (tree expr, Type *type)
break;
default:
- result = expr;
+ result = convert_for_rvalue (expr, type, type);
break;
}
diff --git a/gcc/testsuite/gdc.dg/pr110359.d b/gcc/testsuite/gdc.dg/pr110359.d
new file mode 100644
index 00000000000..bf69201d9a5
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr110359.d
@@ -0,0 +1,22 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110359
+// { dg-do compile }
+// { dg-options "-fdump-tree-original" }
+double pow(in double x, in ulong p)
+{
+ import gcc.builtins : __builtin_expect;
+ if (__builtin_expect(p == 0, false))
+ return 1;
+ if (__builtin_expect(p == 1, false))
+ return x;
+
+ double s = x;
+ double v = 1;
+ for (ulong i = p; i > 1; i >>= 1)
+ {
+ v = (i & 0x1) ? s * v : v;
+ s = s * s;
+ }
+ return v * s;
+}
+// { dg-final { scan-tree-dump "if \\(__builtin_expect \\(p == 0, 0\\) != 0\\)" "original" } }
+// { dg-final { scan-tree-dump "if \\(__builtin_expect \\(p == 1, 0\\) != 0\\)" "original" } }
commit fcb19b902aeeece3dbb0c7ce25c25f5ea203ee1e
Author: GCC Administrator
Date: Tue Jun 27 02:20:37 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2cf61a4ffbf..36a241c62ca 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230626
+20230627
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 4d0ad3a0dde..36e2ba84ff7 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,13 @@
+2023-06-26 Iain Buclaw
+
+ Backported from master:
+ 2023-06-26 Iain Buclaw
+
+ PR d/110359
+ * d-convert.cc (convert_for_rvalue): Only apply the @safe boolean
+ conversion to boolean fields of a union.
+ (convert_for_condition): Call convert_for_rvalue in the default case.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 18ecea9c0e8..9a3cee67ce5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-26 Iain Buclaw
+
+ Backported from master:
+ 2023-06-26 Iain Buclaw
+
+ PR d/110359
+ * gdc.dg/pr110359.d: New test.
+
2023-06-20 Kewen Lin
PR target/109932
commit 0270026634e82ced51dccdbfbbfe401662e08f7d
Author: GCC Administrator
Date: Wed Jun 28 02:20:10 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 36a241c62ca..fff3166d023 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230627
+20230628
commit 3942da3db0983a51b90b93decb64c6ed166f7b15
Author: liuhongt
Date: Mon Jun 26 03:50:25 2023
Make option mvzeroupper independent of optimization level.
pass_insert_vzeroupper is under condition
TARGET_AVX && TARGET_VZEROUPPER
&& flag_expensive_optimizations && !optimize_size
But the document of mvzeroupper doesn't mention the insertion
required -O2 and above, it may confuse users when they explicitly
use -Os -mvzeroupper.
------------
mvzeroupper
Target Mask(VZEROUPPER) Save
Generate vzeroupper instruction before a transfer of control flow out of
the function.
------------
The patch moves flag_expensive_optimizations && !optimize_size to
ix86_option_override_internal. It makes -mvzeroupper independent of
optimization level, but still keeps the behavior of architecture
tuning(emit_vzeroupper) unchanged.
gcc/ChangeLog:
* config/i386/i386-features.c (pass_insert_vzeroupper:gate):
Move flag_expensive_optimizations && !optimize_size to ..
* config/i386/i386-options.c (ix86_option_override_internal):
.. this, it makes -mvzeroupper independent of optimization
level, but still keeps the behavior of architecture
tuning(emit_vzeroupper) unchanged.
(rest_of_handle_insert_vzeroupper): Remove
flag_expensive_optimizations && !optimize_size.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx-vzeroupper-29.c: New testcase.
diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c
index 77783a154b6..19033dc3df5 100644
--- a/gcc/config/i386/i386-features.c
+++ b/gcc/config/i386/i386-features.c
@@ -1837,9 +1837,7 @@ ix86_add_reg_usage_to_vzerouppers (void)
static unsigned int
rest_of_handle_insert_vzeroupper (void)
{
- if (TARGET_VZEROUPPER
- && flag_expensive_optimizations
- && !optimize_size)
+ if (TARGET_VZEROUPPER)
{
/* vzeroupper instructions are inserted immediately after reload to
account for possible spills from 256bit or 512bit registers. The pass
@@ -1883,9 +1881,7 @@ public:
virtual bool gate (function *)
{
return TARGET_AVX
- && ((TARGET_VZEROUPPER
- && flag_expensive_optimizations
- && !optimize_size)
+ && (TARGET_VZEROUPPER
|| cfun->machine->has_explicit_vzeroupper);
}
diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
index b74df4d549e..d47a5433126 100644
--- a/gcc/config/i386/i386-options.c
+++ b/gcc/config/i386/i386-options.c
@@ -2849,7 +2849,9 @@ ix86_option_override_internal (bool main_args_p,
sorry ("%<-mcall-ms2sysv-xlogues%> isn%'t currently supported with SEH");
if (!(opts_set->x_target_flags & MASK_VZEROUPPER)
- && TARGET_EMIT_VZEROUPPER)
+ && TARGET_EMIT_VZEROUPPER
+ && flag_expensive_optimizations
+ && !optimize_size)
opts->x_target_flags |= MASK_VZEROUPPER;
if (!(opts_set->x_target_flags & MASK_STV))
opts->x_target_flags |= MASK_STV;
diff --git a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-29.c b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-29.c
new file mode 100644
index 00000000000..4af637757f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-29.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx -mtune=generic -mvzeroupper -dp" } */
+
+#include
+
+extern __m256 x, y;
+
+void
+foo ()
+{
+ x = y;
+}
+
+/* { dg-final { scan-assembler-times "avx_vzeroupper" 1 } } */
commit e1bd4f5434d7989d723188e9f2b524ce234bc44d
Author: Rainer Orth
Date: Thu May 7 13:26:57 2015
Support parallel testing in libgomp, part I [PR66005]
..., while still hard-coding the number of parallel slots to one.
PR testsuite/66005
libgomp/
* testsuite/Makefile.am (PWD_COMMAND): New variable.
(%/site.exp): New target.
(check_p_numbers0, check_p_numbers1, check_p_numbers2)
(check_p_numbers3, check_p_numbers4, check_p_numbers5)
(check_p_numbers6, check_p_numbers, gcc_test_parallel_slots)
(check_p_subdirs)
(check_DEJAGNU_libgomp_targets): New variables.
($(check_DEJAGNU_libgomp_targets)): New target.
($(check_DEJAGNU_libgomp_targets)): New dependency.
(check-DEJAGNU $(check_DEJAGNU_libgomp_targets)): New targets.
* testsuite/Makefile.in: Regenerate.
* testsuite/lib/libgomp.exp: For parallel testing,
'load_file ../libgomp-test-support.exp'.
Co-authored-by: Thomas Schwinge
(cherry picked from commit e797db5c744f7b4e110f23a495fca8e6b8aebe83)
diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
index 655a413c160..eef02f4a8c2 100644
--- a/libgomp/testsuite/Makefile.am
+++ b/libgomp/testsuite/Makefile.am
@@ -12,6 +12,8 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+PWD_COMMAND = $${PWDCMD-pwd}
+
EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
# Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
@@ -25,17 +27,6 @@ libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile
'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
mv $@.tmp $@
-check-DEJAGNU: site.exp
- srcdir='$(srcdir)'; export srcdir; \
- EXPECT=$(EXPECT); export EXPECT; \
- if $(SHELL) -c "$(_RUNTEST) --version" > /dev/null 2>&1; then \
- exit_status=0; l='$(PACKAGE)'; for tool in $$l; do \
- if $(_RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
- then :; else exit_status=1; fi; \
- done; \
- else echo "WARNING: could not find '$(_RUNTEST)'" 1>&2; :;\
- fi; \
- exit $$exit_status
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@@ -63,6 +54,71 @@ site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
+%/site.exp: site.exp
+ -@test -d $* || mkdir $*
+ @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
+ @objdir=`${PWD_COMMAND}`/$*; \
+ sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
+ -e "s|^set objdir .*$$|set objdir $$objdir|" \
+ site.exp > $*/site.exp.tmp
+ @-rm -f $*/site.bak
+ @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
+ @mv $*/site.exp.tmp $*/site.exp
+
+check_p_numbers0:=1 2 3 4 5 6 7 8 9
+check_p_numbers1:=0 $(check_p_numbers0)
+check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
+check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
+check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
+check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
+check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
+check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
+gcc_test_parallel_slots:=1
+check_p_subdirs=$(wordlist 1,$(gcc_test_parallel_slots),$(check_p_numbers))
+check_DEJAGNU_libgomp_targets = $(addprefix check-DEJAGNUlibgomp,$(check_p_subdirs))
+$(check_DEJAGNU_libgomp_targets): check-DEJAGNUlibgomp%: libgomp%/site.exp
+
+check-DEJAGNU $(check_DEJAGNU_libgomp_targets): check-DEJAGNU%: site.exp
+ $(if $*,@)AR="$(AR)"; export AR; \
+ RANLIB="$(RANLIB)"; export RANLIB; \
+ if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
+ rm -rf libgomp-parallel || true; \
+ mkdir libgomp-parallel; \
+ $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_libgomp_targets); \
+ rm -rf libgomp-parallel || true; \
+ for idx in $(check_p_subdirs); do \
+ if [ -d libgomp$$idx ]; then \
+ mv -f libgomp$$idx/libgomp.sum libgomp$$idx/libgomp.sum.sep; \
+ mv -f libgomp$$idx/libgomp.log libgomp$$idx/libgomp.log.sep; \
+ fi; \
+ done; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+ libgomp[0-9]*/libgomp.sum.sep > libgomp.sum; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+ libgomp[0-9]*/libgomp.log.sep > libgomp.log; \
+ exit 0; \
+ fi; \
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(_RUNTEST); \
+ if [ -z "$$runtest" ]; then runtest=runtest; fi; \
+ tool=libgomp; \
+ if [ -n "$*" ]; then \
+ if [ -f libgomp-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \
+ GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/libgomp-parallel; \
+ export GCC_RUNTEST_PARALLELIZE_DIR; \
+ cd "$*"; \
+ fi; \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
+ $(RUNTESTFLAGS); \
+ if [ -n "$*" ]; then \
+ touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \
+ fi; \
+ else \
+ echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi
+
distclean-DEJAGNU:
-rm -f site.exp site.bak
-l='$(PACKAGE)'; for tool in $$l; do \
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index e48c3f2f9b0..c29c16c1e7f 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -310,7 +310,19 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+PWD_COMMAND = $${PWDCMD-pwd}
EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
+check_p_numbers0 := 1 2 3 4 5 6 7 8 9
+check_p_numbers1 := 0 $(check_p_numbers0)
+check_p_numbers2 := $(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
+check_p_numbers3 := $(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
+check_p_numbers4 := $(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
+check_p_numbers5 := $(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
+check_p_numbers6 := $(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
+check_p_numbers := $(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
+gcc_test_parallel_slots := 1
+check_p_subdirs = $(wordlist 1,$(gcc_test_parallel_slots),$(check_p_numbers))
+check_DEJAGNU_libgomp_targets = $(addprefix check-DEJAGNUlibgomp,$(check_p_subdirs))
all: all-am
.SUFFIXES:
@@ -485,17 +497,6 @@ libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile
'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
mv $@.tmp $@
-check-DEJAGNU: site.exp
- srcdir='$(srcdir)'; export srcdir; \
- EXPECT=$(EXPECT); export EXPECT; \
- if $(SHELL) -c "$(_RUNTEST) --version" > /dev/null 2>&1; then \
- exit_status=0; l='$(PACKAGE)'; for tool in $$l; do \
- if $(_RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
- then :; else exit_status=1; fi; \
- done; \
- else echo "WARNING: could not find '$(_RUNTEST)'" 1>&2; :;\
- fi; \
- exit $$exit_status
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@@ -523,6 +524,59 @@ site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
+%/site.exp: site.exp
+ -@test -d $* || mkdir $*
+ @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
+ @objdir=`${PWD_COMMAND}`/$*; \
+ sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
+ -e "s|^set objdir .*$$|set objdir $$objdir|" \
+ site.exp > $*/site.exp.tmp
+ @-rm -f $*/site.bak
+ @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
+ @mv $*/site.exp.tmp $*/site.exp
+$(check_DEJAGNU_libgomp_targets): check-DEJAGNUlibgomp%: libgomp%/site.exp
+
+check-DEJAGNU $(check_DEJAGNU_libgomp_targets): check-DEJAGNU%: site.exp
+ $(if $*,@)AR="$(AR)"; export AR; \
+ RANLIB="$(RANLIB)"; export RANLIB; \
+ if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
+ rm -rf libgomp-parallel || true; \
+ mkdir libgomp-parallel; \
+ $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_libgomp_targets); \
+ rm -rf libgomp-parallel || true; \
+ for idx in $(check_p_subdirs); do \
+ if [ -d libgomp$$idx ]; then \
+ mv -f libgomp$$idx/libgomp.sum libgomp$$idx/libgomp.sum.sep; \
+ mv -f libgomp$$idx/libgomp.log libgomp$$idx/libgomp.log.sep; \
+ fi; \
+ done; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+ libgomp[0-9]*/libgomp.sum.sep > libgomp.sum; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+ libgomp[0-9]*/libgomp.log.sep > libgomp.log; \
+ exit 0; \
+ fi; \
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(_RUNTEST); \
+ if [ -z "$$runtest" ]; then runtest=runtest; fi; \
+ tool=libgomp; \
+ if [ -n "$*" ]; then \
+ if [ -f libgomp-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \
+ GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/libgomp-parallel; \
+ export GCC_RUNTEST_PARALLELIZE_DIR; \
+ cd "$*"; \
+ fi; \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
+ $(RUNTESTFLAGS); \
+ if [ -n "$*" ]; then \
+ touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \
+ fi; \
+ else \
+ echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi
+
distclean-DEJAGNU:
-rm -f site.exp site.bak
-l='$(PACKAGE)'; for tool in $$l; do \
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 46cce9b8445..e484969c495 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -40,7 +40,12 @@ load_gcc_lib torture-options.exp
load_gcc_lib fortran-modules.exp
# Try to load a test support file, built during libgomp configuration.
-load_file libgomp-test-support.exp
+# Search in '..' vs. '.' to support parallel vs. sequential testing.
+if [info exists ::env(GCC_RUNTEST_PARALLELIZE_DIR)] {
+ load_file ../libgomp-test-support.exp
+} else {
+ load_file libgomp-test-support.exp
+}
set dg-do-what-default run
commit 4506b349cf527834239554a03e43ae45237b315c
Author: Thomas Schwinge
Date: Tue Apr 25 23:53:12 2023
Support parallel testing in libgomp, part II [PR66005]
..., and enable if 'flock' is available for serializing execution testing.
Regarding the default of 19 parallel slots, this turned out to be a local
minimum for wall time when testing this on:
$ uname -srvi
Linux 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64
$ grep '^model name' < /proc/cpuinfo | uniq -c
32 model name : Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
... in two configurations: case (a) standard configuration, no offloading
configured, case (b) offloading for GCN and nvptx configured but no devices
available. For both cases, default plus '-m32' variant.
$ \time make check-target-libgomp RUNTESTFLAGS="--target_board=unix\{,-m32\}"
Case (a), baseline:
6432.23user 332.38system 47:32.28elapsed 237%CPU (0avgtext+0avgdata 505044maxresident)k
6382.43user 319.21system 47:06.04elapsed 237%CPU (0avgtext+0avgdata 505172maxresident)k
This is what people have been complaining about, rightly so, in
"libgomp make check time is excessive" and
elsewhere.
Case (a), parallelized:
-j12 GCC_TEST_PARALLEL_SLOTS=10
3088.49user 267.74system 6:43.82elapsed 831%CPU (0avgtext+0avgdata 505188maxresident)k
-j15 GCC_TEST_PARALLEL_SLOTS=15
3308.08user 294.79system 5:56.04elapsed 1011%CPU (0avgtext+0avgdata 505360maxresident)k
-j17 GCC_TEST_PARALLEL_SLOTS=17
3539.93user 298.99system 5:27.86elapsed 1170%CPU (0avgtext+0avgdata 505112maxresident)k
-j18 GCC_TEST_PARALLEL_SLOTS=18
3697.50user 317.18system 5:14.63elapsed 1275%CPU (0avgtext+0avgdata 505360maxresident)k
-j19 GCC_TEST_PARALLEL_SLOTS=19
3765.94user 324.27system 5:13.22elapsed 1305%CPU (0avgtext+0avgdata 505128maxresident)k
-j20 GCC_TEST_PARALLEL_SLOTS=20
3684.66user 312.32system 5:15.26elapsed 1267%CPU (0avgtext+0avgdata 505100maxresident)k
-j23 GCC_TEST_PARALLEL_SLOTS=23
4040.59user 347.10system 5:29.12elapsed 1333%CPU (0avgtext+0avgdata 505200maxresident)k
-j26 GCC_TEST_PARALLEL_SLOTS=26
3973.24user 377.96system 5:24.70elapsed 1340%CPU (0avgtext+0avgdata 505160maxresident)k
-j32 GCC_TEST_PARALLEL_SLOTS=32
4004.42user 346.10system 5:16.11elapsed 1376%CPU (0avgtext+0avgdata 505160maxresident)k
Yay!
Case (b), baseline; 2+ h:
7227.58user 700.54system 2:14:33elapsed 98%CPU (0avgtext+0avgdata 994264maxresident)k
Case (b), parallelized:
-j12 GCC_TEST_PARALLEL_SLOTS=10
7377.46user 777.52system 16:06.63elapsed 843%CPU (0avgtext+0avgdata 994344maxresident)k
-j15 GCC_TEST_PARALLEL_SLOTS=15
8019.18user 721.42system 12:13.56elapsed 1191%CPU (0avgtext+0avgdata 994228maxresident)k
-j17 GCC_TEST_PARALLEL_SLOTS=17
8530.11user 716.95system 10:45.92elapsed 1431%CPU (0avgtext+0avgdata 994176maxresident)k
-j18 GCC_TEST_PARALLEL_SLOTS=18
8776.79user 645.89system 10:27.20elapsed 1502%CPU (0avgtext+0avgdata 994248maxresident)k
-j19 GCC_TEST_PARALLEL_SLOTS=19
9332.37user 641.76system 10:15.09elapsed 1621%CPU (0avgtext+0avgdata 994260maxresident)k
-j20 GCC_TEST_PARALLEL_SLOTS=20
9609.54user 789.88system 10:26.94elapsed 1658%CPU (0avgtext+0avgdata 994284maxresident)k
-j23 GCC_TEST_PARALLEL_SLOTS=23
10362.40user 911.14system 10:44.47elapsed 1749%CPU (0avgtext+0avgdata 994208maxresident)k
-j26 GCC_TEST_PARALLEL_SLOTS=26
11159.44user 850.99system 11:09.25elapsed 1794%CPU (0avgtext+0avgdata 994256maxresident)k
-j32 GCC_TEST_PARALLEL_SLOTS=32
11453.50user 939.52system 11:00.38elapsed 1876%CPU (0avgtext+0avgdata 994240maxresident)k
On my Dell Precision 7530 laptop:
$ uname -srvi
Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64
$ grep '^model name' < /proc/cpuinfo | uniq -c
12 model name : Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
$ nvidia-smi -L
GPU 0: Quadro P1000 (UUID: GPU-e043973b-b52a-d02b-c066-a8fdbf64e8ea)
... in two configurations: case (c) standard configuration, no offloading
configured, case (d) offloading for nvptx configured and device available.
For both cases, only default variant, no '-m32'.
$ \time make check-target-libgomp
Case (c), baseline; roughly half of case (a) (just one variant):
1180.98user 110.80system 19:36.40elapsed 109%CPU (0avgtext+0avgdata 505148maxresident)k
1133.22user 111.08system 19:35.75elapsed 105%CPU (0avgtext+0avgdata 505212maxresident)k
Case (c), parallelized:
-j12 GCC_TEST_PARALLEL_SLOTS=2
1143.83user 110.76system 10:20.46elapsed 202%CPU (0avgtext+0avgdata 505216maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=6
1737.08user 143.94system 4:59.48elapsed 628%CPU (0avgtext+0avgdata 505200maxresident)k
1730.31user 143.02system 4:58.75elapsed 627%CPU (0avgtext+0avgdata 505152maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=8
2192.63user 169.34system 4:52.96elapsed 806%CPU (0avgtext+0avgdata 505216maxresident)k
2219.04user 167.67system 4:53.19elapsed 814%CPU (0avgtext+0avgdata 505152maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=10
2463.93user 184.98system 4:48.39elapsed 918%CPU (0avgtext+0avgdata 505200maxresident)k
2455.62user 183.68system 4:47.40elapsed 918%CPU (0avgtext+0avgdata 505216maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=12
2591.04user 192.64system 4:44.98elapsed 976%CPU (0avgtext+0avgdata 505216maxresident)k
2581.23user 195.21system 4:47.51elapsed 965%CPU (0avgtext+0avgdata 505212maxresident)k
-j20 GCC_TEST_PARALLEL_SLOTS=20 [oversubscribe]
2613.18user 199.51system 4:44.06elapsed 990%CPU (0avgtext+0avgdata 505216maxresident)k
Case (d), baseline (compared to case (b): only nvptx offloading compilation,
but also nvptx offloading execution); ~1 h:
2841.93user 653.68system 1:02:26elapsed 93%CPU (0avgtext+0avgdata 909792maxresident)k
2842.03user 654.39system 1:02:24elapsed 93%CPU (0avgtext+0avgdata 909880maxresident)k
Case (d), parallelized:
-j12 GCC_TEST_PARALLEL_SLOTS=2
2856.39user 606.87system 33:58.64elapsed 169%CPU (0avgtext+0avgdata 909948maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=6
3444.90user 666.86system 18:37.57elapsed 367%CPU (0avgtext+0avgdata 909856maxresident)k
3462.13user 667.13system 18:36.87elapsed 369%CPU (0avgtext+0avgdata 909872maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=8
3929.74user 716.22system 18:02.36elapsed 429%CPU (0avgtext+0avgdata 909832maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=10
4152.84user 736.16system 17:43.05elapsed 459%CPU (0avgtext+0avgdata 909872maxresident)k
-j12 GCC_TEST_PARALLEL_SLOTS=12
4209.60user 749.00system 17:35.20elapsed 469%CPU (0avgtext+0avgdata 909840maxresident)k
-j20 GCC_TEST_PARALLEL_SLOTS=20 [oversubscribe]
4255.54user 756.78system 17:29.06elapsed 477%CPU (0avgtext+0avgdata 909868maxresident)k
Worth noting is that with nvptx offloading, there is one execution test case
that times out ('libgomp.fortran/reverse-offload-5.f90'). This effectively
stalls progress for almost 5 min: quickly other executions test cases queue up
on the lock for all parallel slots. That's working as expected; just noting
this as it accordingly does skew the wall time numbers.
PR testsuite/66005
libgomp/
* configure.ac: Look for 'flock'.
* testsuite/Makefile.am (gcc_test_parallel_slots): Enable parallel testing.
* testsuite/config/default.exp: Don't 'load_lib "standard.exp"' here...
* testsuite/lib/libgomp.exp: ... but here, instead.
(libgomp_load): Override for parallel testing.
* testsuite/libgomp-site-extra.exp.in (FLOCK): Set.
* configure: Regenerate.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
(cherry picked from commit 6c3b30ef9e0578509bdaf59c13da4a212fe6c2ba)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index eb868b36704..0fdfb2fe73f 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -384,6 +384,7 @@ EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FGREP = @FGREP@
+FLOCK = @FLOCK@
GREP = @GREP@
HSA_RUNTIME_INCLUDE = @HSA_RUNTIME_INCLUDE@
HSA_RUNTIME_LIB = @HSA_RUNTIME_LIB@
diff --git a/libgomp/configure b/libgomp/configure
index 718a76b4a40..0430da74ac9 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -656,6 +656,7 @@ tmake_file
XLDFLAGS
XCFLAGS
config_path
+FLOCK
CPU_COUNT
LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_FALSE
LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE
@@ -11421,7 +11422,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11424 "configure"
+#line 11425 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11527,7 +11528,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11530 "configure"
+#line 11531 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16643,6 +16644,49 @@ $as_echo "unable to detect (assuming 1)" >&6; }
fi
+for ac_prog in flock
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_FLOCK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$FLOCK"; then
+ ac_cv_prog_FLOCK="$FLOCK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_FLOCK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+FLOCK=$ac_cv_prog_FLOCK
+if test -n "$FLOCK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLOCK" >&5
+$as_echo "$FLOCK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$FLOCK" && break
+done
+
+
# Get target configury.
. ${srcdir}/configure.tgt
CFLAGS="$save_CFLAGS $XCFLAGS"
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 0e238b6a559..ea296a28e00 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -331,6 +331,8 @@ fi
AX_COUNT_CPUS
AC_SUBST(CPU_COUNT)
+AC_CHECK_PROGS(FLOCK, flock)
+
# Get target configury.
. ${srcdir}/configure.tgt
CFLAGS="$save_CFLAGS $XCFLAGS"
diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
index eef02f4a8c2..0cc91ccc4d1 100644
--- a/libgomp/testsuite/Makefile.am
+++ b/libgomp/testsuite/Makefile.am
@@ -73,7 +73,8 @@ check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_num
check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
-gcc_test_parallel_slots:=1
+# If unable to serialize execution testing, use just one parallel slot.
+gcc_test_parallel_slots:=$(if $(FLOCK),$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),19),1)
check_p_subdirs=$(wordlist 1,$(gcc_test_parallel_slots),$(check_p_numbers))
check_DEJAGNU_libgomp_targets = $(addprefix check-DEJAGNUlibgomp,$(check_p_subdirs))
$(check_DEJAGNU_libgomp_targets): check-DEJAGNUlibgomp%: libgomp%/site.exp
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index c29c16c1e7f..cd318e3c392 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -162,6 +162,7 @@ EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FGREP = @FGREP@
+FLOCK = @FLOCK@
GREP = @GREP@
HSA_RUNTIME_INCLUDE = @HSA_RUNTIME_INCLUDE@
HSA_RUNTIME_LIB = @HSA_RUNTIME_LIB@
@@ -320,7 +321,8 @@ check_p_numbers4 := $(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_n
check_p_numbers5 := $(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
check_p_numbers6 := $(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
check_p_numbers := $(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
-gcc_test_parallel_slots := 1
+# If unable to serialize execution testing, use just one parallel slot.
+gcc_test_parallel_slots := $(if $(FLOCK),$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),19),1)
check_p_subdirs = $(wordlist 1,$(gcc_test_parallel_slots),$(check_p_numbers))
check_DEJAGNU_libgomp_targets = $(addprefix check-DEJAGNUlibgomp,$(check_p_subdirs))
all: all-am
diff --git a/libgomp/testsuite/config/default.exp b/libgomp/testsuite/config/default.exp
index 20546e371fd..0b383cc83e1 100644
--- a/libgomp/testsuite/config/default.exp
+++ b/libgomp/testsuite/config/default.exp
@@ -13,5 +13,3 @@
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# .
-
-load_lib "standard.exp"
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index e484969c495..bf4b75eb1ad 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -9,6 +9,7 @@ proc load_gcc_lib { filename } {
}
load_lib dg.exp
+load_lib standard.exp
# Required to use gcc-dg.exp - however, the latter should NOT be
# loaded until ${tool}_target_compile is defined since it uses that
@@ -323,6 +324,34 @@ proc libgomp_option_proc { option } {
}
}
+if ![info exists ::env(GCC_RUNTEST_PARALLELIZE_DIR)] {
+ # No parallel testing.
+} elseif { $FLOCK == "" } {
+ # Using just one parallel slot.
+} else {
+ # Using several parallel slots. Override DejaGnu
+ # 'standard.exp:${tool}_load'...
+ rename libgomp_load standard_libgomp_load
+ proc libgomp_load { program args } {
+ # ... in order to serialize execution testing via an exclusive lock.
+ set lock_file ../lock
+ set lock_kind --exclusive
+ set lock_fd [open $lock_file a+]
+ set lock_clock_begin [clock seconds]
+ global FLOCK
+ exec $FLOCK $lock_kind 0 <@ $lock_fd
+ set lock_clock_end [clock seconds]
+ verbose -log "Got ${FLOCK}('$lock_file', '$lock_kind') at [clock format $lock_clock_end] after [expr $lock_clock_end - $lock_clock_begin] s" 2
+
+ set result [standard_libgomp_load $program $args]
+
+ # Unlock (implicit with 'close').
+ close $lock_fd
+
+ return $result
+ }
+}
+
# Translate offload target to OpenACC device type. Return the empty string if
# not supported, and 'host' for offload target 'disable'.
proc offload_target_to_openacc_device_type { offload_target } {
diff --git a/libgomp/testsuite/libgomp-site-extra.exp.in b/libgomp/testsuite/libgomp-site-extra.exp.in
index c0d26660bad..0a3ba059c21 100644
--- a/libgomp/testsuite/libgomp-site-extra.exp.in
+++ b/libgomp/testsuite/libgomp-site-extra.exp.in
@@ -1 +1,2 @@
+set FLOCK {@FLOCK@}
set GCC_UNDER_TEST {@CC@}
commit 91955e374e07dc8ee9111eeb49c137c5582ed674
Author: Thomas Schwinge
Date: Mon May 15 20:00:07 2023
Support parallel testing in libgomp: fallback Perl 'flock' [PR66005]
Follow-up to commit 6c3b30ef9e0578509bdaf59c13da4a212fe6c2ba
"Support parallel testing in libgomp, part II [PR66005]"
("..., and enable if 'flock' is available for serializing execution testing"),
where we saw:
> On my Dell Precision 7530 laptop:
>
> $ uname -srvi
> Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64
> $ grep '^model name' < /proc/cpuinfo | uniq -c
> 12 model name : Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
> $ nvidia-smi -L
> GPU 0: Quadro P1000 (UUID: GPU-e043973b-b52a-d02b-c066-a8fdbf64e8ea)
>
> ... [...]: case (c) standard configuration, no offloading
> configured, [...]
> $ \time make check-target-libgomp
>
> Case (c), baseline; [...]:
>
> 1180.98user 110.80system 19:36.40elapsed 109%CPU (0avgtext+0avgdata 505148maxresident)k
> 1133.22user 111.08system 19:35.75elapsed 105%CPU (0avgtext+0avgdata 505212maxresident)k
>
> Case (c), parallelized [using 'flock']:
>
> [...]
> -j12 GCC_TEST_PARALLEL_SLOTS=12
> 2591.04user 192.64system 4:44.98elapsed 976%CPU (0avgtext+0avgdata 505216maxresident)k
> 2581.23user 195.21system 4:47.51elapsed 965%CPU (0avgtext+0avgdata 505212maxresident)k
Quite the same when instead of 'flock' using this fallback Perl 'flock':
2565.23user 194.35system 4:46.77elapsed 962%CPU (0avgtext+0avgdata 505216maxresident)k
2549.38user 200.20system 4:46.08elapsed 961%CPU (0avgtext+0avgdata 505216maxresident)k
PR testsuite/66005
gcc/
* doc/install.texi: Document (optional) Perl usage for parallel
testing of libgomp.
libgomp/
* testsuite/lib/libgomp.exp: 'flock' through stdout.
* testsuite/flock: New.
* configure.ac (FLOCK): Point to that if no 'flock' available, but
'perl' is.
* configure: Regenerate.
(cherry picked from commit 04abe1944d30eb18a2060cfcd9695d085f7b4752)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 4b05ccfaffb..68a0f2b04e9 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -363,6 +363,9 @@ tables.
Used by @command{automake}.
+If available, enables parallel testing of @samp{libgomp} in case that
+@command{flock} is not available.
+
@end table
Several support libraries are necessary to build GCC, some are required,
diff --git a/libgomp/configure b/libgomp/configure
index 0430da74ac9..6aee94291ea 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -16644,6 +16644,8 @@ $as_echo "unable to detect (assuming 1)" >&6; }
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock implementation" >&5
+$as_echo "$as_me: checking for flock implementation" >&6;}
for ac_prog in flock
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -16686,6 +16688,46 @@ fi
test -n "$FLOCK" && break
done
+# Fallback if 'perl' is available.
+if test -z "$FLOCK"; then
+ # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_FLOCK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$FLOCK"; then
+ ac_cv_prog_FLOCK="$FLOCK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_FLOCK="$srcdir/testsuite/flock"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+FLOCK=$ac_cv_prog_FLOCK
+if test -n "$FLOCK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLOCK" >&5
+$as_echo "$FLOCK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
# Get target configury.
. ${srcdir}/configure.tgt
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index ea296a28e00..78a253c0f93 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -331,7 +331,12 @@ fi
AX_COUNT_CPUS
AC_SUBST(CPU_COUNT)
+AC_MSG_NOTICE([checking for flock implementation])
AC_CHECK_PROGS(FLOCK, flock)
+# Fallback if 'perl' is available.
+if test -z "$FLOCK"; then
+ AC_CHECK_PROG(FLOCK, perl, $srcdir/testsuite/flock)
+fi
# Get target configury.
. ${srcdir}/configure.tgt
diff --git a/libgomp/testsuite/flock b/libgomp/testsuite/flock
new file mode 100755
index 00000000000..71878b104f1
--- /dev/null
+++ b/libgomp/testsuite/flock
@@ -0,0 +1,17 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+# Only arguments '--exclusive 1' exactly are supported.
+(@ARGV == 2) or die;
+my $mode = shift;
+($mode eq "--exclusive") or die;
+my $fd = shift;
+($fd eq "1") or die;
+
+use Fcntl ':flock';
+
+open(my $fh, '>&=', 1) or die "open: $!";
+
+flock($fh, LOCK_EX) or die "flock: $!";
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index bf4b75eb1ad..512a5146ac6 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -334,12 +334,14 @@ if ![info exists ::env(GCC_RUNTEST_PARALLELIZE_DIR)] {
rename libgomp_load standard_libgomp_load
proc libgomp_load { program args } {
# ... in order to serialize execution testing via an exclusive lock.
+ # We use stdout, as per
+ # "[...] FILEHANDLE [...] be open with write intent to use LOCK_EX".
set lock_file ../lock
set lock_kind --exclusive
set lock_fd [open $lock_file a+]
set lock_clock_begin [clock seconds]
global FLOCK
- exec $FLOCK $lock_kind 0 <@ $lock_fd
+ exec $FLOCK $lock_kind 1 >@ $lock_fd
set lock_clock_end [clock seconds]
verbose -log "Got ${FLOCK}('$lock_file', '$lock_kind') at [clock format $lock_clock_end] after [expr $lock_clock_end - $lock_clock_begin] s" 2
commit 64fa0fea9570fae75152b6323944fd08edc4f175
Author: GCC Administrator
Date: Thu Jun 29 02:19:33 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9f9687bb222..80c622a540a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2023-06-28 Thomas Schwinge
+
+ Backported from master:
+ 2023-06-02 Thomas Schwinge
+
+ PR testsuite/66005
+ * doc/install.texi: Document (optional) Perl usage for parallel
+ testing of libgomp.
+
+2023-06-28 liuhongt
+
+ * config/i386/i386-features.c (pass_insert_vzeroupper:gate):
+ Move flag_expensive_optimizations && !optimize_size to ..
+ * config/i386/i386-options.c (ix86_option_override_internal):
+ .. this, it makes -mvzeroupper independent of optimization
+ level, but still keeps the behavior of architecture
+ tuning(emit_vzeroupper) unchanged.
+ (rest_of_handle_insert_vzeroupper): Remove
+ flag_expensive_optimizations && !optimize_size.
+
2023-06-20 Kewen Lin
PR target/109932
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index fff3166d023..d3dd503874a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230628
+20230629
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9a3cee67ce5..29f2e12fa8f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2023-06-28 liuhongt
+
+ * gcc.target/i386/avx-vzeroupper-29.c: New testcase.
+
2023-06-26 Iain Buclaw
Backported from master:
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index f214dbd9617..1c18a927b15 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,52 @@
+2023-06-28 Thomas Schwinge
+
+ Backported from master:
+ 2023-06-02 Thomas Schwinge
+
+ PR testsuite/66005
+ * testsuite/lib/libgomp.exp: 'flock' through stdout.
+ * testsuite/flock: New.
+ * configure.ac (FLOCK): Point to that if no 'flock' available, but
+ 'perl' is.
+ * configure: Regenerate.
+
+2023-06-28 Thomas Schwinge
+
+ Backported from master:
+ 2023-05-15 Thomas Schwinge
+
+ PR testsuite/66005
+ * configure.ac: Look for 'flock'.
+ * testsuite/Makefile.am (gcc_test_parallel_slots): Enable parallel testing.
+ * testsuite/config/default.exp: Don't 'load_lib "standard.exp"' here...
+ * testsuite/lib/libgomp.exp: ... but here, instead.
+ (libgomp_load): Override for parallel testing.
+ * testsuite/libgomp-site-extra.exp.in (FLOCK): Set.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+
+2023-06-28 Rainer Orth
+
+ Backported from master:
+ 2023-05-15 Rainer Orth
+ Thomas Schwinge
+
+ PR testsuite/66005
+ * testsuite/Makefile.am (PWD_COMMAND): New variable.
+ (%/site.exp): New target.
+ (check_p_numbers0, check_p_numbers1, check_p_numbers2)
+ (check_p_numbers3, check_p_numbers4, check_p_numbers5)
+ (check_p_numbers6, check_p_numbers, gcc_test_parallel_slots)
+ (check_p_subdirs)
+ (check_DEJAGNU_libgomp_targets): New variables.
+ ($(check_DEJAGNU_libgomp_targets)): New target.
+ ($(check_DEJAGNU_libgomp_targets)): New dependency.
+ (check-DEJAGNU $(check_DEJAGNU_libgomp_targets)): New targets.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/lib/libgomp.exp: For parallel testing,
+ 'load_file ../libgomp-test-support.exp'.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
commit f59565f5dc2cdb5ac5a0b2b75404a36771232f86
Author: liuhongt
Date: Tue Jun 20 09:41:00 2023
Refine maskloadmn pattern with UNSPEC_MASKLOAD.
If mem_addr points to a memory region with less than whole vector size
bytes of accessible memory and k is a mask that would prevent reading
the inaccessible bytes from mem_addr, add UNSPEC_MASKLOAD to prevent
it to be transformed to vpblendd.
gcc/ChangeLog:
PR target/110309
* config/i386/sse.md (maskload):
Refine pattern with UNSPEC_MASKLOAD.
(maskload): Ditto.
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 95619944c87..a7e5f6dad4d 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -21857,7 +21857,9 @@
(define_expand "maskload"
[(set (match_operand:V48_AVX512VL 0 "register_operand")
(vec_merge:V48_AVX512VL
- (match_operand:V48_AVX512VL 1 "memory_operand")
+ (unspec:V48_AVX512VL
+ [(match_operand:V48_AVX512VL 1 "memory_operand")]
+ UNSPEC_MASKLOAD)
(match_dup 0)
(match_operand: 2 "register_operand")))]
"TARGET_AVX512F")
@@ -21865,7 +21867,9 @@
(define_expand "maskload"
[(set (match_operand:VI12_AVX512VL 0 "register_operand")
(vec_merge:VI12_AVX512VL
- (match_operand:VI12_AVX512VL 1 "memory_operand")
+ (unspec:VI12_AVX512VL
+ [(match_operand:VI12_AVX512VL 1 "memory_operand")]
+ UNSPEC_MASKLOAD)
(match_dup 0)
(match_operand: 2 "register_operand")))]
"TARGET_AVX512BW")
commit ad1a3da97f7c4a85778f91b235a8d936bb1c829b
Author: liuhongt
Date: Mon Jun 26 15:07:09 2023
Refine maskstore patterns with UNSPEC_MASKMOV.
Similar like r14-2070-gc79476da46728e
If mem_addr points to a memory region with less than whole vector size
bytes of accessible memory and k is a mask that would prevent reading
the inaccessible bytes from mem_addr, add UNSPEC_MASKMOV to prevent
it to be transformed to any other whole memory access instructions.
gcc/ChangeLog:
PR rtl-optimization/110237
* config/i386/sse.md (_store_mask): Refine with
UNSPEC_MASKMOV.
(maskstore_store_mask): New define_insn, it's renamed
from original _store_mask.
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index a7e5f6dad4d..45d5d1e4dc5 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -1293,7 +1293,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "")])
-(define_insn "_store_mask"
+(define_insn "*_store_mask"
[(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
(vec_merge:V48_AVX512VL
(match_operand:V48_AVX512VL 1 "register_operand" "v")
@@ -1321,7 +1321,7 @@
(set_attr "memory" "store")
(set_attr "mode" "")])
-(define_insn "_store_mask"
+(define_insn "*_store_mask"
[(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
(vec_merge:VI12_AVX512VL
(match_operand:VI12_AVX512VL 1 "register_operand" "v")
@@ -21885,20 +21885,65 @@
(define_expand "maskstore"
[(set (match_operand:V48_AVX512VL 0 "memory_operand")
- (vec_merge:V48_AVX512VL
- (match_operand:V48_AVX512VL 1 "register_operand")
- (match_dup 0)
- (match_operand: 2 "register_operand")))]
+ (unspec:V48_AVX512VL
+ [(match_operand:V48_AVX512VL 1 "register_operand")
+ (match_dup 0)
+ (match_operand: 2 "register_operand")]
+ UNSPEC_MASKMOV))]
"TARGET_AVX512F")
(define_expand "maskstore"
[(set (match_operand:VI12_AVX512VL 0 "memory_operand")
- (vec_merge:VI12_AVX512VL
- (match_operand:VI12_AVX512VL 1 "register_operand")
- (match_dup 0)
- (match_operand: 2 "register_operand")))]
+ (unspec:VI12_AVX512VL
+ [(match_operand:VI12_AVX512VL 1 "register_operand")
+ (match_dup 0)
+ (match_operand: 2 "register_operand")]
+ UNSPEC_MASKMOV))]
"TARGET_AVX512BW")
+(define_insn "_store_mask"
+ [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
+ (unspec:V48_AVX512VL
+ [(match_operand:V48_AVX512VL 1 "register_operand" "v")
+ (match_dup 0)
+ (match_operand: 2 "register_operand" "Yk")]
+ UNSPEC_MASKMOV))]
+ "TARGET_AVX512F"
+{
+ if (FLOAT_MODE_P (GET_MODE_INNER (mode)))
+ {
+ if (misaligned_operand (operands[0], mode))
+ return "vmovu\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+ else
+ return "vmova\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+ }
+ else
+ {
+ if (misaligned_operand (operands[0], mode))
+ return "vmovdqu\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+ else
+ return "vmovdqa\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+ }
+}
+ [(set_attr "type" "ssemov")
+ (set_attr "prefix" "evex")
+ (set_attr "memory" "store")
+ (set_attr "mode" "")])
+
+(define_insn "_store_mask"
+ [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
+ (unspec:VI12_AVX512VL
+ [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
+ (match_dup 0)
+ (match_operand: 2 "register_operand" "Yk")]
+ UNSPEC_MASKMOV))]
+ "TARGET_AVX512BW"
+ "vmovdqu\t{%1, %0%{%2%}|%0%{%2%}, %1}"
+ [(set_attr "type" "ssemov")
+ (set_attr "prefix" "evex")
+ (set_attr "memory" "store")
+ (set_attr "mode" "")])
+
(define_expand "cbranch4"
[(set (reg:CC FLAGS_REG)
(compare:CC (match_operand:VI48_AVX 1 "register_operand")
commit 22e5d295199714f9fcebe970e3e8c29c204d30a6
Author: Paul E. Murphy
Date: Fri Jun 23 00:53:46 2023
go: Update usage of TARGET_AIX to TARGET_AIX_OS
TARGET_AIX is defined to a non-zero value on linux and maybe other
powerpc64le targets. This leads to unexpected behavior such as
dropping the .go_export section when linking a shared library
on linux/powerpc64le.
Instead, use TARGET_AIX_OS to toggle AIX specific behavior.
Fixes golang/go#60798.
2023-06-22 Paul E. Murphy
gcc/go/
* go-backend.c [TARGET_AIX]: Rename and update usage to TARGET_AIX_OS.
* go-lang.c: Likewise.
(cherry picked from commit b76cd1ec361712e1ac9ca5e0246da24ea2b78916)
diff --git a/gcc/go/go-backend.c b/gcc/go/go-backend.c
index 7a223e51b00..4655fee6ece 100644
--- a/gcc/go/go-backend.c
+++ b/gcc/go/go-backend.c
@@ -45,8 +45,8 @@ along with GCC; see the file COPYING3. If not see
#define GO_EXPORT_SECTION_NAME ".go_export"
#endif
-#ifndef TARGET_AIX
-#define TARGET_AIX 0
+#ifndef TARGET_AIX_OS
+#define TARGET_AIX_OS 0
#endif
/* This file holds all the cases where the Go frontend needs
@@ -107,7 +107,7 @@ go_write_export_data (const char *bytes, unsigned int size)
{
gcc_assert (targetm_common.have_named_sections);
sec = get_section (GO_EXPORT_SECTION_NAME,
- TARGET_AIX ? SECTION_EXCLUDE : SECTION_DEBUG,
+ TARGET_AIX_OS ? SECTION_EXCLUDE : SECTION_DEBUG,
NULL);
}
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index a01db8dbdcd..249ecf2503f 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -39,8 +39,8 @@ along with GCC; see the file COPYING3. If not see
#include "go-c.h"
#include "go-gcc.h"
-#ifndef TARGET_AIX
-#define TARGET_AIX 0
+#ifndef TARGET_AIX_OS
+#define TARGET_AIX_OS 0
#endif
/* Language-dependent contents of a type. */
@@ -119,9 +119,9 @@ go_langhook_init (void)
args.compiling_runtime = go_compiling_runtime;
args.debug_escape_level = go_debug_escape_level;
args.debug_escape_hash = go_debug_escape_hash;
- args.nil_check_size_threshold = TARGET_AIX ? -1 : 4096;
+ args.nil_check_size_threshold = TARGET_AIX_OS ? -1 : 4096;
args.debug_optimization = go_debug_optimization;
- args.need_eqtype = TARGET_AIX ? true : false;
+ args.need_eqtype = TARGET_AIX_OS ? true : false;
args.linemap = go_get_linemap();
args.backend = go_get_backend();
go_create_gogo (&args);
commit f03b182f7f23e14d587cfa1daec13ef7c3044ac0
Author: GCC Administrator
Date: Fri Jun 30 02:19:35 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 80c622a540a..4916d68c487 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2023-06-29 liuhongt
+
+ PR rtl-optimization/110237
+ * config/i386/sse.md (_store_mask): Refine with
+ UNSPEC_MASKMOV.
+ (maskstore_store_mask): New define_insn, it's renamed
+ from original _store_mask.
+
+2023-06-29 liuhongt
+
+ PR target/110309
+ * config/i386/sse.md (maskload):
+ Refine pattern with UNSPEC_MASKLOAD.
+ (maskload): Ditto.
+
2023-06-28 Thomas Schwinge
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d3dd503874a..e742d0ec698 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230629
+20230630
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index c801872ebd3..323b9dae832 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-29 Paul E. Murphy
+
+ Backported from master:
+ 2023-06-22 Paul E. Murphy
+
+ * go-backend.c [TARGET_AIX]: Rename and update usage to TARGET_AIX_OS.
+ * go-lang.c: Likewise.
+
2023-05-29 Release Manager
* GCC 11.4.0 released.
commit fe369fa9c5a2056ee060c35d2ba9afb748ab568f
Author: GCC Administrator
Date: Sat Jul 1 02:20:52 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index e742d0ec698..41f22081742 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230630
+20230701
commit 066385c918485d4cef5c243d3b0691193df382de
Author: Iain Buclaw
Date: Sat Jul 1 15:04:25 2023
d: Fix ICE in setValue, at d/dmd/dinterpret.c:7013
Backports ICE fix from upstream. When casting null to integer or real,
instead of painting the type on the NullExp, we emplace an
IntegerExp/RealExp with the value zero. Same as when casting from
NullExp to bool.
Reviewed-on: https://github.com/dlang/dmd/pull/13172
PR d/110511
gcc/d/ChangeLog:
* dmd/dinterpret.c (Interpreter::visit (CastExp *)): Handle casting
null to int or float.
gcc/testsuite/ChangeLog:
* gdc.test/compilable/test21794.d: New test.
diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c
index ab9d88c660c..d4cfb0caacb 100644
--- a/gcc/d/dmd/dinterpret.c
+++ b/gcc/d/dmd/dinterpret.c
@@ -5792,12 +5792,22 @@ public:
}
if (e->to->ty == Tsarray)
e1 = resolveSlice(e1);
- if (e->to->toBasetype()->ty == Tbool && e1->type->ty == Tpointer)
+ Type *tobt = e->to->toBasetype();
+ if (tobt->ty == Tbool && e1->type->ty == Tpointer)
{
new(pue) IntegerExp(e->loc, e1->op != TOKnull, e->to);
result = pue->exp();
return;
}
+ else if (tobt->isTypeBasic() && e1->op == TOKnull)
+ {
+ if (tobt->isintegral())
+ new(pue) IntegerExp(e->loc, 0, e->to);
+ else if (tobt->isreal())
+ new(pue) RealExp(e->loc, CTFloat::zero, e->to);
+ result = pue->exp();
+ return;
+ }
result = ctfeCast(pue, e->loc, e->type, e->to, e1);
}
diff --git a/gcc/testsuite/gdc.test/compilable/test21794.d b/gcc/testsuite/gdc.test/compilable/test21794.d
new file mode 100644
index 00000000000..68e504bce56
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21794.d
@@ -0,0 +1,52 @@
+// https://issues.dlang.org/show_bug.cgi?id=21794
+/*
+TEST_OUTPUT:
+---
+0
+0u
+0L
+0LU
+0.0F
+0.0
+0.0L
+---
+*/
+
+bool fun(void* p) {
+ const x = cast(ulong)p;
+ return 1;
+}
+
+static assert(fun(null));
+
+T fun2(T)(void* p) {
+ const x = cast(T)p;
+ return x;
+}
+
+// These were an error before, they were returning a NullExp instead of IntegerExp/RealExp
+
+static assert(fun2!int(null) == 0);
+static assert(fun2!uint(null) == 0);
+static assert(fun2!long(null) == 0);
+static assert(fun2!ulong(null) == 0);
+static assert(fun2!float(null) == 0);
+static assert(fun2!double(null) == 0);
+static assert(fun2!real(null) == 0);
+
+// These were printing 'null' instead of the corresponding number
+
+const i = cast(int)null;
+const ui = cast(uint)null;
+const l = cast(long)null;
+const ul = cast(ulong)null;
+const f = cast(float)null;
+const d = cast(double)null;
+const r = cast(real)null;
+pragma(msg, i);
+pragma(msg, ui);
+pragma(msg, l);
+pragma(msg, ul);
+pragma(msg, f);
+pragma(msg, d);
+pragma(msg, r);
commit 528c710f3d3dcc97d6c82c719ab3b0a5a3413599
Author: GCC Administrator
Date: Sun Jul 2 02:18:30 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 41f22081742..ae3ab38a574 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230701
+20230702
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 36e2ba84ff7..a2e11e16576 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-01 Iain Buclaw
+
+ PR d/110511
+ * dmd/dinterpret.c (Interpreter::visit (CastExp *)): Handle casting
+ null to int or float.
+
2023-06-26 Iain Buclaw
Backported from master:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 29f2e12fa8f..3937277d477 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2023-07-01 Iain Buclaw
+
+ PR d/110511
+ * gdc.test/compilable/test21794.d: New test.
+
2023-06-28 liuhongt
* gcc.target/i386/avx-vzeroupper-29.c: New testcase.
commit da7a10ea9245d7461253495698873891ffc20666
Author: Iain Buclaw
Date: Sun Jul 2 03:24:53 2023
d: Fix core.volatile.volatileLoad discarded if result is unused
The first pass of code generation in the D front-end splits up all
compound expressions and discards expressions that have no side effects.
This included calls to the `volatileLoad' intrinsic if its result was
not used, causing such calls to be eliminated from the program.
We already set TREE_THIS_VOLATILE on the expression, however the
tree documentation says if this bit is set in an expression, so is
TREE_SIDE_EFFECTS. So set TREE_SIDE_EFFECTS on the expression too.
This prevents any early discarding from occuring.
PR d/110516
gcc/d/ChangeLog:
* intrinsics.cc (expand_volatile_load): Set TREE_SIDE_EFFECTS on the
expanded expression.
(expand_volatile_store): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr110516a.d: New test.
* gdc.dg/torture/pr110516b.d: New test.
(cherry picked from commit 80ae426a195a0d035640a6301da833564deade52)
diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc
index 539dc0c1f37..5788f5cb4ad 100644
--- a/gcc/d/intrinsics.cc
+++ b/gcc/d/intrinsics.cc
@@ -721,6 +721,7 @@ expand_volatile_load (tree callexp)
tree type = build_qualified_type (TREE_TYPE (ptrtype), TYPE_QUAL_VOLATILE);
tree result = indirect_ref (type, ptr);
TREE_THIS_VOLATILE (result) = 1;
+ TREE_SIDE_EFFECTS (result) = 1;
return result;
}
@@ -748,6 +749,7 @@ expand_volatile_store (tree callexp)
tree type = build_qualified_type (TREE_TYPE (ptrtype), TYPE_QUAL_VOLATILE);
tree result = indirect_ref (type, ptr);
TREE_THIS_VOLATILE (result) = 1;
+ TREE_SIDE_EFFECTS (result) = 1;
/* (*(volatile T *) ptr) = value; */
tree value = CALL_EXPR_ARG (callexp, 1);
diff --git a/gcc/testsuite/gdc.dg/torture/pr110516a.d b/gcc/testsuite/gdc.dg/torture/pr110516a.d
new file mode 100644
index 00000000000..276455ae408
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr110516a.d
@@ -0,0 +1,12 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110516
+// { dg-do compile }
+// { dg-options "-fno-moduleinfo -fdump-tree-optimized" }
+void fn110516(ubyte* ptr)
+{
+ import core.volatile : volatileLoad;
+ volatileLoad(ptr);
+ volatileLoad(ptr);
+ volatileLoad(ptr);
+ volatileLoad(ptr);
+}
+// { dg-final { scan-tree-dump-times " ={v} " 4 "optimized" } }
diff --git a/gcc/testsuite/gdc.dg/torture/pr110516b.d b/gcc/testsuite/gdc.dg/torture/pr110516b.d
new file mode 100644
index 00000000000..b7a67e716a5
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr110516b.d
@@ -0,0 +1,12 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110516
+// { dg-do compile }
+// { dg-options "-fno-moduleinfo -fdump-tree-optimized" }
+void fn110516(ubyte* ptr)
+{
+ import core.volatile : volatileStore;
+ volatileStore(ptr, 0);
+ volatileStore(ptr, 0);
+ volatileStore(ptr, 0);
+ volatileStore(ptr, 0);
+}
+// { dg-final { scan-tree-dump-times " ={v} " 4 "optimized" } }
commit 41c044287cb1a525a46dee8735ac23c2092c220a
Author: GCC Administrator
Date: Mon Jul 3 02:19:49 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index ae3ab38a574..4686be8f754 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230702
+20230703
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index a2e11e16576..ef7b93950a7 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,13 @@
+2023-07-02 Iain Buclaw
+
+ Backported from master:
+ 2023-07-02 Iain Buclaw
+
+ PR d/110516
+ * intrinsics.cc (expand_volatile_load): Set TREE_SIDE_EFFECTS on the
+ expanded expression.
+ (expand_volatile_store): Likewise.
+
2023-07-01 Iain Buclaw
PR d/110511
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3937277d477..b6e7bf626b6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2023-07-02 Iain Buclaw
+
+ Backported from master:
+ 2023-07-02 Iain Buclaw
+
+ PR d/110516
+ * gdc.dg/torture/pr110516a.d: New test.
+ * gdc.dg/torture/pr110516b.d: New test.
+
2023-07-01 Iain Buclaw
PR d/110511
commit 34e1150bbcf43af2bd1815e30deac715cf6435cb
Author: GCC Administrator
Date: Tue Jul 4 02:19:48 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 4686be8f754..a75b56cd2f4 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230703
+20230704
commit 9b7a2b8dbf35cd8ce840dc70af0305dc5ff1a335
Author: GCC Administrator
Date: Wed Jul 5 02:19:02 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a75b56cd2f4..31e1a2e29a7 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230704
+20230705
commit fa0a7f64ec5c844b921ece69a361ce215f7848f2
Author: Segher Boessenkool
Date: Fri Jun 2 17:32:41 2023
rs6000: genfusion: Rewrite load/compare code
This makes the code more readable, more digestible, more maintainable,
more extensible. That kind of thing. It does that by pulling things
apart a bit, but also making what stays together more cohesive lumps.
The original function was a bunch of loops and early-outs, and then
quite a bit of stuff done per iteration, with the iterations essentially
independent of each other. This patch moves the stuff done for one
iteration to a new _one function.
The second big thing is the stuff printed to the .md file is done in
"here documents" now, which is a lot more readable than having to quote
and escape and double-escape pieces of text. Whitespace inside the
here-document is significant (will be printed as-is), which is a bit
awkward sometimes, or might take some getting used to, but it is also
one of the benefits of using them.
Local variables are declared at first use (or close to first use).
There also shouldn't be many at all, often you can write easier to
read and manage code by omitting to name something that is hard to name
in the first place.
Finally some things are done in more typical, more modern, and tighter
Perl style, for example REs in "if"s or "qw" for lists of constants.
2023-06-06 Segher Boessenkool
* config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): New, rewritten and
split out from...
(gen_ld_cmpi_p10): ... this.
(cherry picked from commit 19e5bf1d5fac00da0b8cd4144d5651b2979d8308)
diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl
index badda5e8427..a6f2a934d04 100755
--- a/gcc/config/rs6000/genfusion.pl
+++ b/gcc/config/rs6000/genfusion.pl
@@ -53,92 +53,113 @@ sub mode_to_ldst_char
return '?';
}
+sub gen_ld_cmpi_p10_one
+{
+ my ($lmode, $result, $ccmode) = @_;
+
+ my $np = "NON_PREFIXED_D";
+ my $mempred = "non_update_memory_operand";
+ my $extend;
+
+ if ($ccmode eq "CC") {
+ # ld and lwa are both DS-FORM.
+ ($lmode =~ /^[SD]I$/) and $np = "NON_PREFIXED_DS";
+ ($lmode =~ /^[SD]I$/) and $mempred = "ds_form_mem_operand";
+ } else {
+ if ($lmode eq "DI") {
+ # ld is DS-form, but lwz is not.
+ $np = "NON_PREFIXED_DS";
+ $mempred = "ds_form_mem_operand";
+ }
+ }
+
+ my $cmpl = ($ccmode eq "CC") ? "" : "l";
+ my $echr = ($ccmode eq "CC") ? "a" : "z";
+ if ($lmode eq "DI") { $echr = ""; }
+ my $constpred = ($ccmode eq "CC") ? "const_m1_to_1_operand"
+ : "const_0_to_1_operand";
+
+ # For clobber, we need a SI/DI reg in case we
+ # split because we have to sign/zero extend.
+ my $clobbermode = ($lmode =~ /^[QH]I$/) ? "GPR" : $lmode;
+ if ($result =~ /^EXT/ || $result eq "GPR" || $clobbermode eq "GPR") {
+ # We always need extension if result > lmode.
+ $extend = ($ccmode eq "CC") ? "sign" : "zero";
+ } else {
+ # Result of SI/DI does not need sign extension.
+ $extend = "none";
+ }
+
+ my $ldst = mode_to_ldst_char($lmode);
+ print < lmode.
- if ( $ccmode eq 'CC' ) {
- $extend = "sign";
- } else {
- $extend = "zero";
- }
- } else {
- # Result of SI/DI does not need sign extension.
- $extend = "none";
- }
- print ";; load-cmpi fusion pattern generated by gen_ld_cmpi_p10\n";
- print ";; load mode is $lmode result mode is $result compare mode is $ccmode extend is $extend\n";
+ foreach my $lmode (qw/DI SI HI QI/) {
+ foreach my $result ("clobber", $lmode, "EXT$lmode") {
+ # EXTDI does not exist, and we cannot directly produce HI/QI results.
+ next if $result =~ /^(QI|HI|EXTDI)$/;
- print "(define_insn_and_split \"*l${ldst}${echr}_cmp${cmpl}di_cr0_${lmode}_${result}_${ccmode}_${extend}\"\n";
- print " [(set (match_operand:${ccmode} 2 \"cc_reg_operand\" \"=x\")\n";
- print " (compare:${ccmode} (match_operand:${lmode} 1 \"${mempred}\" \"m\")\n";
- if ($ccmode eq 'CCUNS') { print " "; }
- print " (match_operand:${lmode} 3 \"${constpred}\" \"n\")))\n";
- if ($result eq 'clobber') {
- print " (clobber (match_scratch:${clobbermode} 0 \"=r\"))]\n";
- } elsif ($result eq $lmode) {
- print " (set (match_operand:${result} 0 \"gpc_reg_operand\" \"=r\") (match_dup 1))]\n";
- } else {
- print " (set (match_operand:${result} 0 \"gpc_reg_operand\" \"=r\") (${extend}_extend:${result} (match_dup 1)))]\n";
- }
- print " \"(TARGET_P10_FUSION)\"\n";
- print " \"l${ldst}${echr}%X1 %0,%1\\;cmp${cmpl}di %2,%0,%3\"\n";
- print " \"&& reload_completed\n";
- print " && (cc_reg_not_cr0_operand (operands[2], CCmode)\n";
- print " || !address_is_non_pfx_d_or_x (XEXP (operands[1], 0),\n";
- print " ${lmode}mode, ${np}))\"\n";
+ # Don't allow EXTQI because that would allow HI result which we can't do.
+ $result = "GPR" if $result eq "EXTQI";
- if ($extend eq "none") {
- print " [(set (match_dup 0) (match_dup 1))\n";
- } else {
- $resultmode = $result;
- if ( $result eq 'clobber' ) { $resultmode = $clobbermode }
- print " [(set (match_dup 0) (${extend}_extend:${resultmode} (match_dup 1)))\n";
- }
- print " (set (match_dup 2)\n";
- print " (compare:${ccmode} (match_dup 0) (match_dup 3)))]\n";
- print " \"\"\n";
- print " [(set_attr \"type\" \"fused_load_cmpi\")\n";
- print " (set_attr \"cost\" \"8\")\n";
- print " (set_attr \"length\" \"8\")])\n";
- print "\n";
+ foreach my $ccmode (qw/CC CCUNS/) {
+ # We do not have signed single-byte loads.
+ next if ($lmode eq "QI" and $ccmode eq "CC");
+
+ gen_ld_cmpi_p10_one($lmode, $result, $ccmode);
}
}
}
commit 1896ab1cab76df1ebf12b876f696eac23436170b
Author: Michael Meissner
Date: Wed Jul 5 21:50:15 2023
Fix power10 fusion bug with prefixed loads, PR target/105325
This changes fixes PR target/105325. PR target/105325 is a bug where an
invalid lwa instruction is generated due to power10 fusion of a load
instruction to a GPR and an compare immediate instruction with the immediate
being -1, 0, or 1.
In some cases, when the load instruction is done, the GCC compiler would
generate a load instruction with an offset that was too large to fit into the
normal load instruction.
In particular, loads from the stack might originally have a small offset, so
that the load is not a prefixed load. However, after the stack is set up, and
register allocation has been done, the offset now is large enough that we would
have to use a prefixed load instruction.
The support for prefixed loads did not consider that patterns with a fused load
and compare might have a prefixed address. Without this support, the proper
prefixed load won't be generated.
In the original code, when the split2 pass is run after reload has finished the
ds_form_mem_operand predicate that was used for lwa and ld no longer returns
true. When the pattern was created, ds_form_mem_operand recognized the insn as
being valid since the offset was small. But after register allocation,
ds_form_mem_operand did not return true. Because it didn't return true, the
insn could not be split. Since the insn was not split and the prefix support
did not indicate a prefixed instruction was used, the wrong load is generated.
The solution involves:
1) Don't use ds_form_mem_operand for ld and lwa, always use
non_update_memory_operand.
2) Delete ds_form_mem_operand since it is no longer used.
3) Use the "YZ" constraints for ld/lwa instead of "m".
4) If we don't need to sign extend the lwa, convert it to lwz, and use
cmpwi instead of cmpdi. Adjust the insn name to reflect the code
generate.
5) Insure that the insn using lwa will be recognized as having a prefixed
operand (and hence the insn length will be 16 bytes instead of 8
bytes).
5a) Set the prefixed and maybe_prefix attributes to know that
fused_load_cmpi are also load insns;
5b) In the case where we are just setting CC and not using the memory
afterward, set the clobber to use a DI register, and put an
explicit sign_extend operation in the split;
5c) Set the sign_extend attribute to "yes" for lwa.
5d) 5a-5c are the things that prefixed_load_p in rs6000.cc checks to
ensure that lwa is treated as a ds-form instruction and not as
a d-form instruction (i.e. lwz).
6) Add a new test case for this case.
7) Adjust the insn counts in fusion-p10-ldcmpi.c. Because we are no
longer using ds_form_mem_operand, the ld and lwa instructions will fuse
x-form (reg+reg) addresses in addition ds-form (reg+offset or reg).
2023-06-23 Michael Meissner
gcc/
PR target/105325
* config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): Fix problems that
allowed prefixed lwa to be generated.
* config/rs6000/fusion.md: Regenerate.
* config/rs6000/predicates.md (ds_form_mem_operand): Delete.
* config/rs6000/rs6000.md (prefixed attribute): Add support for load
plus compare immediate fused insns.
(maybe_prefixed): Likewise.
gcc/testsuite/
PR target/105325
* g++.target/powerpc/pr105325.C: New test.
* gcc.target/powerpc/fusion-p10-ldcmpi.c: Update insn counts.
(cherry picked from commit 370de1488a9a49956c47e5ec8c8f1489b4314a34)
Co-Authored-By: Aaron Sawdey
diff --git a/gcc/config/rs6000/fusion.md b/gcc/config/rs6000/fusion.md
index 22b329af09d..6068125c217 100644
--- a/gcc/config/rs6000/fusion.md
+++ b/gcc/config/rs6000/fusion.md
@@ -22,7 +22,7 @@
;; load mode is DI result mode is clobber compare mode is CC extend is none
(define_insn_and_split "*ld_cmpdi_cr0_DI_clobber_CC_none"
[(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:DI 1 "ds_form_mem_operand" "m")
+ (compare:CC (match_operand:DI 1 "non_update_memory_operand" "YZ")
(match_operand:DI 3 "const_m1_to_1_operand" "n")))
(clobber (match_scratch:DI 0 "=r"))]
"(TARGET_P10_FUSION)"
@@ -43,7 +43,7 @@
;; load mode is DI result mode is clobber compare mode is CCUNS extend is none
(define_insn_and_split "*ld_cmpldi_cr0_DI_clobber_CCUNS_none"
[(set (match_operand:CCUNS 2 "cc_reg_operand" "=x")
- (compare:CCUNS (match_operand:DI 1 "ds_form_mem_operand" "m")
+ (compare:CCUNS (match_operand:DI 1 "non_update_memory_operand" "YZ")
(match_operand:DI 3 "const_0_to_1_operand" "n")))
(clobber (match_scratch:DI 0 "=r"))]
"(TARGET_P10_FUSION)"
@@ -64,7 +64,7 @@
;; load mode is DI result mode is DI compare mode is CC extend is none
(define_insn_and_split "*ld_cmpdi_cr0_DI_DI_CC_none"
[(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:DI 1 "ds_form_mem_operand" "m")
+ (compare:CC (match_operand:DI 1 "non_update_memory_operand" "YZ")
(match_operand:DI 3 "const_m1_to_1_operand" "n")))
(set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
"(TARGET_P10_FUSION)"
@@ -85,7 +85,7 @@
;; load mode is DI result mode is DI compare mode is CCUNS extend is none
(define_insn_and_split "*ld_cmpldi_cr0_DI_DI_CCUNS_none"
[(set (match_operand:CCUNS 2 "cc_reg_operand" "=x")
- (compare:CCUNS (match_operand:DI 1 "ds_form_mem_operand" "m")
+ (compare:CCUNS (match_operand:DI 1 "non_update_memory_operand" "YZ")
(match_operand:DI 3 "const_0_to_1_operand" "n")))
(set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
"(TARGET_P10_FUSION)"
@@ -104,17 +104,17 @@
;; load-cmpi fusion pattern generated by gen_ld_cmpi_p10
;; load mode is SI result mode is clobber compare mode is CC extend is none
-(define_insn_and_split "*lwa_cmpdi_cr0_SI_clobber_CC_none"
+(define_insn_and_split "*lwz_cmpwi_cr0_SI_clobber_CC_none"
[(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:SI 1 "ds_form_mem_operand" "m")
+ (compare:CC (match_operand:SI 1 "non_update_memory_operand" "m")
(match_operand:SI 3 "const_m1_to_1_operand" "n")))
(clobber (match_scratch:SI 0 "=r"))]
"(TARGET_P10_FUSION)"
- "lwa%X1 %0,%1\;cmpdi %2,%0,%3"
+ "lwz%X1 %0,%1\;cmpwi %2,%0,%3"
"&& reload_completed
&& (cc_reg_not_cr0_operand (operands[2], CCmode)
|| !address_is_non_pfx_d_or_x (XEXP (operands[1], 0),
- SImode, NON_PREFIXED_DS))"
+ SImode, NON_PREFIXED_D))"
[(set (match_dup 0) (match_dup 1))
(set (match_dup 2)
(compare:CC (match_dup 0) (match_dup 3)))]
@@ -146,17 +146,17 @@
;; load-cmpi fusion pattern generated by gen_ld_cmpi_p10
;; load mode is SI result mode is SI compare mode is CC extend is none
-(define_insn_and_split "*lwa_cmpdi_cr0_SI_SI_CC_none"
+(define_insn_and_split "*lwz_cmpwi_cr0_SI_SI_CC_none"
[(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:SI 1 "ds_form_mem_operand" "m")
+ (compare:CC (match_operand:SI 1 "non_update_memory_operand" "m")
(match_operand:SI 3 "const_m1_to_1_operand" "n")))
(set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
"(TARGET_P10_FUSION)"
- "lwa%X1 %0,%1\;cmpdi %2,%0,%3"
+ "lwz%X1 %0,%1\;cmpwi %2,%0,%3"
"&& reload_completed
&& (cc_reg_not_cr0_operand (operands[2], CCmode)
|| !address_is_non_pfx_d_or_x (XEXP (operands[1], 0),
- SImode, NON_PREFIXED_DS))"
+ SImode, NON_PREFIXED_D))"
[(set (match_dup 0) (match_dup 1))
(set (match_dup 2)
(compare:CC (match_dup 0) (match_dup 3)))]
@@ -190,7 +190,7 @@
;; load mode is SI result mode is EXTSI compare mode is CC extend is sign
(define_insn_and_split "*lwa_cmpdi_cr0_SI_EXTSI_CC_sign"
[(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:SI 1 "ds_form_mem_operand" "m")
+ (compare:CC (match_operand:SI 1 "non_update_memory_operand" "YZ")
(match_operand:SI 3 "const_m1_to_1_operand" "n")))
(set (match_operand:EXTSI 0 "gpc_reg_operand" "=r") (sign_extend:EXTSI (match_dup 1)))]
"(TARGET_P10_FUSION)"
@@ -205,6 +205,7 @@
""
[(set_attr "type" "fused_load_cmpi")
(set_attr "cost" "8")
+ (set_attr "sign_extend" "yes")
(set_attr "length" "8")])
;; load-cmpi fusion pattern generated by gen_ld_cmpi_p10
diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl
index a6f2a934d04..e728bdd8f2e 100755
--- a/gcc/config/rs6000/genfusion.pl
+++ b/gcc/config/rs6000/genfusion.pl
@@ -61,20 +61,31 @@ sub gen_ld_cmpi_p10_one
my $mempred = "non_update_memory_operand";
my $extend;
+ # We need to special case lwa. The prefixed_load_p function in rs6000.cc
+ # (which determines if a load instruction is prefixed) uses the fact that the
+ # register mode is different from the memory mode, and that the sign_extend
+ # attribute is set to use DS-form rules for the address instead of D-form.
+ # If the register size is the same, prefixed_load_p assumes we are doing a
+ # lwz. We change to use an lwz and word compare if we don't need to sign
+ # extend the SImode value. Otherwise if we need the value, we need to
+ # make sure the insn is marked as ds-form.
+ my $cmp_size_char = ($lmode eq "SI"
+ && $ccmode eq "CC"
+ && $result !~ /^EXT|^DI$/) ? "w" : "d";
+
if ($ccmode eq "CC") {
# ld and lwa are both DS-FORM.
- ($lmode =~ /^[SD]I$/) and $np = "NON_PREFIXED_DS";
- ($lmode =~ /^[SD]I$/) and $mempred = "ds_form_mem_operand";
+ ($lmode eq "DI") and $np = "NON_PREFIXED_DS";
+ ($lmode eq "SI" && $cmp_size_char eq "d") and $np = "NON_PREFIXED_DS";
} else {
if ($lmode eq "DI") {
# ld is DS-form, but lwz is not.
$np = "NON_PREFIXED_DS";
- $mempred = "ds_form_mem_operand";
}
}
my $cmpl = ($ccmode eq "CC") ? "" : "l";
- my $echr = ($ccmode eq "CC") ? "a" : "z";
+ my $echr = ($ccmode eq "CC" && $cmp_size_char eq "d") ? "a" : "z";
if ($lmode eq "DI") { $echr = ""; }
my $constpred = ($ccmode eq "CC") ? "const_m1_to_1_operand"
: "const_0_to_1_operand";
@@ -91,12 +102,15 @@ sub gen_ld_cmpi_p10_one
}
my $ldst = mode_to_ldst_char($lmode);
+
+ # DS-form addresses need YZ, and not m.
+ my $constraint = ($np eq "NON_PREFIXED_DS") ? "YZ" : "m";
print <
Date: Thu Jul 6 02:19:40 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4916d68c487..00a1676698d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,27 @@
+2023-07-05 Michael Meissner
+
+ Backported from master:
+ 2023-06-23 Michael Meissner
+ Aaron Sawdey
+
+ PR target/105325
+ * config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): Fix problems that
+ allowed prefixed lwa to be generated.
+ * config/rs6000/fusion.md: Regenerate.
+ * config/rs6000/predicates.md (ds_form_mem_operand): Delete.
+ * config/rs6000/rs6000.md (prefixed attribute): Add support for load
+ plus compare immediate fused insns.
+ (maybe_prefixed): Likewise.
+
+2023-07-05 Segher Boessenkool
+
+ Backported from master:
+ 2023-06-06 Segher Boessenkool
+
+ * config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): New, rewritten and
+ split out from...
+ (gen_ld_cmpi_p10): ... this.
+
2023-06-29 liuhongt
PR rtl-optimization/110237
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 31e1a2e29a7..ec0d4f34cd2 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230705
+20230706
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b6e7bf626b6..e6678cb2b74 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2023-07-05 Michael Meissner
+
+ Backported from master:
+ 2023-06-23 Michael Meissner
+ Aaron Sawdey
+
+ PR target/105325
+ * g++.target/powerpc/pr105325.C: New test.
+ * gcc.target/powerpc/fusion-p10-ldcmpi.c: Update insn counts.
+
2023-07-02 Iain Buclaw
Backported from master:
commit 7efc98e59a7ee88e2b11165479b46f7b1d507bf6
Author: GCC Administrator
Date: Fri Jul 7 02:18:46 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index ec0d4f34cd2..2e3c50b9d1e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230706
+20230707
commit eef069fe8b22229509a783c9ecb2eb659df4f5ab
Author: Iain Buclaw
Date: Fri Jul 7 21:06:07 2023
d: Fix PR 108842: Cannot use enum array with -fno-druntime
Restrict the generating of CONST_DECLs for D manifest constants to just
scalars without pointers. It shouldn't happen that a reference to a
manifest constant has not been expanded within a function body during
codegen, but it has been found to occur in older versions of the D
front-end (PR98277), so if the decl of a non-scalar constant is
requested, just return its initializer as an expression.
PR d/108842
gcc/d/ChangeLog:
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
manifest constants.
(get_symbol_decl): Don't generate CONST_DECL for non-scalar manifest
constants.
* imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.
gcc/testsuite/ChangeLog:
* gdc.dg/pr98277.d: Add more tests.
* gdc.dg/pr108842.d: New test.
(cherry picked from commit f934c5753849f7c48c6a3abfcd73b8f6008e8371)
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index bc494d3e7ca..477e8d880d9 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -755,7 +755,7 @@ public:
{
/* Do not store variables we cannot take the address of,
but keep the values for purposes of debugging. */
- if (!d->type->isscalar ())
+ if (d->type->isscalar () && !d->type->hasPointers ())
{
tree decl = get_symbol_decl (d);
d_pushdecl (decl);
@@ -1098,6 +1098,20 @@ get_symbol_decl (Declaration *decl)
return decl->csym;
}
+ if (VarDeclaration *vd = decl->isVarDeclaration ())
+ {
+ /* CONST_DECL was initially intended for enumerals and may be used for
+ scalars in general, but not for aggregates. Here a non-constant
+ value is generated anyway so as its value can be used. */
+ if (!vd->canTakeAddressOf () && !vd->type->isscalar ())
+ {
+ gcc_assert (vd->_init && !vd->_init->isVoidInitializer ());
+ Expression *ie = initializerToExpression (vd->_init);
+ decl->csym = build_expr (ie, false);
+ return decl->csym;
+ }
+ }
+
/* Build the tree for the symbol. */
FuncDeclaration *fd = decl->isFuncDeclaration ();
if (fd)
@@ -1145,23 +1159,15 @@ get_symbol_decl (Declaration *decl)
if (vd->storage_class & STCextern)
DECL_EXTERNAL (decl->csym) = 1;
- /* CONST_DECL was initially intended for enumerals and may be used for
- scalars in general, but not for aggregates. Here a non-constant
- value is generated anyway so as the CONST_DECL only serves as a
- placeholder for the value, however the DECL itself should never be
- referenced in any generated code, or passed to the back-end. */
- if (vd->storage_class & STCmanifest)
+ if (!vd->canTakeAddressOf ())
{
/* Cannot make an expression out of a void initializer. */
- if (vd->_init && !vd->_init->isVoidInitializer ())
- {
- Expression *ie = initializerToExpression (vd->_init);
+ gcc_assert (vd->_init && !vd->_init->isVoidInitializer ());
+ /* Non-scalar manifest constants have already been dealt with. */
+ gcc_assert (vd->type->isscalar ());
- if (!vd->type->isscalar ())
- DECL_INITIAL (decl->csym) = build_expr (ie, false);
- else
- DECL_INITIAL (decl->csym) = build_expr (ie, true);
- }
+ Expression *ie = initializerToExpression (vd->_init);
+ DECL_INITIAL (decl->csym) = build_expr (ie, true);
}
}
diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc
index 289bd5e6c49..51ed5e0260a 100644
--- a/gcc/d/imports.cc
+++ b/gcc/d/imports.cc
@@ -119,6 +119,15 @@ public:
d->isym = this->make_import (TYPE_STUB_DECL (type));
}
+ void visit (VarDeclaration *d)
+ {
+ /* Not all kinds of manifest constants create a CONST_DECL. */
+ if (!d->canTakeAddressOf () && !d->type->isscalar ())
+ return;
+
+ visit ((Declaration *) d);
+ }
+
/* For now, ignore importing other kinds of dsymbols. */
void visit (ScopeDsymbol *)
{
diff --git a/gcc/testsuite/gdc.dg/pr108842.d b/gcc/testsuite/gdc.dg/pr108842.d
new file mode 100644
index 00000000000..5aae9e5000d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr108842.d
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-fno-rtti" }
+module object;
+enum int[] x = [0, 1, 2];
diff --git a/gcc/testsuite/gdc.dg/pr98277.d b/gcc/testsuite/gdc.dg/pr98277.d
index d3b859fcbda..33b15e9e435 100644
--- a/gcc/testsuite/gdc.dg/pr98277.d
+++ b/gcc/testsuite/gdc.dg/pr98277.d
@@ -11,3 +11,14 @@ ref int getSide(Side side, ref int left, ref int right)
{
return side == Side.left ? left : right;
}
+
+enum SideA : int[]
+{
+ left = [0],
+ right = [1],
+}
+
+int getSideA(SideA side, ref int left, ref int right)
+{
+ return side == SideA.left ? left : right;
+}
commit 421d224d03860feec95504f48c42c989d564d218
Author: GCC Administrator
Date: Sat Jul 8 02:17:48 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2e3c50b9d1e..f3144f1474c 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230707
+20230708
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index ef7b93950a7..091a7fafaf0 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,15 @@
+2023-07-07 Iain Buclaw
+
+ Backported from master:
+ 2023-07-07 Iain Buclaw
+
+ PR d/108842
+ * decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
+ manifest constants.
+ (get_symbol_decl): Don't generate CONST_DECL for non-scalar manifest
+ constants.
+ * imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.
+
2023-07-02 Iain Buclaw
Backported from master:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e6678cb2b74..fd1169aa1cd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2023-07-07 Iain Buclaw
+
+ Backported from master:
+ 2023-07-07 Iain Buclaw
+
+ PR d/108842
+ * gdc.dg/pr98277.d: Add more tests.
+ * gdc.dg/pr108842.d: New test.
+
2023-07-05 Michael Meissner
Backported from master:
commit 8e365976ddc856a4c08aa52f90799330baed599a
Author: Harald Anlauf
Date: Fri Jul 7 20:25:06 2023
Fortran: simplification of FINDLOC for constant complex arguments [PR110585]
gcc/fortran/ChangeLog:
PR fortran/110585
* arith.c (gfc_compare_expr): Handle equality comparison of constant
complex gfc_expr arguments.
gcc/testsuite/ChangeLog:
PR fortran/110585
* gfortran.dg/findloc_9.f90: New test.
(cherry picked from commit 7ac1581d066a6f3a0d4acf1042a74634258b4966)
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index 8a0d70d23ba..aed449ede89 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -1080,6 +1080,11 @@ gfc_compare_expr (gfc_expr *op1, gfc_expr *op2, gfc_intrinsic_op op)
|| (op1->value.logical && !op2->value.logical));
break;
+ case BT_COMPLEX:
+ gcc_assert (op == INTRINSIC_EQ);
+ rc = mpc_cmp (op1->value.complex, op2->value.complex);
+ break;
+
default:
gfc_internal_error ("gfc_compare_expr(): Bad basic type");
}
diff --git a/gcc/testsuite/gfortran.dg/findloc_9.f90 b/gcc/testsuite/gfortran.dg/findloc_9.f90
new file mode 100644
index 00000000000..05974476cb3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/findloc_9.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+! PR fortran/110585 - simplification of FINDLOC for constant complex arguments
+
+program mvce
+ implicit none
+ integer, parameter :: a(*) = findloc([(1.,0.),(2.,1.)], (2.,0.))
+ integer, parameter :: b(*) = findloc([(1.,0.),(2.,1.)], (2.,0.), back=.true.)
+ integer, parameter :: c(*) = findloc([(1.,0.),(2.,1.)], (2.,1.))
+ integer, parameter :: d(*) = findloc([(1.,0.),(2.,1.)], (2.,1.), back=.true.)
+ integer, parameter :: e = findloc([(1.,0.),(2.,1.)], (2.,1.), dim=1)
+ if (a(1) /= 0) stop 1
+ if (b(1) /= 0) stop 2
+ if (c(1) /= 2) stop 3
+ if (d(1) /= 2) stop 4
+ if (e /= 2) stop 5
+end
+
+! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "original" } }
commit 5a18e3b744e3d1d8c80a0b2b3ae99a631765ba9f
Author: GCC Administrator
Date: Sun Jul 9 02:18:19 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index f3144f1474c..6ca206c427e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230708
+20230709
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e7b9d5c735f..f60f324aea7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,12 @@
+2023-07-08 Harald Anlauf
+
+ Backported from master:
+ 2023-07-08 Harald Anlauf
+
+ PR fortran/110585
+ * arith.c (gfc_compare_expr): Handle equality comparison of constant
+ complex gfc_expr arguments.
+
2023-06-09 Jakub Jelinek
Backported from master:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fd1169aa1cd..f5fb43e4bf4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2023-07-08 Harald Anlauf
+
+ Backported from master:
+ 2023-07-08 Harald Anlauf
+
+ PR fortran/110585
+ * gfortran.dg/findloc_9.f90: New test.
+
2023-07-07 Iain Buclaw
Backported from master:
commit 4127c426e8447963a12b83acdde14dff511e30bf
Author: GCC Administrator
Date: Mon Jul 10 02:18:07 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 6ca206c427e..1d5dd3c5cda 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230709
+20230710
commit d308b11fa94728507984b4ccc949219511273ab6
Author: Jonathan Wakely
Date: Fri Nov 11 16:22:02 2022
libstdc++: Fix wstring conversions in filesystem::path [PR95048]
In commit r9-7381-g91756c4abc1757 I changed filesystem::path to use
std::codecvt for conversions from all wide
strings to UTF-8, instead of using std::codecvt_utf8. This was
done because for 16-bit wchar_t, std::codecvt_utf8 only
supports UCS-2 and not UTF-16. The rationale for the change was sound,
but the actual fix was not. It's OK to use std::codecvt for char16_t or
char32_t, because the specializations for those types always use UTF-8 ,
but std::codecvt uses the current locale's
encodings, and the narrow encoding is probably ASCII and can't support
non-ASCII characters.
The correct fix is to use std::codecvt only for char16_t and char32_t.
For 32-bit wchar_t we could have continued using std::codecvt_utf8
because that uses UTF-32 which is fine, switching to std::codecvt broke
non-Windows targets with 32-bit wchar_t. For 16-bit wchar_t we did need
to change, but should have changed to std::codecvt_utf8_utf16
instead, as that always uses UTF-16 not UCS-2. I actually noted that in
the commit message for r9-7381-g91756c4abc1757 but didn't use that
option. Oops.
This replaces the unconditional std::codecvt
with a type defined via template specialization, so it can vary
depending on the wide character type. The code is also simplified to
remove some of the mess of #ifdef and if-constexpr conditions.
libstdc++-v3/ChangeLog:
PR libstdc++/95048
* include/bits/fs_path.h (path::_Codecvt): New class template
that selects the kind of code conversion done.
(path::_Codecvt): Select based on sizeof(wchar_t).
(_GLIBCXX_CONV_FROM_UTF8): New macro to allow the same code to
be used for Windows and POSIX.
(path::_S_convert(const EcharT*, const EcharT*)): Simplify by
using _Codecvt and _GLIBCXX_CONV_FROM_UTF8 abstractions.
(path::_S_str_convert(basic_string_view, const A&)):
Simplify nested conditions.
* include/experimental/bits/fs_path.h (path::_Cvt): Define
nested typedef controlling type of code conversion done.
(path::_Cvt::_S_wconvert): Use new typedef.
(path::string(const A&)): Likewise.
* testsuite/27_io/filesystem/path/construct/95048.cc: New test.
* testsuite/experimental/filesystem/path/construct/95048.cc: New
test.
(cherry picked from commit b331bf303bdc1edead41e2b3d11d1a7804b433cf)
diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index 1188e585b14..029a6f365b3 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -684,6 +684,8 @@ namespace __detail
_List _M_cmpts;
struct _Parser;
+
+ template struct _Codecvt;
};
/// @{
@@ -811,55 +813,72 @@ namespace __detail
size_t _M_pos;
};
+ // path::_Codecvt Performs conversions between C and path::string_type.
+ // The native encoding of char strings is the OS-dependent current
+ // encoding for pathnames. FIXME: We assume this is UTF-8 everywhere,
+ // but should use a Windows API to query it.
+
+ // Converts between native pathname encoding and char16_t or char32_t.
+ template
+ struct path::_Codecvt
+ // Need derived class here because std::codecvt has protected destructor.
+ : std::codecvt<_EcharT, char, mbstate_t>
+ { };
+
+ // Converts between native pathname encoding and native wide encoding.
+ // The native encoding for wide strings is the execution wide-character
+ // set encoding. FIXME: We assume that this is either UTF-32 or UTF-16
+ // (depending on the width of wchar_t). That matches GCC's default,
+ // but can be changed with -fwide-exec-charset.
+ // We need a custom codecvt converting the native pathname encoding
+ // to/from the native wide encoding.
+ template<>
+ struct path::_Codecvt
+ : conditional_t, // UTF-8 <-> UTF-32
+ std::codecvt_utf8_utf16> // UTF-8 <-> UTF-16
+ { };
+
template
auto
path::_S_convert(const _EcharT* __f, const _EcharT* __l)
{
static_assert(__detail::__is_encoded_char<_EcharT>);
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+# define _GLIBCXX_CONV_FROM_UTF8(S) __detail::__wstr_from_utf8(S)
+#else
+# define _GLIBCXX_CONV_FROM_UTF8(S) S
+#endif
+
if constexpr (is_same_v<_EcharT, value_type>)
return basic_string_view(__f, __l - __f);
-#if !defined _GLIBCXX_FILESYSTEM_IS_WINDOWS && defined _GLIBCXX_USE_CHAR8_T
+#ifdef _GLIBCXX_USE_CHAR8_T
else if constexpr (is_same_v<_EcharT, char8_t>)
- // For POSIX converting from char8_t to char is also 'noconv'
- return string_view(reinterpret_cast(__f), __l - __f);
-#endif
- else
{
+ string_view __str(reinterpret_cast(__f), __l - __f);
+ return _GLIBCXX_CONV_FROM_UTF8(__str);
+ }
+#endif
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ else if constexpr (is_same_v<_EcharT, char>)
+ {
std::wstring __wstr;
- if constexpr (is_same_v<_EcharT, char>)
- {
- struct _UCvt : std::codecvt
- { } __cvt;
- if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
- return __wstr;
- }
-#ifdef _GLIBCXX_USE_CHAR8_T
- else if constexpr (is_same_v<_EcharT, char8_t>)
- {
- const auto __f2 = reinterpret_cast(__f);
- return __detail::__wstr_from_utf8(string_view(__f2, __l - __f));
- }
+ path::_Codecvt __cvt;
+ if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
+ return __wstr;
+ }
#endif
- else // char16_t or char32_t
- {
- struct _UCvt : std::codecvt<_EcharT, char, std::mbstate_t>
- { } __cvt;
- std::string __str;
- if (__str_codecvt_out_all(__f, __l, __str, __cvt))
- return __detail::__wstr_from_utf8(__str);
- }
-#else // ! windows
- struct _UCvt : std::codecvt<_EcharT, char, std::mbstate_t>
- { } __cvt;
+ else
+ {
+ path::_Codecvt<_EcharT> __cvt;
std::string __str;
if (__str_codecvt_out_all(__f, __l, __str, __cvt))
- return __str;
-#endif
- __detail::__throw_conversion_error();
+ return _GLIBCXX_CONV_FROM_UTF8(__str);
}
+ __detail::__throw_conversion_error();
}
+#undef _GLIBCXX_CONV_FROM_UTF8
/// @endcond
@@ -1028,7 +1047,9 @@ namespace __detail
if (__str.size() == 0)
return _WString(__a);
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ string_view __u8str = __str;
+#else
// First convert native string from UTF-16 to to UTF-8.
// XXX This assumes that the execution wide-character set is UTF-16.
std::codecvt_utf8_utf16 __cvt;
@@ -1038,35 +1059,30 @@ namespace __detail
_String __u8str{_CharAlloc{__a}};
const value_type* __wfirst = __str.data();
const value_type* __wlast = __wfirst + __str.size();
- if (__str_codecvt_out_all(__wfirst, __wlast, __u8str, __cvt)) {
+ if (!__str_codecvt_out_all(__wfirst, __wlast, __u8str, __cvt))
+ __detail::__throw_conversion_error();
if constexpr (is_same_v<_CharT, char>)
return __u8str; // XXX assumes native ordinary encoding is UTF-8.
- else {
-
- const char* __first = __u8str.data();
- const char* __last = __first + __u8str.size();
-#else
- const value_type* __first = __str.data();
- const value_type* __last = __first + __str.size();
-#endif
-
- // Convert UTF-8 string to requested format.
-#ifdef _GLIBCXX_USE_CHAR8_T
- if constexpr (is_same_v<_CharT, char8_t>)
- return _WString(__first, __last, __a);
else
#endif
{
- // Convert UTF-8 to wide string.
- _WString __wstr(__a);
- struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t> { } __cvt;
- if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
- return __wstr;
- }
+ const char* __first = __u8str.data();
+ const char* __last = __first + __u8str.size();
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- } }
+ // Convert UTF-8 string to requested format.
+#ifdef _GLIBCXX_USE_CHAR8_T
+ if constexpr (is_same_v<_CharT, char8_t>)
+ return _WString(__first, __last, __a);
+ else
#endif
+ {
+ // Convert UTF-8 to wide string.
+ _WString __wstr(__a);
+ path::_Codecvt<_CharT> __cvt;
+ if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
+ return __wstr;
+ }
+ }
__detail::__throw_conversion_error();
}
/// @endcond
diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index 830b51e45a0..65d63e433e0 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -748,15 +748,48 @@ namespace __detail
template<>
struct path::_Cvt
{
+ // We need this type to be defined because we don't have `if constexpr`
+ // in C++11 and so path::string(const A&) needs to be able to
+ // declare a variable of this type and pass it to __str_codecvt_in_all.
+ using __codecvt_utf8_to_wide = _Cvt;
+ // Dummy overload used for unreachable calls in path::string.
+ template
+ friend bool
+ __str_codecvt_in_all(const char*, const char*,
+ _WStr&, __codecvt_utf8_to_wide&) noexcept
+ { return true; }
+
template
static string_type
_S_convert(_Iter __first, _Iter __last)
{ return string_type{__first, __last}; }
};
+ // Performs conversions from _CharT to path::string_type.
template
struct path::_Cvt
{
+ // FIXME: We currently assume that the native wide encoding for wchar_t
+ // is either UTF-32 or UTF-16 (depending on the width of wchar_t).
+ // See comments in for further details.
+ using __codecvt_utf8_to_wchar
+ = typename conditional, // from UTF-32
+ std::codecvt_utf8_utf16 // from UTF-16
+ >::type;
+
+ // Converts from char16_t or char32_t using std::codecvt.
+ // Need derived class here because std::codecvt has protected destructor.
+ struct __codecvt_utf8_to_utfNN : std::codecvt<_CharT, char, mbstate_t>
+ { };
+
+ // Convert from native pathname format (assumed to be UTF-8 everywhere)
+ // to the encoding implied by the wide character type _CharT.
+ using __codecvt_utf8_to_wide
+ = typename conditional::value,
+ __codecvt_utf8_to_wchar,
+ __codecvt_utf8_to_utfNN>::type;
+
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
#ifdef _GLIBCXX_USE_CHAR8_T
static string_type
@@ -774,8 +807,7 @@ namespace __detail
static string_type
_S_wconvert(const char* __f, const char* __l, const char*)
{
- using _Cvt = std::codecvt;
- const auto& __cvt = std::use_facet<_Cvt>(std::locale{});
+ std::codecvt_utf8_utf16 __cvt;
std::wstring __wstr;
if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
return __wstr;
@@ -787,8 +819,7 @@ namespace __detail
static string_type
_S_wconvert(const _CharT* __f, const _CharT* __l, const void*)
{
- struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t>
- { } __cvt;
+ __codecvt_utf8_to_wide __cvt;
std::string __str;
if (__str_codecvt_out_all(__f, __l, __str, __cvt))
{
@@ -819,8 +850,7 @@ namespace __detail
else
#endif
{
- struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t>
- { } __cvt;
+ __codecvt_utf8_to_wide __cvt;
std::string __str;
if (__str_codecvt_out_all(__f, __l, __str, __cvt))
return __str;
@@ -990,7 +1020,7 @@ namespace __detail
inline std::basic_string<_CharT, _Traits, _Allocator>
path::string(const _Allocator& __a) const
{
- if (is_same<_CharT, value_type>::value)
+ if _GLIBCXX_CONSTEXPR (is_same<_CharT, value_type>::value)
return { _M_pathname.begin(), _M_pathname.end(), __a };
using _WString = basic_string<_CharT, _Traits, _Allocator>;
@@ -1026,9 +1056,8 @@ namespace __detail
else
#endif
{
- // Convert UTF-8 to wide string.
- struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t>
- { } __cvt;
+ // Convert UTF-8 to char16_t or char32_t string.
+ typename path::_Cvt<_CharT>::__codecvt_utf8_to_wide __cvt;
const char* __f = __from.data();
const char* __l = __f + __from.size();
if (__str_codecvt_in_all(__f, __l, __to, __cvt))
@@ -1041,14 +1070,14 @@ namespace __detail
if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
return *__p;
}
-#else
+#else // ! Windows
#ifdef _GLIBCXX_USE_CHAR8_T
if constexpr (is_same<_CharT, char8_t>::value)
return _WString(__first, __last, __a);
else
#endif
{
- struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t> { } __cvt;
+ typename path::_Cvt<_CharT>::__codecvt_utf8_to_wide __cvt;
_WString __wstr(__a);
if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
return __wstr;
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc
new file mode 100644
index 00000000000..c1a382d1420
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc
@@ -0,0 +1,45 @@
+// { dg-do run { target c++17 } }
+
+// C++17 30.10.8.4.1 path constructors [fs.path.construct]
+
+#include
+#include
+
+using std::filesystem::path;
+
+#define CHECK(E, S) (path(E##S) == path(u8##S))
+
+void
+test_wide()
+{
+ VERIFY( CHECK(L, "\u00E4") ); // PR libstdc++/95048
+ VERIFY( CHECK(L, "\U0001F4C1") ); // folder
+ VERIFY( CHECK(L, "\U0001F4C2") ); // open folder
+ VERIFY( CHECK(L, "\U0001F4C4") ); // filing cabient
+}
+
+void
+test_u16()
+{
+ VERIFY( CHECK(u, "\u00E4") ); // PR libstdc++/95048
+ VERIFY( CHECK(u, "\U0001F4C1") ); // folder
+ VERIFY( CHECK(u, "\U0001F4C2") ); // open folder
+ VERIFY( CHECK(u, "\U0001F4C4") ); // filing cabient
+}
+
+void
+test_u32()
+{
+ VERIFY( CHECK(U, "\u00E4") ); // PR libstdc++/95048
+ VERIFY( CHECK(U, "\U0001F4C1") ); // folder
+ VERIFY( CHECK(U, "\U0001F4C2") ); // open folder
+ VERIFY( CHECK(U, "\U0001F4C4") ); // filing cabient
+}
+
+int
+main()
+{
+ test_wide();
+ test_u16();
+ test_u32();
+}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc
new file mode 100644
index 00000000000..b7a93f3c985
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc
@@ -0,0 +1,47 @@
+// { dg-options "-lstdc++fs" }
+// { dg-do run { target c++11 } }
+// { dg-require-filesystem-ts "" }
+
+// 8.4.1 path constructors [path.construct]
+
+#include
+#include
+
+using std::experimental::filesystem::path;
+
+#define CHECK(E, S) (path(E##S) == path(u8##S))
+
+void
+test_wide()
+{
+ VERIFY( CHECK(L, "\u00E4") ); // PR libstdc++/95048
+ VERIFY( CHECK(L, "\U0001F4C1") ); // folder
+ VERIFY( CHECK(L, "\U0001F4C2") ); // open folder
+ VERIFY( CHECK(L, "\U0001F4C4") ); // filing cabient
+}
+
+void
+test_u16()
+{
+ VERIFY( CHECK(u, "\u00E4") ); // PR libstdc++/95048
+ VERIFY( CHECK(u, "\U0001F4C1") ); // folder
+ VERIFY( CHECK(u, "\U0001F4C2") ); // open folder
+ VERIFY( CHECK(u, "\U0001F4C4") ); // filing cabient
+}
+
+void
+test_u32()
+{
+ VERIFY( CHECK(U, "\u00E4") ); // PR libstdc++/95048
+ VERIFY( CHECK(U, "\U0001F4C1") ); // folder
+ VERIFY( CHECK(U, "\U0001F4C2") ); // open folder
+ VERIFY( CHECK(U, "\U0001F4C4") ); // filing cabient
+}
+
+int
+main()
+{
+ test_wide();
+ test_u16();
+ test_u32();
+}
commit ad292b7174069984343fc6a00c466e3e0fd720e8
Author: GCC Administrator
Date: Tue Jul 11 02:18:39 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 1d5dd3c5cda..2dbd21ed6c0 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230710
+20230711
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2041fb7219a..600a0706404 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,26 @@
+2023-07-10 Jonathan Wakely
+
+ Backported from master:
+ 2022-11-11 Jonathan Wakely
+
+ PR libstdc++/95048
+ * include/bits/fs_path.h (path::_Codecvt): New class template
+ that selects the kind of code conversion done.
+ (path::_Codecvt): Select based on sizeof(wchar_t).
+ (_GLIBCXX_CONV_FROM_UTF8): New macro to allow the same code to
+ be used for Windows and POSIX.
+ (path::_S_convert(const EcharT*, const EcharT*)): Simplify by
+ using _Codecvt and _GLIBCXX_CONV_FROM_UTF8 abstractions.
+ (path::_S_str_convert(basic_string_view, const A&)):
+ Simplify nested conditions.
+ * include/experimental/bits/fs_path.h (path::_Cvt): Define
+ nested typedef controlling type of code conversion done.
+ (path::_Cvt::_S_wconvert): Use new typedef.
+ (path::string(const A&)): Likewise.
+ * testsuite/27_io/filesystem/path/construct/95048.cc: New test.
+ * testsuite/experimental/filesystem/path/construct/95048.cc: New
+ test.
+
2023-06-23 Jonathan Wakely
Backported from master:
commit 13cfe6b2969de2981e8de60585ba204fbf9ce459
Author: GCC Administrator
Date: Wed Jul 12 02:18:17 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2dbd21ed6c0..b130beac02a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230711
+20230712
commit 470f32f964574febf484edaf9e580067ac97f3b6
Author: Jonathan Wakely
Date: Wed Jul 12 15:40:19 2023
libstdc++: Check conversion from filesystem::path to wide strings [PR95048]
The testcase added for this bug only checks conversion from wide strings
on construction, but the fix also covered conversion to wide strings via
path::wstring(). Add checks for that, and u16string() and u32string().
libstdc++-v3/ChangeLog:
PR libstdc++/95048
* testsuite/27_io/filesystem/path/construct/95048.cc: Check
conversions to wide strings.
* testsuite/experimental/filesystem/path/construct/95048.cc:
Likewise.
(cherry picked from commit d6384ad1a9ab7ea46990a7ed1299d5a2be4acece)
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc
index c1a382d1420..cd80d668b23 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc
@@ -16,6 +16,8 @@ test_wide()
VERIFY( CHECK(L, "\U0001F4C1") ); // folder
VERIFY( CHECK(L, "\U0001F4C2") ); // open folder
VERIFY( CHECK(L, "\U0001F4C4") ); // filing cabient
+
+ VERIFY( path(u8"\U0001D11E").wstring() == L"\U0001D11E" ); // G Clef
}
void
@@ -25,6 +27,8 @@ test_u16()
VERIFY( CHECK(u, "\U0001F4C1") ); // folder
VERIFY( CHECK(u, "\U0001F4C2") ); // open folder
VERIFY( CHECK(u, "\U0001F4C4") ); // filing cabient
+
+ VERIFY( path(u8"\U0001D11E").u16string() == u"\U0001D11E" ); // G Clef
}
void
@@ -34,6 +38,8 @@ test_u32()
VERIFY( CHECK(U, "\U0001F4C1") ); // folder
VERIFY( CHECK(U, "\U0001F4C2") ); // open folder
VERIFY( CHECK(U, "\U0001F4C4") ); // filing cabient
+
+ VERIFY( path(u8"\U0001D11E").u32string() == U"\U0001D11E" ); // G Clef
}
int
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc
index b7a93f3c985..fc65bfecd4d 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc
@@ -18,6 +18,8 @@ test_wide()
VERIFY( CHECK(L, "\U0001F4C1") ); // folder
VERIFY( CHECK(L, "\U0001F4C2") ); // open folder
VERIFY( CHECK(L, "\U0001F4C4") ); // filing cabient
+
+ VERIFY( path(u8"\U0001D11E").wstring() == L"\U0001D11E" ); // G Clef
}
void
@@ -27,6 +29,8 @@ test_u16()
VERIFY( CHECK(u, "\U0001F4C1") ); // folder
VERIFY( CHECK(u, "\U0001F4C2") ); // open folder
VERIFY( CHECK(u, "\U0001F4C4") ); // filing cabient
+
+ VERIFY( path(u8"\U0001D11E").u16string() == u"\U0001D11E" ); // G Clef
}
void
@@ -36,6 +40,8 @@ test_u32()
VERIFY( CHECK(U, "\U0001F4C1") ); // folder
VERIFY( CHECK(U, "\U0001F4C2") ); // open folder
VERIFY( CHECK(U, "\U0001F4C4") ); // filing cabient
+
+ VERIFY( path(u8"\U0001D11E").u32string() == U"\U0001D11E" ); // G Clef
}
int
commit b1aa00e3b46d994a332c1570d461b4b5c696bd30
Author: GCC Administrator
Date: Thu Jul 13 02:18:54 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b130beac02a..da7e2171bfa 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230712
+20230713
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 600a0706404..dda5eaf798e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+2023-07-12 Jonathan Wakely
+
+ Backported from master:
+ 2023-07-12 Jonathan Wakely
+
+ PR libstdc++/95048
+ * testsuite/27_io/filesystem/path/construct/95048.cc: Check
+ conversions to wide strings.
+ * testsuite/experimental/filesystem/path/construct/95048.cc:
+ Likewise.
+
2023-07-10 Jonathan Wakely
Backported from master:
commit ee7e78e6fe9fa53ab9c62c63bdf826772293ffb4
Author: GCC Administrator
Date: Fri Jul 14 02:18:43 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index da7e2171bfa..f1d307746c6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230713
+20230714
commit 75b8353e4b61566f7e8ac627204e2bcd6bfe60a6
Author: Oleg Endo
Date: Fri Jul 14 02:54:20 2023
SH: Fix PR101469 peephole bug
gcc/ChangeLog:
PR target/101469
* config/sh/sh.md (peephole2): Handle case where eliminated reg
is also used by the address of the following memory operand.
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index e3af9ae21c1..963984060e6 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -10680,6 +10680,45 @@
&& peep2_reg_dead_p (2, operands[1]) && peep2_reg_dead_p (3, operands[0])"
[(const_int 0)]
{
+ if (MEM_P (operands[3]) && reg_overlap_mentioned_p (operands[0], operands[3]))
+ {
+ // Take care when the eliminated operand[0] register is part of
+ // the destination memory address.
+ rtx addr = XEXP (operands[3], 0);
+
+ if (REG_P (addr))
+ operands[3] = replace_equiv_address (operands[3], operands[1]);
+
+ else if (GET_CODE (addr) == PLUS && REG_P (XEXP (addr, 0))
+ && CONST_INT_P (XEXP (addr, 1))
+ && REGNO (operands[0]) == REGNO (XEXP (addr, 0)))
+ operands[3] = replace_equiv_address (operands[3],
+ gen_rtx_PLUS (SImode, operands[1], XEXP (addr, 1)));
+
+ else if (GET_CODE (addr) == PLUS && REG_P (XEXP (addr, 0))
+ && REG_P (XEXP (addr, 1)))
+ {
+ // register + register address @(R0, Rn)
+ // can change only the Rn in the address, not R0.
+ if (REGNO (operands[0]) == REGNO (XEXP (addr, 0))
+ && REGNO (XEXP (addr, 0)) != 0)
+ {
+ operands[3] = replace_equiv_address (operands[3],
+ gen_rtx_PLUS (SImode, operands[1], XEXP (addr, 1)));
+ }
+ else if (REGNO (operands[0]) == REGNO (XEXP (addr, 1))
+ && REGNO (XEXP (addr, 1)) != 0)
+ {
+ operands[3] = replace_equiv_address (operands[3],
+ gen_rtx_PLUS (SImode, XEXP (addr, 0), operands[1]));
+ }
+ else
+ FAIL;
+ }
+ else
+ FAIL;
+ }
+
emit_insn (gen_addsi3 (operands[1], operands[1], operands[2]));
sh_peephole_emit_move_insn (operands[3], operands[1]);
})
commit a348245bfb018f02b36d22575380b34aef58f52c
Author: Harald Anlauf
Date: Tue Jul 11 21:21:25 2023
Fortran: formal symbol attributes for intrinsic procedures [PR110288]
gcc/fortran/ChangeLog:
PR fortran/110288
* symbol.c (gfc_copy_formal_args_intr): When deriving the formal
argument attributes from the actual ones for intrinsic procedure
calls, take special care of CHARACTER arguments that we do not
wrongly treat them formally as deferred-length.
gcc/testsuite/ChangeLog:
PR fortran/110288
* gfortran.dg/findloc_10.f90: New test.
(cherry picked from commit 3b2c523ae31b68fc3b8363b458a55eec53a44365)
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index c164e94bec0..56ad114d84f 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -4705,6 +4705,13 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src,
formal_arg->sym->attr.flavor = FL_VARIABLE;
formal_arg->sym->attr.dummy = 1;
+ /* Do not treat an actual deferred-length character argument wrongly
+ as template for the formal argument. */
+ if (formal_arg->sym->ts.type == BT_CHARACTER
+ && !(formal_arg->sym->attr.allocatable
+ || formal_arg->sym->attr.pointer))
+ formal_arg->sym->ts.deferred = false;
+
if (formal_arg->sym->ts.type == BT_CHARACTER)
formal_arg->sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
diff --git a/gcc/testsuite/gfortran.dg/findloc_10.f90 b/gcc/testsuite/gfortran.dg/findloc_10.f90
new file mode 100644
index 00000000000..4d5ecd2306a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/findloc_10.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! { dg-options "-fdump-tree-original" }
+! PR fortran/110288 - FINDLOC and deferred-length character arguments
+
+program test
+ character(len=:), allocatable :: array(:)
+ character(len=:), allocatable :: value
+ array = ["bb", "aa"]
+ value = "aa"
+ if (findloc (array, value, dim=1) /= 2) stop 1
+end program test
+
+! { dg-final { scan-tree-dump "_gfortran_findloc2_s1 \\(.*, \\.array, \\.value\\)" "original" } }
commit f90c33de591a533f07cb3288ef8c46c710b642fa
Author: GCC Administrator
Date: Sat Jul 15 02:19:01 2023
Daily bump.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 00a1676698d..28855046707 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-14 Oleg Endo
+
+ PR target/101469
+ * config/sh/sh.md (peephole2): Handle case where eliminated reg
+ is also used by the address of the following memory operand.
+
2023-07-05 Michael Meissner
Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index f1d307746c6..fc4e8edc1af 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230714
+20230715
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f60f324aea7..d2403cb3c30 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,14 @@
+2023-07-14 Harald Anlauf
+
+ Backported from master:
+ 2023-07-11 Harald Anlauf
+
+ PR fortran/110288
+ * symbol.c (gfc_copy_formal_args_intr): When deriving the formal
+ argument attributes from the actual ones for intrinsic procedure
+ calls, take special care of CHARACTER arguments that we do not
+ wrongly treat them formally as deferred-length.
+
2023-07-08 Harald Anlauf
Backported from master:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f5fb43e4bf4..ebba869e7e1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2023-07-14 Harald Anlauf
+
+ Backported from master:
+ 2023-07-11 Harald Anlauf
+
+ PR fortran/110288
+ * gfortran.dg/findloc_10.f90: New test.
+
2023-07-08 Harald Anlauf
Backported from master:
commit 5922cf37cb641f7370f2ae587322f8a290c840fe
Author: GCC Administrator
Date: Sun Jul 16 02:18:46 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index fc4e8edc1af..d452cda0b47 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230715
+20230716
commit ddd174aa10bc6b27d59b739cf1126f4e4d2df7d8
Author: GCC Administrator
Date: Mon Jul 17 02:18:46 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d452cda0b47..4a97c3e4719 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230716
+20230717
commit 262b1d00c5983e547e46a8b732cda5bd27237311
Author: GCC Administrator
Date: Tue Jul 18 02:18:57 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 4a97c3e4719..5e9edc95482 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230717
+20230718
commit 7d80cb76aceef4f044c6c8ba74504ee7ded71459
Author: GCC Administrator
Date: Wed Jul 19 02:19:09 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 5e9edc95482..2292579c26f 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230718
+20230719
commit 75e5023f3151a50801c1551b9ae28328950d729b
Author: Maciej W. Rozycki
Date: Tue Jul 11 16:57:33 2023
testsuite: Require vectors of doubles for pr97428.c
The pr97428.c test assumes support for vectors of doubles, but some
targets only support vectors of floats, causing this test to fail with
such targets. Limit this test to targets that support vectors of
doubles then.
gcc/testsuite/
* gcc.dg/vect/pr97428.c: Limit to `vect_double' targets.
(cherry picked from commit 5d9fc2aced3a2128527afd4a627424542f238471)
diff --git a/gcc/testsuite/gcc.dg/vect/pr97428.c b/gcc/testsuite/gcc.dg/vect/pr97428.c
index bbd743a76c4..ad6416096aa 100644
--- a/gcc/testsuite/gcc.dg/vect/pr97428.c
+++ b/gcc/testsuite/gcc.dg/vect/pr97428.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
typedef struct { double re, im; } dcmlx_t;
typedef struct { double re[4], im[4]; } dcmlx4_t;
commit 1c807686415880c5e3e472ebe39de31e54af2296
Author: GCC Administrator
Date: Thu Jul 20 02:19:16 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2292579c26f..4b8414aa23f 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230719
+20230720
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ebba869e7e1..02ec7dee6a4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-19 Maciej W. Rozycki
+
+ Backported from master:
+ 2023-07-11 Maciej W. Rozycki
+
+ * gcc.dg/vect/pr97428.c: Limit to `vect_double' targets.
+
2023-07-14 Harald Anlauf
Backported from master:
commit 7bd1373f87d581b1e5482f9c558d481c38027a99
Author: Harald Anlauf
Date: Sun Jul 16 22:17:27 2023
Fortran: intrinsics and deferred-length character arguments [PR95947,PR110658]
gcc/fortran/ChangeLog:
PR fortran/95947
PR fortran/110658
* trans-expr.c (gfc_conv_procedure_call): For intrinsic procedures
whose result characteristics depends on the first argument and which
can be of type character, the character length will not be deferred.
gcc/testsuite/ChangeLog:
PR fortran/95947
PR fortran/110658
* gfortran.dg/deferred_character_37.f90: New test.
(cherry picked from commit 95ddd2659849a904509067ec3a2770135149a722)
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 35d3c8897e2..5adee114157 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7016,7 +7016,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
(and other intrinsics?) and dummy functions. In the case of SPREAD,
we take the character length of the first argument for the result.
For dummies, we have to look through the formal argument list for
- this function and use the character length found there.*/
+ this function and use the character length found there.
+ Likewise, we handle the case of deferred-length character dummy
+ arguments to intrinsics that determine the characteristics of
+ the result, which cannot be deferred-length. */
+ if (expr->value.function.isym)
+ ts.deferred = false;
if (ts.deferred)
cl.backend_decl = gfc_create_var (gfc_charlen_type_node, "slen");
else if (!sym->attr.dummy)
diff --git a/gcc/testsuite/gfortran.dg/deferred_character_37.f90 b/gcc/testsuite/gfortran.dg/deferred_character_37.f90
new file mode 100644
index 00000000000..8a5a8c5daf8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deferred_character_37.f90
@@ -0,0 +1,88 @@
+! { dg-do run }
+! PR fortran/95947
+! PR fortran/110658
+!
+! Test deferred-length character arguments to selected intrinsics
+! that may return a character result of same length as first argument:
+! CSHIFT, EOSHIFT, MAXVAL, MERGE, MINVAL, PACK, SPREAD, TRANSPOSE, UNPACK
+
+program p
+ implicit none
+ call pr95947 ()
+ call pr110658 ()
+ call s ()
+
+contains
+
+ subroutine pr95947
+ character(len=:), allocatable :: m(:)
+
+ m = [ character(len=10) :: 'ape','bat','cat','dog','eel','fly','gnu']
+ m = pack (m, mask=(m(:)(2:2) == 'a'))
+
+! print *, "m = '", m,"' ", "; expected is ['bat','cat']"
+ if (.not. all (m == ['bat','cat'])) stop 1
+
+! print *, "size(m) = ", size(m), "; expected is 2"
+ if (size (m) /= 2) stop 2
+
+! print *, "len(m) = ", len(m), "; expected is 10"
+ if (len (m) /= 10) stop 3
+
+! print *, "len_trim(m) = ", len_trim(m), "; expected is 3 3"
+ if (.not. all (len_trim(m) == [3,3])) stop 4
+ end
+
+ subroutine pr110658
+ character(len=:), allocatable :: array(:), array2(:,:)
+ character(len=:), allocatable :: res, res1(:), res2(:)
+
+ array = ["bb", "aa", "cc"]
+
+ res = minval (array)
+ if (res /= "aa") stop 11
+
+ res = maxval (array, mask=[.true.,.true.,.false.])
+ if (res /= "bb") stop 12
+
+ res1 = cshift (array, 1)
+ if (any (res1 /= ["aa","cc","bb"])) stop 13
+
+ res2 = eoshift (res1, -1)
+ if (any (res2 /= [" ", "aa", "cc"])) stop 14
+
+ res2 = pack (array, mask=[.true.,.false.,.true.])
+ if (any (res2 /= ["bb","cc"])) stop 15
+
+ res2 = unpack (res2, mask=[.true.,.false.,.true.], field="aa")
+ if (any (res2 /= array)) stop 16
+
+ res2 = merge (res2, array, [.true.,.false.,.true.])
+ if (any (res2 /= array)) stop 17
+
+ array2 = spread (array, dim=2, ncopies=2)
+ array2 = transpose (array2)
+ if (any (shape (array2) /= [2,3])) stop 18
+ if (any (array2(2,:) /= array)) stop 19
+ end
+
+ subroutine s
+ character(:), allocatable :: array1(:), array2(:)
+ array1 = ["aa","cc","bb"]
+ array2 = copy (array1)
+ if (any (array1 /= array2)) stop 20
+ end
+
+ function copy (arg) result (res)
+ character(:), allocatable :: res(:)
+ character(*), intent(in) :: arg(:)
+ integer :: i, k, n
+ k = len (arg)
+ n = size (arg)
+ allocate (character(k) :: res(n))
+ do i = 1, n
+ res(i) = arg(i)
+ end do
+ end
+
+end
commit 471f1a33919e1775fe58a7fcbe88c93d6c2fffc5
Author: GCC Administrator
Date: Fri Jul 21 02:19:00 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 4b8414aa23f..0e7d73c1914 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230720
+20230721
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d2403cb3c30..431c1351189 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,14 @@
+2023-07-20 Harald Anlauf
+
+ Backported from master:
+ 2023-07-17 Harald Anlauf
+
+ PR fortran/95947
+ PR fortran/110658
+ * trans-expr.c (gfc_conv_procedure_call): For intrinsic procedures
+ whose result characteristics depends on the first argument and which
+ can be of type character, the character length will not be deferred.
+
2023-07-14 Harald Anlauf
Backported from master:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 02ec7dee6a4..3e2b87e98a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2023-07-20 Harald Anlauf
+
+ Backported from master:
+ 2023-07-17 Harald Anlauf
+
+ PR fortran/95947
+ PR fortran/110658
+ * gfortran.dg/deferred_character_37.f90: New test.
+
2023-07-19 Maciej W. Rozycki
Backported from master:
commit 17136c4c25e7191b2d216692849754686538bf9a
Author: GCC Administrator
Date: Sat Jul 22 02:19:21 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 0e7d73c1914..05e1afb478c 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230721
+20230722
commit 3e5f7ba27e078524ac06b610454a512a03c9c6ac
Author: GCC Administrator
Date: Sun Jul 23 02:19:18 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 05e1afb478c..15985d1de54 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230722
+20230723
commit 9abc0e9949d0af2424ae968de8e624529c4fca5f
Author: GCC Administrator
Date: Mon Jul 24 02:18:59 2023
Daily bump.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 15985d1de54..03f4ad7154f 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230723
+20230724