* [PATCH] gdb/location.c: fix build on gcc-12 (NULL comparison)
@ 2021-11-14 17:31 Sergei Trofimovich
2021-11-15 0:19 ` Simon Marchi
0 siblings, 1 reply; 2+ messages in thread
From: Sergei Trofimovich @ 2021-11-14 17:31 UTC (permalink / raw)
To: binutils; +Cc: gdb-patches, Sergei Trofimovich
From: Sergei Trofimovich <siarheit@google.com>
On gcc-12 build fails as:
gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
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
| ^
EL_EXPLICIT returns address to struct field within 'location'.
It can never be NULL.
---
gdb/location.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/gdb/location.c b/gdb/location.c
index 827294e106a..cda54e14df5 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;
--
2.33.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb/location.c: fix build on gcc-12 (NULL comparison)
2021-11-14 17:31 [PATCH] gdb/location.c: fix build on gcc-12 (NULL comparison) Sergei Trofimovich
@ 2021-11-15 0:19 ` Simon Marchi
0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2021-11-15 0:19 UTC (permalink / raw)
To: Sergei Trofimovich, binutils; +Cc: Sergei Trofimovich, gdb-patches
The same patch was sent here already, but not merged yet:
https://sourceware.org/pipermail/gdb-patches/2021-November/183279.html
I'll go ahead and merge Pedro's patch, but thanks for sending yours anyway.
Simon
On 2021-11-14 12:31, Sergei Trofimovich via Gdb-patches wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> On gcc-12 build fails as:
>
> gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
> 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
> | ^
>
> EL_EXPLICIT returns address to struct field within 'location'.
> It can never be NULL.
> ---
> gdb/location.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/location.c b/gdb/location.c
> index 827294e106a..cda54e14df5 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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-15 0:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-14 17:31 [PATCH] gdb/location.c: fix build on gcc-12 (NULL comparison) Sergei Trofimovich
2021-11-15 0:19 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).