From c78434b2cd028f808db1619c47642872f36c657b Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 15 May 2023 08:43:38 +0100 Subject: [PATCH 1/2] gcc12: 12.2.0 -> 12.3.0 Added an ICE backport for `ccache` build failure. --- pkgs/development/compilers/gcc/12/default.nix | 20 +++-- .../gcc/12/lambda-ICE-PR109241.patch | 77 +++++++++++++++++++ 2 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 pkgs/development/compilers/gcc/12/lambda-ICE-PR109241.patch diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index 92bec39e7216..f0886f862c97 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -55,7 +55,7 @@ with lib; with builtins; let majorVersion = "12"; - version = "${majorVersion}.2.0"; + version = "${majorVersion}.3.0"; disableBootstrap = !stdenv.hostPlatform.isDarwin && !profiledCompiler; inherit (stdenv) buildPlatform hostPlatform targetPlatform; @@ -69,15 +69,19 @@ let majorVersion = "12"; ../gcc-12-gfortran-driving.patch ../ppc-musl.patch ../install-info-files-serially.patch + + # backport ICE fix on ccache code + ./lambda-ICE-PR109241.patch ] # We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building # a foreign one: https://github.com/iains/gcc-12-branch/issues/18 - ++ optional (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) (fetchpatch { - name = "gcc-12-darwin-aarch64-support.patch"; - url = "https://github.com/Homebrew/formula-patches/raw/1d184289/gcc/gcc-12.2.0-arm.diff"; - sha256 = "sha256-omclLslGi/2yCV4pNBMaIpPDMW3tcz/RXdupbNbeOHA="; - }) - ++ optional langD ../libphobos.patch + ++ optionals (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) [ + (fetchurl { + name = "gcc-12-darwin-aarch64-support.patch"; + url = "https://raw.githubusercontent.com/Homebrew/formula-patches/f1188b90d610e2ed170b22512ff7435ba5c891e2/gcc/gcc-12.3.0.diff"; + sha256 = "sha256-naL5ZNiurqfDBiPSU8PTbTmLqj25B+vjjiqc4fAFgYs="; + }) + ] ++ optional langD ../libphobos.patch # backport fixes to build gccgo with musl libc ++ optionals (langGo && stdenv.hostPlatform.isMusl) [ @@ -206,7 +210,7 @@ lib.pipe (stdenv.mkDerivation ({ src = fetchurl { url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz"; - sha256 = "sha256-5UnPnPNZSgDie2WJ1DItcOByDN0hPzm+tBgeBpJiMP8="; + sha256 = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs="; }; inherit patches; diff --git a/pkgs/development/compilers/gcc/12/lambda-ICE-PR109241.patch b/pkgs/development/compilers/gcc/12/lambda-ICE-PR109241.patch new file mode 100644 index 000000000000..a27a8a08d9d5 --- /dev/null +++ b/pkgs/development/compilers/gcc/12/lambda-ICE-PR109241.patch @@ -0,0 +1,77 @@ +https://gcc.gnu.org/PR109241 + +Fix ICE on ccache. + +From 396a4e76afec30d2461638f569cae18955eb4ad2 Mon Sep 17 00:00:00 2001 +From: Jason Merrill +Date: Wed, 22 Mar 2023 16:11:47 -0400 +Subject: [PATCH] c++: local class in nested generic lambda [PR109241] + +In this testcase, the tree walk to look for bare parameter packs was +confused by finding a type with no TREE_BINFO. But it should be fine that +it's unset; we already checked for unexpanded packs at parse time. + +I also tried doing the partial instantiation of the local class, which is +probably the long-term direction we want to go, but for stage 4 let's go +with this safer change. + + PR c++/109241 + +gcc/cp/ChangeLog: + + * pt.cc (find_parameter_packs_r): Handle null TREE_BINFO. + +gcc/testsuite/ChangeLog: + + * g++.dg/cpp1y/lambda-generic-local-class2.C: New test. +--- + gcc/cp/pt.cc | 12 ++++++++---- + .../g++.dg/cpp1y/lambda-generic-local-class2.C | 13 +++++++++++++ + 2 files changed, 21 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class2.C + +diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc +index c7f4a95a723..79bc9c014c8 100644 +--- a/gcc/cp/pt.cc ++++ b/gcc/cp/pt.cc +@@ -4106,10 +4106,14 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) + case TAG_DEFN: + t = TREE_TYPE (t); + if (CLASS_TYPE_P (t)) +- /* Local class, need to look through the whole definition. */ +- for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t))) +- cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r, +- ppd, ppd->visited); ++ { ++ /* Local class, need to look through the whole definition. ++ TYPE_BINFO might be unset for a partial instantiation. */ ++ if (TYPE_BINFO (t)) ++ for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t))) ++ cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r, ++ ppd, ppd->visited); ++ } + else + /* Enum, look at the values. */ + for (tree l = TYPE_VALUES (t); l; l = TREE_CHAIN (l)) +diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class2.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class2.C +new file mode 100644 +index 00000000000..83856de1f41 +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class2.C +@@ -0,0 +1,13 @@ ++// PR c++/109241 ++// { dg-do compile { target c++14 } } ++// { dg-options "" } no pedantic ++ ++void g() { ++ [](auto) { ++ [](auto) { ++ ({ ++ struct A {}; ++ }); ++ }; ++ }(1); ++} +-- +2.40.1 + From 5d119a26aaca516c276040dd2aa799e82289d5df Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 27 May 2023 12:32:13 +0100 Subject: [PATCH 2/2] mirrors/gcc: push 'bigsearch' lower For some reason 'bigsearch' only partially mirrored 'gcc-12.3.0' and still lacks the tarballs after a few weeks. Let's use next available mirror. --- pkgs/build-support/fetchurl/mirrors.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix index bd338473508a..3c8cc48ec7da 100644 --- a/pkgs/build-support/fetchurl/mirrors.nix +++ b/pkgs/build-support/fetchurl/mirrors.nix @@ -57,8 +57,8 @@ # GCC gcc = [ - "https://bigsearcher.com/mirrors/gcc/" "https://mirror.koddos.net/gcc/" + "https://bigsearcher.com/mirrors/gcc/" "ftp://ftp.nluug.nl/mirror/languages/gcc/" "ftp://ftp.fu-berlin.de/unix/languages/gcc/" "ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/"