* [PATCH] gcc/file-prefix-map: Fix NULL filename handling
@ 2022-11-04 17:25 Richard Purdie
2022-11-05 11:06 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2022-11-04 17:25 UTC (permalink / raw)
To: gcc-patches
e5c15eb183f17e806ad6b58c9497321ded87866f introduced a regression as
some ada tests end up passing NULL as the filename to remap_filename().
Handle this as before to fix the tests.
gcc/ChangeLog:
* file-prefix-map.cc (remap_filename): Handle NULL filenames.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
gcc/file-prefix-map.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/file-prefix-map.cc b/gcc/file-prefix-map.cc
index 439586bd2b5..40b10edcf92 100644
--- a/gcc/file-prefix-map.cc
+++ b/gcc/file-prefix-map.cc
@@ -73,7 +73,7 @@ remap_filename (file_prefix_map *maps, const char *filename)
char *realname;
size_t name_len;
- if (lbasename (filename) == filename)
+ if (!filename || lbasename (filename) == filename)
return filename;
realname = lrealpath (filename);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gcc/file-prefix-map: Fix NULL filename handling
2022-11-04 17:25 [PATCH] gcc/file-prefix-map: Fix NULL filename handling Richard Purdie
@ 2022-11-05 11:06 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-11-05 11:06 UTC (permalink / raw)
To: Richard Purdie; +Cc: gcc-patches
On Fri, Nov 4, 2022 at 6:26 PM Richard Purdie via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> e5c15eb183f17e806ad6b58c9497321ded87866f introduced a regression as
> some ada tests end up passing NULL as the filename to remap_filename().
> Handle this as before to fix the tests.
OK.
> gcc/ChangeLog:
>
> * file-prefix-map.cc (remap_filename): Handle NULL filenames.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> gcc/file-prefix-map.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/file-prefix-map.cc b/gcc/file-prefix-map.cc
> index 439586bd2b5..40b10edcf92 100644
> --- a/gcc/file-prefix-map.cc
> +++ b/gcc/file-prefix-map.cc
> @@ -73,7 +73,7 @@ remap_filename (file_prefix_map *maps, const char *filename)
> char *realname;
> size_t name_len;
>
> - if (lbasename (filename) == filename)
> + if (!filename || lbasename (filename) == filename)
> return filename;
>
> realname = lrealpath (filename);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-05 11:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 17:25 [PATCH] gcc/file-prefix-map: Fix NULL filename handling Richard Purdie
2022-11-05 11:06 ` Richard Biener
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).