From 3622b4fe728f4e539422a7bdb839ed43ed7f0eb2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 21 Jul 2021 10:22:28 +0000 Subject: [PATCH] import gcc-8.5.0-3.el8 --- SOURCES/gcc8-rh1981822.patch | 75 ++++++++++++++++++++++++++++++++++++ SPECS/gcc.spec | 11 +++++- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 SOURCES/gcc8-rh1981822.patch diff --git a/SOURCES/gcc8-rh1981822.patch b/SOURCES/gcc8-rh1981822.patch new file mode 100644 index 0000000..af47325 --- /dev/null +++ b/SOURCES/gcc8-rh1981822.patch @@ -0,0 +1,75 @@ +From 55f40d968b0bd3be4478a9481e829a99ee0fa04f Mon Sep 17 00:00:00 2001 +From: Jason Merrill +Date: Mon, 5 Apr 2021 22:50:44 -0400 +Subject: [PATCH] c++: mangling of lambdas in default args [PR91241] + +In this testcase, the parms remembered in LAMBDA_EXPR_EXTRA_SCOPE are no +longer the parms of the FUNCTION_DECL they have as their DECL_CONTEXT, so we +were mangling both lambdas as parm #0. But since the parms are numbered +from right to left we don't need to need to find them in the FUNCTION_DECL, +we can measure their own DECL_CHAIN. + +gcc/cp/ChangeLog: + + PR c++/91241 + * mangle.c (write_compact_number): Add sanity check. + (write_local_name): Use list_length for parm number. + +gcc/testsuite/ChangeLog: + + PR c++/91241 + * g++.dg/abi/lambda-defarg1.C: New test. +--- + gcc/cp/mangle.c | 11 ++--------- + gcc/testsuite/g++.dg/abi/lambda-defarg1.C | 11 +++++++++++ + 2 files changed, 13 insertions(+), 9 deletions(-) + create mode 100644 gcc/testsuite/g++.dg/abi/lambda-defarg1.C + +diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c +index 6c111342b97..4399165ee23 100644 +--- gcc/cp/mangle.c ++++ gcc/cp/mangle.c +@@ -1628,6 +1628,7 @@ write_literal_operator_name (tree identifier) + static void + write_compact_number (int num) + { ++ gcc_checking_assert (num >= 0); + if (num > 0) + write_unsigned_number (num - 1); + write_char ('_'); +@@ -2027,15 +2028,7 @@ write_local_name (tree function, const tree local_entity, + /* For this purpose, parameters are numbered from right-to-left. */ + if (parm) + { +- tree t; +- int i = 0; +- for (t = DECL_ARGUMENTS (function); t; t = DECL_CHAIN (t)) +- { +- if (t == parm) +- i = 1; +- else if (i) +- ++i; +- } ++ int i = list_length (parm); + write_char ('d'); + write_compact_number (i - 1); + } +diff --git a/gcc/testsuite/g++.dg/abi/lambda-defarg1.C b/gcc/testsuite/g++.dg/abi/lambda-defarg1.C +new file mode 100644 +index 00000000000..8c538581240 +--- /dev/null ++++ gcc/testsuite/g++.dg/abi/lambda-defarg1.C +@@ -0,0 +1,11 @@ ++// PR c++/91241 ++// { dg-do compile { target c++11 } } ++ ++struct A { ++ int *b(const int & = []() -> int { return 0; }(), ++ const int & = []() -> int { return 0; }()); ++}; ++int *A::b(const int &, const int &) { b(); return 0; } ++// { dg-final { scan-assembler "_ZN1A1bERKiS1_" } } ++// { dg-final { scan-assembler "_ZZN1A1bERKiS1_Ed_NKUlvE_clEv" } } ++// { dg-final { scan-assembler "_ZZN1A1bERKiS1_Ed0_NKUlvE_clEv" } } +-- +2.27.0 diff --git a/SPECS/gcc.spec b/SPECS/gcc.spec index c56c835..d2627b3 100644 --- a/SPECS/gcc.spec +++ b/SPECS/gcc.spec @@ -4,7 +4,7 @@ %global gcc_major 8 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 2 +%global gcc_release 3 %global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f %global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24 %global _unpackaged_files_terminate_build 0 @@ -252,7 +252,10 @@ Obsoletes: libcilkrts-static Requires(post): /sbin/install-info Requires(preun): /sbin/install-info AutoReq: true +# Various libraries are imported. #1859893 asks us to list them all. Provides: bundled(libiberty) +Provides: bundled(libbacktrace) +Provides: bundled(libffi) Provides: gcc(major) = %{gcc_major} Patch0: gcc8-hack.patch @@ -275,6 +278,7 @@ Patch17: gcc8-libgomp-testsuite.patch Patch18: gcc8-remove-old-demangle.patch Patch19: gcc8-rh1960701.patch Patch20: gcc8-pr100797.patch +Patch21: gcc8-rh1981822.patch Patch30: gcc8-rh1668903-1.patch Patch31: gcc8-rh1668903-2.patch @@ -854,6 +858,7 @@ to NVidia PTX capable devices if available. %patch18 -p0 -b .demangle~ %patch19 -p0 -b .rh1960701~ %patch20 -p0 -b .pr100797~ +%patch21 -p0 -b .rh1981822~ %patch30 -p0 -b .rh1668903-1~ %patch31 -p0 -b .rh1668903-2~ @@ -3170,6 +3175,10 @@ fi %endif %changelog +* Tue Jul 13 2021 Marek Polacek 8.5.0-3 +- fix mangling of lambdas in default args (PR c++/91241, #1981822) +- add a few Provides: bundled + * Tue Jun 1 2021 Marek Polacek 8.5.0-2 - revert upstream PR85873 gcc-8 fix, apply the fix from gcc-9 (#1960701) - fix 'this' adjustment for devirtualized call (PR c++/100797, #1965951)