diff options
Diffstat (limited to 'source/d/gcc')
4 files changed, 299 insertions, 2 deletions
diff --git a/source/d/gcc/gcc.SlackBuild b/source/d/gcc/gcc.SlackBuild index a3ca1c9b..5830d762 100755 --- a/source/d/gcc/gcc.SlackBuild +++ b/source/d/gcc/gcc.SlackBuild @@ -2,7 +2,7 @@ # GCC package build script (written by volkerdi@slackware.com) # # Copyright 2003, 2004 Slackware Linux, Inc., Concord, California, USA -# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -57,7 +57,7 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=gcc SRCVER=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} VERSION=$(echo $SRCVER | cut -f 1 -d _) -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} # How many jobs to run in parallel: NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} @@ -171,6 +171,11 @@ zcat $CWD/patches/gcc-no_fixincludes.diff.gz | patch -p1 --verbose --backup --su # Fix a gfortran bug: zcat $CWD/patches/gfortran.deferred-shape-vs-assumed-shape.patch.gz | patch -p0 --verbose --backup --suffix=.orig || exit 1 +# Fix regressions in 10.3.0: +zcat $CWD/patches/PR100101.2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f.patch.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 +zcat $CWD/patches/PR100102-2.a1b3484a8e6c53c8084723e3f1738d402374198e.patch.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 +zcat $CWD/patches/PR100102.5357ab75dedef403b0eebf9277d61d1cbeb5898f.patch.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 + # Fix perms/owners: chown -R root:root . find . \ diff --git a/source/d/gcc/patches/PR100101.2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f.patch b/source/d/gcc/patches/PR100101.2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f.patch new file mode 100644 index 00000000..51ee459f --- /dev/null +++ b/source/d/gcc/patches/PR100101.2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f.patch @@ -0,0 +1,100 @@ +From 2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f Mon Sep 17 00:00:00 2001 +From: Jason Merrill <jason@redhat.com> +Date: Thu, 15 Apr 2021 13:38:54 -0400 +Subject: [PATCH] c++: noexcept error recursion [PR100101] + +Here instantiating the noexcept-specifier for bar<void>() means +instantiating A<void>::value, which complains about the conversion from 0 to +int* in the default argument of foo. Since my patch for PR99583, printing +the error context involves looking at C<void>::type, which again wants to +instantiate A<void>::value, which breaks. For now at least, let's break +this recursion by avoiding looking into the noexcept-specifier in +find_typenames, and limit that to just the uses_parameter_packs case that +PR99583 cares about. + +gcc/cp/ChangeLog: + + PR c++/100101 + PR c++/99583 + * pt.c (find_parameter_packs_r) [FUNCTION_TYPE]: Walk into + TYPE_RAISES_EXCEPTIONS here. + +gcc/testsuite/ChangeLog: + + PR c++/100101 + * g++.dg/cpp0x/noexcept67.C: New test. +--- + gcc/cp/pt.c | 11 +++++++++++ + gcc/testsuite/g++.dg/cpp0x/noexcept67.C | 26 +++++++++++++++++++++++++ + 3 files changed, 37 insertions(+), 5 deletions(-) + create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept67.C + +diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c +index 0f119a55272..2190f83882a 100644 +--- a/gcc/cp/pt.c ++++ b/gcc/cp/pt.c +@@ -3890,6 +3890,10 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) + (struct find_parameter_pack_data*)data; + bool parameter_pack_p = false; + ++#define WALK_SUBTREE(NODE) \ ++ cp_walk_tree (&(NODE), &find_parameter_packs_r, \ ++ ppd, ppd->visited) \ ++ + /* Don't look through typedefs; we are interested in whether a + parameter pack is actually written in the expression/type we're + looking at, not the target type. */ +@@ -4070,10 +4074,17 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) + ppd, ppd->visited); + return NULL_TREE; + ++ case FUNCTION_TYPE: ++ case METHOD_TYPE: ++ WALK_SUBTREE (TYPE_RAISES_EXCEPTIONS (t)); ++ break; ++ + default: + return NULL_TREE; + } + ++#undef WALK_SUBTREE ++ + return NULL_TREE; + } + +diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept67.C b/gcc/testsuite/g++.dg/cpp0x/noexcept67.C +new file mode 100644 +index 00000000000..7f061034323 +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/noexcept67.C +@@ -0,0 +1,26 @@ ++// PR c++/100101 ++// { dg-do compile { target c++11 } } ++ ++template <typename T> struct A ++{ ++ template <typename U> static char foo(U*, int* = 0); ++ static const bool value = sizeof(foo(static_cast<T*>(nullptr))) > 0; ++}; ++ ++template <bool b> struct B ++{ ++ static const bool value = b; ++}; ++ ++template <typename T> struct C ++{ ++ typedef B<A<T>::value> type; ++}; ++ ++template <typename T> ++void bar() noexcept(A<T>::value && C<T>::type::value) {} ++ ++void baz() ++{ ++ bar<void>(); ++} +-- +2.27.0 + + diff --git a/source/d/gcc/patches/PR100102-2.a1b3484a8e6c53c8084723e3f1738d402374198e.patch b/source/d/gcc/patches/PR100102-2.a1b3484a8e6c53c8084723e3f1738d402374198e.patch new file mode 100644 index 00000000..56394fc3 --- /dev/null +++ b/source/d/gcc/patches/PR100102-2.a1b3484a8e6c53c8084723e3f1738d402374198e.patch @@ -0,0 +1,59 @@ +From a1b3484a8e6c53c8084723e3f1738d402374198e Mon Sep 17 00:00:00 2001 +From: Jason Merrill <jason@redhat.com> +Date: Mon, 31 May 2021 12:56:34 -0400 +Subject: [PATCH] c++: alias member template [PR100102] + +Patrick already fixed the primary cause of this bug. But while I was +looking at this testcase I noticed that with the qualified name k::o we +ended up with a plain FUNCTION_DECL, whereas without the k:: we got a +BASELINK. There seems to be no good reason not to return the BASELINK +in this case as well. + + PR c++/100102 + +gcc/cp/ChangeLog: + + * init.c (build_offset_ref): Return the BASELINK for a static + member function. + +gcc/testsuite/ChangeLog: + + * g++.dg/cpp0x/alias-decl-73.C: New test. +--- + gcc/cp/init.c | 2 +- + gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C | 9 +++++++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C + +diff --git a/gcc/cp/init.c b/gcc/cp/init.c +index b1123287300..1b161d526f6 100644 +--- a/gcc/cp/init.c ++++ b/gcc/cp/init.c +@@ -2214,7 +2214,7 @@ build_offset_ref (tree type, tree member, bool address_p, + if (!ok) + return error_mark_node; + if (DECL_STATIC_FUNCTION_P (t)) +- return t; ++ return member; + member = t; + } + else +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C +new file mode 100644 +index 00000000000..aae778646dc +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template <bool B1> using a = int; ++template <class T3, class T4> struct k { ++ static long o(); ++ template <class T5> using n = a<bool(k::o)>; ++ n<int> q; ++}; +-- +2.27.0 + + diff --git a/source/d/gcc/patches/PR100102.5357ab75dedef403b0eebf9277d61d1cbeb5898f.patch b/source/d/gcc/patches/PR100102.5357ab75dedef403b0eebf9277d61d1cbeb5898f.patch new file mode 100644 index 00000000..57432468 --- /dev/null +++ b/source/d/gcc/patches/PR100102.5357ab75dedef403b0eebf9277d61d1cbeb5898f.patch @@ -0,0 +1,133 @@ +From 5357ab75dedef403b0eebf9277d61d1cbeb5898f Mon Sep 17 00:00:00 2001 +From: Patrick Palka <ppalka@redhat.com> +Date: Fri, 4 Jun 2021 13:46:53 -0400 +Subject: [PATCH 1/1] c++: tsubst_function_decl and excess arg levels + [PR100102] + +Here, when instantiating the dependent alias template +duration::__is_harmonic with args={{T,U},{int}}, we find ourselves +substituting the function decl _S_gcd. Since we have more arg levels +than _S_gcd has parm levels, an old special case in tsubst_function_decl +causes us to unwantedly reduce args to its innermost level, yielding +args={int}, which leads to a nonsensical substitution into the decl +context and eventually a crash. + +The comment for this special case refers to three examples for which we +ought to see more arg levels than parm levels here, but none of the +examples actually demonstrate this. In the first example, when +defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and +later when instantiating say S<int>::f<char> both depths are 2. In the +second example, when substituting the template friend declaration +parms_depth is 2 and args_depth is 1, and later when instantiating f +both depths are 1. Finally, the third example is invalid since we can't +specialize a member template of an unspecialized class template like +that. + +Given that this reduction code seems no longer relevant for its +documented purpose and that it causes problems as in the PR, this patch +just removes it. Note that as far as bootstrap/regtest is concerned, +this code is dead; the below two tests would be the first to reach it. + + PR c++/100102 + +gcc/cp/ChangeLog: + + * pt.c (tsubst_function_decl): Remove old code for reducing + args when it has excess levels. + +gcc/testsuite/ChangeLog: + + * g++.dg/cpp0x/alias-decl-72.C: New test. + * g++.dg/cpp0x/alias-decl-72a.C: New test. +--- + gcc/cp/pt.c | 39 --------------------- + gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C | 9 +++++ + gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C | 9 +++++ + 3 files changed, 18 insertions(+), 39 deletions(-) + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C + +diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c +index 7211bdc5bbc..744461ed8cb 100644 +--- a/gcc/cp/pt.c ++++ b/gcc/cp/pt.c +@@ -13905,45 +13905,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, + if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash)) + return spec; + } +- +- /* We can see more levels of arguments than parameters if +- there was a specialization of a member template, like +- this: +- +- template <class T> struct S { template <class U> void f(); } +- template <> template <class U> void S<int>::f(U); +- +- Here, we'll be substituting into the specialization, +- because that's where we can find the code we actually +- want to generate, but we'll have enough arguments for +- the most general template. +- +- We also deal with the peculiar case: +- +- template <class T> struct S { +- template <class U> friend void f(); +- }; +- template <class U> void f() {} +- template S<int>; +- template void f<double>(); +- +- Here, the ARGS for the instantiation of will be {int, +- double}. But, we only need as many ARGS as there are +- levels of template parameters in CODE_PATTERN. We are +- careful not to get fooled into reducing the ARGS in +- situations like: +- +- template <class T> struct S { template <class U> void f(U); } +- template <class T> template <> void S<T>::f(int) {} +- +- which we can spot because the pattern will be a +- specialization in this case. */ +- int args_depth = TMPL_ARGS_DEPTH (args); +- int parms_depth = +- TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t))); +- +- if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t)) +- args = get_innermost_template_args (args, parms_depth); + } + else + { +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +new file mode 100644 +index 00000000000..8009756dcba +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template<int()> struct ratio; ++template<class T, class U> struct duration { ++ static constexpr int _S_gcd(); ++ template<class> using __is_harmonic = ratio<_S_gcd>; ++ using type = __is_harmonic<int>; ++}; +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +new file mode 100644 +index 00000000000..a4443e18f9d +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template<int> struct ratio; ++template<class T> struct duration { ++ static constexpr int _S_gcd(); ++ template<class> using __is_harmonic = ratio<(duration::_S_gcd)()>; ++ using type = __is_harmonic<int>; ++}; +-- +2.27.0 + + |