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
This commit is contained in:
Kevin Buettner 2024-01-29 15:55:13 -07:00
parent ce2a1b8ca4
commit 0ef7ce6648
5 changed files with 66 additions and 1 deletions

View File

@ -198,3 +198,7 @@ Patch046: gdb-ftbs-swapped-calloc-args.patch
# Backport gdb: fix "list ." related crash # Backport gdb: fix "list ." related crash
Patch047: gdb-rhbz2259850-list-period-crash-fix.patch 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

View File

@ -45,3 +45,4 @@
%patch -p1 -P045 %patch -p1 -P045
%patch -p1 -P046 %patch -p1 -P046
%patch -p1 -P047 %patch -p1 -P047
%patch -p1 -P048

View File

@ -45,3 +45,4 @@ gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
gdb-rhbz2257562-cp-namespace-null-ptr-check.patch gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
gdb-ftbs-swapped-calloc-args.patch gdb-ftbs-swapped-calloc-args.patch
gdb-rhbz2259850-list-period-crash-fix.patch gdb-rhbz2259850-list-period-crash-fix.patch
gdb-rhbz2261580-intrusive_list-assertion-fix.patch

View File

@ -0,0 +1,55 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
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<thread_info>
+class thread_info : public intrusive_list_node<thread_info>,
+ 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 <tom@tromey.com>
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<private_thread_info>;
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<thread_info>
+class thread_info : public intrusive_list_node<thread_info>,
+ public refcounted_object
{
public:
explicit thread_info (inferior *inf, ptid_t ptid);

View File

@ -57,7 +57,7 @@ Version: 14.1
# The release always contains a leading reserved number, start it at 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. # `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 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. # Do not provide URL for snapshots as the file lasts there only for 2 days.
@ -1250,6 +1250,10 @@ fi
%endif %endif
%changelog %changelog
* Mon Jan 29 2024 Kevin Buettner <kevinb@redhat.com> - 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 <blarsen@redhat.com> * Thu Jan 25 2024 Guinevere Larsen <blarsen@redhat.com>
- Remove gdb-6.5-BEA-testsuite.patch, as it was upstreamed and - Remove gdb-6.5-BEA-testsuite.patch, as it was upstreamed and
will make its way back with the next rebase. will make its way back with the next rebase.