Accepting request 958414 from devel:gcc

- Patch added (backport from master):
  * fix-build-with-current-gcc-el_explicit-location-always-non-null.patch

OBS-URL: https://build.opensuse.org/request/show/958414
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=161
This commit is contained in:
Dominique Leuenberger 2022-03-03 23:16:59 +00:00 committed by Git OBS Bridge
commit 47471e4655
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,49 @@
Fix build with current GCC: EL_EXPLICIT(location) always non-NULL
Compiling GDB with current GCC (1b4a63593b) runs into this:
src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
src/gdb/location.c:963:38: error: the address of 'event_location::<unnamed union>::explicit_loc' will never be NULL [-Werror=address]
963 | return (EL_EXPLICIT (location) == NULL
| ^
src/gdb/location.c:57:30: note: 'event_location::<unnamed union>::explicit_loc' declared here
57 | struct explicit_location explicit_loc;
| ^~~~~~~~~~~~
GCC is right, EL_EXPLICIT is defined as returning the address of an
union field:
/* An explicit location. */
struct explicit_location explicit_loc;
#define EL_EXPLICIT(P) (&((P)->u.explicit_loc))
and thus must always be non-NULL.
Change-Id: Ie74fee7834495a93affcefce03c06e4d83ad8191
---
gdb/location.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/gdb/location.c b/gdb/location.c
index 827294e106a..1ee20069313 100644
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -960,12 +960,11 @@ event_location_empty_p (const struct event_location *location)
return 0;
case EXPLICIT_LOCATION:
- return (EL_EXPLICIT (location) == NULL
- || (EL_EXPLICIT (location)->source_filename == NULL
- && EL_EXPLICIT (location)->function_name == NULL
- && EL_EXPLICIT (location)->label_name == NULL
- && (EL_EXPLICIT (location)->line_offset.sign
- == LINE_OFFSET_UNKNOWN)));
+ return (EL_EXPLICIT (location)->source_filename == NULL
+ && EL_EXPLICIT (location)->function_name == NULL
+ && EL_EXPLICIT (location)->label_name == NULL
+ && (EL_EXPLICIT (location)->line_offset.sign
+ == LINE_OFFSET_UNKNOWN));
case PROBE_LOCATION:
return EL_PROBE (location) == NULL;

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Feb 25 14:53:56 UTC 2022 - Tom de Vries <tdevries@suse.com>
- Patch added (backport from master):
* fix-build-with-current-gcc-el_explicit-location-always-non-null.patch
-------------------------------------------------------------------
Fri Feb 11 15:15:58 UTC 2022 - Tom de Vries <tdevries@suse.com>

View File

@ -348,6 +348,7 @@ Patch2034: gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.e
Patch2035: gdb-r_version-check.patch
Patch2036: ibm-z-add-another-arch14-instruction.patch
Patch2037: ibm-z-remove-lpswey-parameter.patch
Patch2038: fix-build-with-current-gcc-el_explicit-location-always-non-null.patch
# Backports from master, not yet available in next release.
@ -805,6 +806,7 @@ find -name "*.info*"|xargs rm -f
%patch2035 -p1
%patch2036 -p1
%patch2037 -p1
%patch2038 -p1
%patch2100 -p1
%patch2101 -p1