This commit is contained in:
Jakub Jelinek 2022-11-03 17:07:37 +01:00
parent c9c54ba24f
commit a492697acf
3 changed files with 40 additions and 312 deletions

View File

@ -1,12 +1,12 @@
%global DATE 20220819 %global DATE 20221103
%global gitrev 12a206c28987ada47b447ebd200d1fd9639c8edd %global gitrev fa08f2733eed2cb77bf0d6bd86a74399be68b5a2
%global gcc_version 12.2.1 %global gcc_version 12.2.1
%global gcc_major 12 %global gcc_major 12
# Note, gcc_release must be integer, if you want to add suffixes to # Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line. # %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 2 %global gcc_release 3
%global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e %global nvptx_tools_gitrev 472b6e78b3ba918d727698f79911360b7c808247
%global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0 %global newlib_cygwin_gitrev a8526cb52bedabd4d6ba4b227a5185627f871aa1
%global _unpackaged_files_terminate_build 0 %global _unpackaged_files_terminate_build 0
%global _performance_build 1 %global _performance_build 1
# Hardening slows the compiler way too much. # Hardening slows the compiler way too much.
@ -151,7 +151,7 @@ Source1: nvptx-tools-%{nvptx_tools_gitrev}.tar.xz
# git --git-dir=newlib-cygwin-dir.tmp/.git archive --prefix=newlib-cygwin-%%{newlib_cygwin_gitrev}/ %%{newlib_cygwin_gitrev} ":(exclude)newlib/libc/sys/linux/include/rpc/*.[hx]" | xz -9e > newlib-cygwin-%%{newlib_cygwin_gitrev}.tar.xz # git --git-dir=newlib-cygwin-dir.tmp/.git archive --prefix=newlib-cygwin-%%{newlib_cygwin_gitrev}/ %%{newlib_cygwin_gitrev} ":(exclude)newlib/libc/sys/linux/include/rpc/*.[hx]" | xz -9e > newlib-cygwin-%%{newlib_cygwin_gitrev}.tar.xz
# rm -rf newlib-cygwin-dir.tmp # rm -rf newlib-cygwin-dir.tmp
Source2: newlib-cygwin-%{newlib_cygwin_gitrev}.tar.xz Source2: newlib-cygwin-%{newlib_cygwin_gitrev}.tar.xz
%global isl_version 0.18 %global isl_version 0.24
Source3: https://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2 Source3: https://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2
URL: http://gcc.gnu.org URL: http://gcc.gnu.org
# Need binutils with -pie support >= 2.14.90.0.4-4 # Need binutils with -pie support >= 2.14.90.0.4-4
@ -275,8 +275,6 @@ Patch8: gcc12-no-add-needed.patch
Patch9: gcc12-Wno-format-security.patch Patch9: gcc12-Wno-format-security.patch
Patch10: gcc12-rh1574936.patch Patch10: gcc12-rh1574936.patch
Patch11: gcc12-d-shared-libphobos.patch Patch11: gcc12-d-shared-libphobos.patch
Patch12: gcc12-p2327r1.patch
Patch13: gcc12-pr106590.patch
Patch100: gcc12-fortran-fdec-duplicates.patch Patch100: gcc12-fortran-fdec-duplicates.patch
Patch101: gcc12-fortran-flogical-as-integer.patch Patch101: gcc12-fortran-flogical-as-integer.patch
@ -804,8 +802,6 @@ so that there cannot be any synchronization problems.
%patch10 -p0 -b .rh1574936~ %patch10 -p0 -b .rh1574936~
%endif %endif
%patch11 -p0 -b .d-shared-libphobos~ %patch11 -p0 -b .d-shared-libphobos~
%patch12 -p0 -b .p2327r1~
%patch13 -p0 -b .pr106590~
%if 0%{?rhel} >= 9 %if 0%{?rhel} >= 9
%patch100 -p1 -b .fortran-fdec-duplicates~ %patch100 -p1 -b .fortran-fdec-duplicates~
@ -933,9 +929,9 @@ sed -i 's|libisl|libgcc12privateisl|g' \
make %{?_smp_mflags} make %{?_smp_mflags}
make install make install
cd ../isl-install/lib cd ../isl-install/lib
rm libgcc12privateisl.so{,.15} rm libgcc12privateisl.so{,.23}
mv libgcc12privateisl.so.15.3.0 libisl.so.15 mv libgcc12privateisl.so.23.1.0 libisl.so.23
ln -sf libisl.so.15 libisl.so ln -sf libisl.so.23 libisl.so
cd ../.. cd ../..
%endif %endif
@ -1144,7 +1140,7 @@ make jit.sphinx.install-html jit_htmldir=`pwd`/../../rpm.doc/libgccjit-devel/htm
cd .. cd ..
%if %{build_isl} %if %{build_isl}
cp -a isl-install/lib/libisl.so.15 gcc/ cp -a isl-install/lib/libisl.so.23 gcc/
%endif %endif
# Make generated man pages even if Pod::Man is not new enough # Make generated man pages even if Pod::Man is not new enough
@ -1294,7 +1290,7 @@ FULLPATH=%{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
FULLEPATH=%{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major} FULLEPATH=%{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
%if %{build_isl} %if %{build_isl}
cp -a isl-install/lib/libisl.so.15 $FULLPATH/ cp -a isl-install/lib/libisl.so.23 $FULLPATH/
%endif %endif
# fix some things # fix some things
@ -3217,19 +3213,45 @@ end
%endif %endif
%changelog %changelog
* Wed Sep 07 2022 Kalev Lember <klember@redhat.com> 12.2.1-2 * Thu Nov 3 2022 Jakub Jelinek <jakub@redhat.com> 12.2.1-3
- update from releases/gcc-12 branch
- PRs c++/93259, c++/105774, c++/106759, c++/106829, c++/106893, c++/106925,
c++/107358, c/106947, c/106981, c/107001, fortran/82868,
fortran/100029, fortran/100040, fortran/100097, fortran/100098,
fortran/100103, fortran/100132, fortran/100136, fortran/100245,
fortran/103413, fortran/103694, fortran/105012, fortran/105633,
fortran/106566, fortran/106579, fortran/106817, fortran/106857,
fortran/106985, fortran/106986, fortran/107054, libstdc++/105678,
libstdc++/106320, libstdc++/106589, libstdc++/106607,
libstdc++/106695, lto/107418, middle-end/106548, middle-end/106982,
other/106782, rtl-optimization/106187, target/96072, target/99184,
target/99685, target/100645, target/101322, target/103353,
target/104482, target/105421, target/105463, target/105485,
target/106017, target/106355, target/106459, target/106491,
target/106524, target/106704, target/106714, target/106721,
target/107061, target/107064, target/107248, target/107364,
tree-optimization/102892, tree-optimization/105937,
tree-optimization/106322, tree-optimization/106809,
tree-optimization/106841, tree-optimization/106860,
tree-optimization/106892, tree-optimization/106922,
tree-optimization/106934, tree-optimization/107107,
tree-optimization/107121, tree-optimization/107160,
tree-optimization/107212, tree-optimization/107254,
tree-optimization/107323
* Wed Sep 7 2022 Kalev Lember <klember@redhat.com> 12.2.1-2
- enable GDC on aarch64 - enable GDC on aarch64
* Fri Aug 19 2022 Jakub Jelinek <jakub@redhat.com> 12.2.1-1 * Fri Aug 19 2022 Jakub Jelinek <jakub@redhat.com> 12.2.1-1
- update from releases/gcc-12 branch - update from releases/gcc-12 branch
- GCC 12.1 release - GCC 12.2 release
- PRs c++/67048, c++/106369, c/106016, d/106623, d/106638, lto/106334, - PRs c++/67048, c++/106369, c/106016, d/106623, d/106638, lto/106334,
lto/106540, middle-end/106492, tree-optimization/106513 lto/106540, middle-end/106492, tree-optimization/106513
- fix an if-conversion wrong-code bug (PR rtl-optimization/106590) - fix an if-conversion wrong-code bug (PR rtl-optimization/106590)
- implement C++23 P2327R1 - de-deprecating volatile compound operations - as - implement C++23 P2327R1 - de-deprecating volatile compound operations - as
a DR a DR
* Wed Aug 8 2022 Jakub Jelinek <jakub@redhat.com> 12.1.1-4 * Wed Aug 10 2022 Jakub Jelinek <jakub@redhat.com> 12.1.1-4
- update from releases/gcc-12 branch - update from releases/gcc-12 branch
- PRs analyzer/105285, analyzer/106204, analyzer/106225, c++/53164, - PRs analyzer/105285, analyzer/106204, analyzer/106225, c++/53164,
c++/96363, c++/100374, c++/105541, c++/105626, c++/105634, c++/105637, c++/96363, c++/100374, c++/105541, c++/105626, c++/105634, c++/105637,

View File

@ -1,135 +0,0 @@
2022-08-16 Jakub Jelinek <jakub@redhat.com>
* typeck.cc (cp_build_modify_expr): Implement
P2327R1 - De-deprecating volatile compound operations. Don't warn
for |=, &= or ^= with volatile lhs.
* expr.cc (mark_use) <case MODIFY_EXPR>: Adjust warning wording,
leave out simple.
* g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile
compound |=, &= and ^= operations.
* g++.dg/cpp2a/volatile3.C: Likewise.
* g++.dg/cpp2a/volatile5.C: Likewise.
--- gcc/cp/expr.cc
+++ gcc/cp/expr.cc
@@ -220,7 +220,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p,
case MODIFY_EXPR:
{
tree lhs = TREE_OPERAND (expr, 0);
- /* [expr.ass] "A simple assignment whose left operand is of
+ /* [expr.ass] "An assignment whose left operand is of
a volatile-qualified type is deprecated unless the assignment
is either a discarded-value expression or appears in an
unevaluated context." */
@@ -230,7 +230,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p,
&& !TREE_THIS_VOLATILE (expr))
{
if (warning_at (location_of (expr), OPT_Wvolatile,
- "using value of simple assignment with "
+ "using value of assignment with "
"%<volatile%>-qualified left operand is "
"deprecated"))
/* Make sure not to warn about this assignment again. */
--- gcc/cp/typeck.cc
+++ gcc/cp/typeck.cc
@@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
/* An expression of the form E1 op= E2. [expr.ass] says:
"Such expressions are deprecated if E1 has volatile-qualified
- type." We warn here rather than in cp_genericize_r because
+ type and op is not one of the bitwise operators |, &, ^."
+ We warn here rather than in cp_genericize_r because
for compound assignments we are supposed to warn even if the
assignment is a discarded-value expression. */
- if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))
+ if (modifycode != BIT_AND_EXPR
+ && modifycode != BIT_IOR_EXPR
+ && modifycode != BIT_XOR_EXPR
+ && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)))
warning_at (loc, OPT_Wvolatile,
"compound assignment with %<volatile%>-qualified left "
"operand is deprecated");
--- gcc/testsuite/g++.dg/cpp2a/volatile1.C
+++ gcc/testsuite/g++.dg/cpp2a/volatile1.C
@@ -56,6 +56,9 @@ fn2 ()
vi = i;
vi = i = 42;
i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
&(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
(vi = 42, 45);
(i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
@@ -74,8 +77,9 @@ fn2 ()
vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
@@ -131,7 +135,8 @@ void raccoon ()
volatile T t, u;
t = 42;
u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
}
void
--- gcc/testsuite/g++.dg/cpp2a/volatile3.C
+++ gcc/testsuite/g++.dg/cpp2a/volatile3.C
@@ -57,6 +57,9 @@ fn2 ()
vi = i;
vi = i = 42;
i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
+ i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
+ i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
&(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
(vi = 42, 45);
(i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
@@ -75,8 +78,9 @@ fn2 ()
vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
@@ -132,7 +136,8 @@ void raccoon ()
volatile T t, u;
t = 42;
u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
}
void
--- gcc/testsuite/g++.dg/cpp2a/volatile5.C
+++ gcc/testsuite/g++.dg/cpp2a/volatile5.C
@@ -8,8 +8,8 @@ f (bool b)
{
(b ? x : y) = 1;
(b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } }
- z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
- ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
- (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
- (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
+ z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+ ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+ (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+ (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
}

View File

@ -1,159 +0,0 @@
2022-08-15 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/106590
* ifcvt.cc (check_for_cc_cmp_clobbers): New function.
(noce_convert_multiple_sets_1): If SEQ sets or clobbers any regs
mentioned in cc_cmp or rev_cc_cmp, don't consider seq2 for any
further conditional moves.
* gcc.dg/torture/pr106590.c: New test.
--- gcc/ifcvt.cc
+++ gcc/ifcvt.cc
@@ -3369,6 +3369,20 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
return TRUE;
}
+/* Helper function for noce_convert_multiple_sets_1. If store to
+ DEST can affect P[0] or P[1], clear P[0]. Called via note_stores. */
+
+static void
+check_for_cc_cmp_clobbers (rtx dest, const_rtx, void *p0)
+{
+ rtx *p = (rtx *) p0;
+ if (p[0] == NULL_RTX)
+ return;
+ if (reg_overlap_mentioned_p (dest, p[0])
+ || (p[1] && reg_overlap_mentioned_p (dest, p[1])))
+ p[0] = NULL_RTX;
+}
+
/* This goes through all relevant insns of IF_INFO->then_bb and tries to
create conditional moves. In case a simple move sufficis the insn
should be listed in NEED_NO_CMOV. The rewired-src cases should be
@@ -3519,7 +3533,7 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info,
as min/max and emit an insn, accordingly. */
unsigned cost1 = 0, cost2 = 0;
- rtx_insn *seq, *seq1, *seq2;
+ rtx_insn *seq, *seq1, *seq2 = NULL;
rtx temp_dest = NULL_RTX, temp_dest1 = NULL_RTX, temp_dest2 = NULL_RTX;
bool read_comparison = false;
@@ -3531,9 +3545,10 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info,
as well. This allows the backend to emit a cmov directly without
creating an additional compare for each. If successful, costing
is easier and this sequence is usually preferred. */
- seq2 = try_emit_cmove_seq (if_info, temp, cond,
- new_val, old_val, need_cmov,
- &cost2, &temp_dest2, cc_cmp, rev_cc_cmp);
+ if (cc_cmp)
+ seq2 = try_emit_cmove_seq (if_info, temp, cond,
+ new_val, old_val, need_cmov,
+ &cost2, &temp_dest2, cc_cmp, rev_cc_cmp);
/* The backend might have created a sequence that uses the
condition. Check this. */
@@ -3588,6 +3603,24 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info,
return FALSE;
}
+ if (cc_cmp)
+ {
+ /* Check if SEQ can clobber registers mentioned in
+ cc_cmp and/or rev_cc_cmp. If yes, we need to use
+ only seq1 from that point on. */
+ rtx cc_cmp_pair[2] = { cc_cmp, rev_cc_cmp };
+ for (walk = seq; walk; walk = NEXT_INSN (walk))
+ {
+ note_stores (walk, check_for_cc_cmp_clobbers, cc_cmp_pair);
+ if (cc_cmp_pair[0] == NULL_RTX)
+ {
+ cc_cmp = NULL_RTX;
+ rev_cc_cmp = NULL_RTX;
+ break;
+ }
+ }
+ }
+
/* End the sub sequence and emit to the main sequence. */
emit_insn (seq);
--- gcc/testsuite/gcc.dg/torture/pr106590.c
+++ gcc/testsuite/gcc.dg/torture/pr106590.c
@@ -0,0 +1,75 @@
+/* PR rtl-optimization/106590 } */
+/* { dg-do run } */
+/* { dg-additional-options "-mtune=skylake" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef struct A { short a; } A;
+typedef A *B;
+typedef struct C { int c, d; } C;
+typedef C *D;
+
+B
+foo (void)
+{
+ static A r = { .a = 1 };
+ return &r;
+}
+
+D
+bar (void)
+{
+ static C r = { .c = 1, .d = 23 };
+ return &r;
+}
+
+static inline int __attribute__((always_inline))
+baz (short a)
+{
+ int e = 1, f;
+ short g;
+ D h;
+
+ switch (a)
+ {
+ case 1:
+ f = 23;
+ g = 1;
+ break;
+ case 2:
+ f = 20;
+ g = 2;
+ break;
+ }
+
+ h = bar ();
+
+ if (h->d != f || h->c != g)
+ __builtin_abort ();
+ return e;
+}
+
+int
+qux (void)
+{
+ B i = foo ();
+ int e = 1;
+
+ switch (i->a)
+ {
+ case 1:
+ case 2:
+ e = baz (i->a);
+ break;
+ case 3:
+ e = 0;
+ break;
+ }
+
+ return e;
+}
+
+int
+main ()
+{
+ qux ();
+ return 0;
+}