diff --git a/.gitignore b/.gitignore index 147c853..bf35d3e 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ /gcc-12.0.1-20220118.tar.xz /gcc-12.0.1-20220125.tar.xz /gcc-12.0.1-20220129.tar.xz +/gcc-12.0.1-20220202.tar.xz diff --git a/gcc.spec b/gcc.spec index c7723e4..0758dc1 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,5 +1,5 @@ -%global DATE 20220129 -%global gitrev 8b49e9256e108bb3d436946b481cfa6bb11bd1c8 +%global DATE 20220202 +%global gitrev fb6057a2be99e071993fb54a5d338ab0febba8ff %global gcc_version 12.0.1 %global gcc_major 12 # Note, gcc_release must be integer, if you want to add suffixes to @@ -120,7 +120,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: %{gcc_release}.4%{?dist} +Release: %{gcc_release}.5%{?dist} # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have # GCC Runtime Exception. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD @@ -270,10 +270,9 @@ Patch8: gcc12-no-add-needed.patch Patch9: gcc12-Wno-format-security.patch Patch10: gcc12-rh1574936.patch Patch11: gcc12-d-shared-libphobos.patch -Patch12: gcc12-pr103514-revert.patch -Patch13: gcc12-pr95424-revert.patch -Patch14: gcc12-ifcvt-revert.patch -Patch15: gcc12-pr104253.patch +Patch12: gcc12-pr104334.patch +Patch13: gcc12-ifcvt-revert.patch +Patch14: gcc12-pr104253.patch Patch100: gcc12-fortran-fdec-duplicates.patch Patch101: gcc12-fortran-flogical-as-integer.patch @@ -795,10 +794,9 @@ to NVidia PTX capable devices if available. %patch10 -p0 -b .rh1574936~ %endif %patch11 -p0 -b .d-shared-libphobos~ -%patch12 -p0 -b .pr103514-revert~ -%patch13 -p0 -b .pr95424-revert~ -%patch14 -p0 -b .ifcvt-revert~ -%patch15 -p0 -b .pr104253~ +%patch12 -p0 -b .pr104334~ +%patch13 -p0 -b .ifcvt-revert~ +%patch14 -p0 -b .pr104253~ %if 0%{?rhel} >= 9 %patch100 -p1 -b .fortran-fdec-duplicates~ @@ -3171,6 +3169,20 @@ end %endif %changelog +* Wed Feb 2 2022 Jakub Jelinek 12.0.1-0.5 +- update from trunk + - PRs analyzer/104270, c++/101874, c++/102414, c++/102434, c++/103186, + c++/104291, c++/104294, d/104287, demangler/98886, demangler/99935, + fortran/104331, libstdc++/101831, libstdc++/104301, lto/104333, + middle-end/104232, middle-end/104307, middle-end/95115, + preprocessor/104147, rtl-optimization/101260, target/94372, + target/100428, target/104189, target/104298, target/104323, + tree-optimization/95424, tree-optimization/100499, + tree-optimization/102819, tree-optimization/103169, + tree-optimization/103514, tree-optimization/104279, + tree-optimization/104280, tree-optimization/104281 +- fix a VRP bug with 1-3 bit precision types (PR tree-optimization/104334) + * Sat Jan 29 2022 Jakub Jelinek 12.0.1-0.4 - update from trunk - PRs ada/104258, analyzer/104224, analyzer/104247, bootstrap/67102, diff --git a/gcc12-pr103514-revert.patch b/gcc12-pr103514-revert.patch deleted file mode 100644 index ac95059..0000000 --- a/gcc12-pr103514-revert.patch +++ /dev/null @@ -1,27 +0,0 @@ -2022-01-28 Navid Rahimi - -gcc/ - PR tree-optimization/103514 - * match.pd (a & b) ^ (a == b) -> !(a | b): New optimization. - (a & b) == (a ^ b) -> !(a | b): New optimization. - -gcc/testsuite - * gcc.dg/tree-ssa/pr103514.c: Testcase for this optimization. - ---- gcc/match.pd -+++ gcc/match.pd -@@ -1784,14 +1784,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) - (negate (nop_convert? (bit_not @0))) - (plus (view_convert @0) { build_each_one_cst (type); })) - --/* (a & b) ^ (a == b) -> !(a | b) */ --/* (a & b) == (a ^ b) -> !(a | b) */ --(for first_op (bit_xor eq) -- second_op (eq bit_xor) -- (simplify -- (first_op:c (bit_and:c truth_valued_p@0 truth_valued_p@1) (second_op:c @0 @1)) -- (bit_not (bit_ior @0 @1)))) -- - /* Convert ~ (A - 1) or ~ (A + -1) to -A. */ - (simplify - (bit_not (convert? (minus @0 integer_each_onep))) diff --git a/gcc12-pr104334.patch b/gcc12-pr104334.patch new file mode 100644 index 0000000..9b61272 --- /dev/null +++ b/gcc12-pr104334.patch @@ -0,0 +1,104 @@ +2022-02-02 Jakub Jelinek + + PR tree-optimization/104334 + * range-op.cc (range_operator::wi_fold_in_parts): Change lh_range + and rh_range type to widest_int and subtract in widest_int. Remove + ov_rh, ov_lh and sign vars, always perform comparisons as signed + and use >, < and == operators for it. + + * g++.dg/opt/pr104334.C: New test. + +--- gcc/range-op.cc.jj 2022-01-13 22:29:15.345831749 +0100 ++++ gcc/range-op.cc 2022-02-02 16:10:07.422148772 +0100 +@@ -144,22 +144,21 @@ range_operator::wi_fold_in_parts (irange + const wide_int &rh_lb, + const wide_int &rh_ub) const + { +- wi::overflow_type ov_rh, ov_lh; + int_range_max tmp; +- wide_int rh_range = wi::sub (rh_ub, rh_lb, TYPE_SIGN (type), &ov_rh); +- wide_int lh_range = wi::sub (lh_ub, lh_lb, TYPE_SIGN (type), &ov_lh); +- signop sign = TYPE_SIGN (type);; ++ widest_int rh_range = wi::sub (widest_int::from (rh_ub, TYPE_SIGN (type)), ++ widest_int::from (rh_lb, TYPE_SIGN (type))); ++ widest_int lh_range = wi::sub (widest_int::from (lh_ub, TYPE_SIGN (type)), ++ widest_int::from (lh_lb, TYPE_SIGN (type))); + // If there are 2, 3, or 4 values in the RH range, do them separately. + // Call wi_fold_in_parts to check the RH side. +- if (wi::gt_p (rh_range, 0, sign) && wi::lt_p (rh_range, 4, sign) +- && ov_rh == wi::OVF_NONE) ++ if (rh_range > 0 && rh_range < 4) + { + wi_fold_in_parts (r, type, lh_lb, lh_ub, rh_lb, rh_lb); +- if (wi::gt_p (rh_range, 1, sign)) ++ if (rh_range > 1) + { + wi_fold_in_parts (tmp, type, lh_lb, lh_ub, rh_lb + 1, rh_lb + 1); + r.union_ (tmp); +- if (wi::eq_p (rh_range, 3)) ++ if (rh_range == 3) + { + wi_fold_in_parts (tmp, type, lh_lb, lh_ub, rh_lb + 2, rh_lb + 2); + r.union_ (tmp); +@@ -170,15 +169,14 @@ range_operator::wi_fold_in_parts (irange + } + // Otherise check for 2, 3, or 4 values in the LH range and split them up. + // The RH side has been checked, so no recursion needed. +- else if (wi::gt_p (lh_range, 0, sign) && wi::lt_p (lh_range, 4, sign) +- && ov_lh == wi::OVF_NONE) ++ else if (lh_range > 0 && lh_range < 4) + { + wi_fold (r, type, lh_lb, lh_lb, rh_lb, rh_ub); +- if (wi::gt_p (lh_range, 1, sign)) ++ if (lh_range > 1) + { + wi_fold (tmp, type, lh_lb + 1, lh_lb + 1, rh_lb, rh_ub); + r.union_ (tmp); +- if (wi::eq_p (lh_range, 3)) ++ if (lh_range == 3) + { + wi_fold (tmp, type, lh_lb + 2, lh_lb + 2, rh_lb, rh_ub); + r.union_ (tmp); +--- gcc/testsuite/g++.dg/opt/pr104334.C.jj 2022-02-02 14:35:51.184657968 +0100 ++++ gcc/testsuite/g++.dg/opt/pr104334.C 2022-02-02 14:37:14.888478594 +0100 +@@ -0,0 +1,40 @@ ++// PR tree-optimization/104334 ++// { dg-do run { target c++11 } } ++// { dg-options "-O2 --param logical-op-non-short-circuit=0" } ++ ++enum class A { A0, A1, A2, A3 }; ++int x; ++ ++__attribute__((noipa)) void ++baz () ++{ ++ x = 1; ++} ++ ++struct B { ++ unsigned b : 2; ++ ++ A ++ foo () const ++ { ++ return static_cast (b); ++ } ++ ++ __attribute__((noinline)) void ++ bar () ++ { ++ if (foo () == A::A2 || foo () == A::A3) ++ baz (); ++ } ++}; ++ ++int ++main () ++{ ++ B c; ++ c.b = 2; ++ c.bar (); ++ if (x != 1) ++ __builtin_abort (); ++ return 0; ++} diff --git a/gcc12-pr95424-revert.patch b/gcc12-pr95424-revert.patch deleted file mode 100644 index 6d36f8b..0000000 --- a/gcc12-pr95424-revert.patch +++ /dev/null @@ -1,27 +0,0 @@ -2022-01-28 Zhao Wei Liew - - PR tree-optimization/95424 - * match.pd: Simplify 1 / X where X is an integer. - ---- gcc/match.pd -+++ gcc/match.pd -@@ -435,19 +435,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) - && TYPE_UNSIGNED (type)) - (trunc_divmod @0 @1)))) - -- /* 1 / X -> X == 1 for unsigned integer X. -- 1 / X -> X >= -1 && X <= 1 ? X : 0 for signed integer X. -- But not for 1 / 0 so that we can get proper warnings and errors, -- and not for 1-bit integers as they are edge cases better handled elsewhere. */ --(simplify -- (trunc_div integer_onep@0 @1) -- (if (INTEGRAL_TYPE_P (type) && !integer_zerop (@1) && TYPE_PRECISION (type) > 1) -- (if (TYPE_UNSIGNED (type)) -- (eq @1 { build_one_cst (type); }) -- (with { tree utype = unsigned_type_for (type); } -- (cond (le (plus (convert:utype @1) { build_one_cst (utype); }) { build_int_cst (utype, 2); }) -- @1 { build_zero_cst (type); }))))) -- - /* Combine two successive divisions. Note that combining ceil_div - and floor_div is trickier and combining round_div even more so. */ - (for div (trunc_div exact_div) diff --git a/sources b/sources index 0938001..542d582 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (gcc-12.0.1-20220129.tar.xz) = 119e7c7a4cf54c17e5b9195c4933c738c9689bf1af33b13a97a277077f78910cd4e1b76fa1ef83572d9bbb964e4c352f79de53f636a4c6505c946f3cfb0fc1f7 +SHA512 (gcc-12.0.1-20220202.tar.xz) = cc0a217d96107064adb121075303b359b16b40d32744eff8fa671255d5b9f34245385b10158a6d4558a1d2fbb2627525c1d50ec6e295541bb2334625b4ae9d30 SHA512 (isl-0.18.tar.bz2) = 85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94 SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7