From 0ef7ce6648d9982681b50f3eb9d057fa3c616231 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Mon, 29 Jan 2024 15:55:13 -0700 Subject: [PATCH] Backport upstream workaround for GCC 14 problem The GCC problem is responsible for GDB internal errors. See: https://sourceware.org/bugzilla/show_bug.cgi?id=31281 --- _gdb.spec.Patch.include | 4 ++ _gdb.spec.patch.include | 1 + _patch_order | 1 + ...2261580-intrusive_list-assertion-fix.patch | 55 +++++++++++++++++++ gdb.spec | 6 +- 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 gdb-rhbz2261580-intrusive_list-assertion-fix.patch diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index cb9e9d8..e4aaebc 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -198,3 +198,7 @@ Patch046: gdb-ftbs-swapped-calloc-args.patch # Backport gdb: fix "list ." related crash Patch047: gdb-rhbz2259850-list-period-crash-fix.patch +# Backport upstream workaround for GCC 14 problem which cause assertion +# failures in GDB. +Patch048: gdb-rhbz2261580-intrusive_list-assertion-fix.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 8258dc9..ef55dd0 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -45,3 +45,4 @@ %patch -p1 -P045 %patch -p1 -P046 %patch -p1 -P047 +%patch -p1 -P048 diff --git a/_patch_order b/_patch_order index 6b7e952..aadb6e3 100644 --- a/_patch_order +++ b/_patch_order @@ -45,3 +45,4 @@ gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch gdb-rhbz2257562-cp-namespace-null-ptr-check.patch gdb-ftbs-swapped-calloc-args.patch gdb-rhbz2259850-list-period-crash-fix.patch +gdb-rhbz2261580-intrusive_list-assertion-fix.patch diff --git a/gdb-rhbz2261580-intrusive_list-assertion-fix.patch b/gdb-rhbz2261580-intrusive_list-assertion-fix.patch new file mode 100644 index 0000000..adb8eb7 --- /dev/null +++ b/gdb-rhbz2261580-intrusive_list-assertion-fix.patch @@ -0,0 +1,55 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 29 Jan 2024 14:51:22 -0700 +Subject: gdb-rhbz2261580-intrusive_list-assertion-fix.patch + +;; Backport upstream workaround for GCC 14 problem which cause assertion +;; failures in GDB. + +[gdb/build] Workaround gcc PR113599 + +Since gcc commit d3f48f68227 ("c++: non-dependent .* operand folding +[PR112427]"), with gdb we run into PR gcc/113599 [1], a wrong-code bug, as +reported in PR build/31281. + +Work around this by flipping inherit order: +... +-class thread_info : public refcounted_object, +- public intrusive_list_node ++class thread_info : public intrusive_list_node, ++ public refcounted_object +... + +An argument could be made that this isn't necessary, because this occurred in +an unreleased gcc version. + +However, I think it could be useful when bisecting gcc for other problems in +building gdb. Having this workaround means the bisect won't reintroduce the +problem. Furthermore, the workaround is harmless. + +Tested on Fedora rawhide x86_64. + +Approved-By: Tom Tromey + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31281 + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113599 + +diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h +--- a/gdb/gdbthread.h ++++ b/gdb/gdbthread.h +@@ -242,10 +242,11 @@ using private_thread_info_up = std::unique_ptr; + strong reference, and is thus not accounted for in the thread's + refcount. + +- The intrusive_list_node base links threads in a per-inferior list. */ ++ The intrusive_list_node base links threads in a per-inferior list. ++ We place it first in the inherit order to work around PR gcc/113599. */ + +-class thread_info : public refcounted_object, +- public intrusive_list_node ++class thread_info : public intrusive_list_node, ++ public refcounted_object + { + public: + explicit thread_info (inferior *inf, ptid_t ptid); diff --git a/gdb.spec b/gdb.spec index 91b627b..61aa74a 100644 --- a/gdb.spec +++ b/gdb.spec @@ -57,7 +57,7 @@ Version: 14.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 7%{?dist} +Release: 8%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause AND FSFAP AND LGPL-2.1-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain AND GFDL-1.3-or-later AND LGPL-2.0-or-later WITH GCC-exception-2.0 AND GPL-3.0-or-later WITH GCC-exception-3.1 AND GPL-2.0-or-later WITH GNU-compiler-exception # Do not provide URL for snapshots as the file lasts there only for 2 days. @@ -1250,6 +1250,10 @@ fi %endif %changelog +* Mon Jan 29 2024 Kevin Buettner - 14.1-8 +- Backport upstream workaround for GCC 14 problem which is causing + GDB internal errors (RHBZ 261580, Tom de Vries). + * Thu Jan 25 2024 Guinevere Larsen - Remove gdb-6.5-BEA-testsuite.patch, as it was upstreamed and will make its way back with the next rebase.