* [PATCH][tree-ssa-loop-ch] Add missing NULL test for dump_file
@ 2020-10-07 5:53 Tom de Vries
2020-10-07 6:04 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2020-10-07 5:53 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Biener
Hi,
If we change gimple_can_duplicate_bb_p to return false instead of true, we run
into a segfault in ch_base::copy_headers due to using dump_file while it's
NULL:
...
if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs,
true))
{
fprintf (dump_file, "Duplication failed.\n");
continue;
}
...
Fix this by adding the missing dump_file != NULL test.
Tested by rebuilding lto1 and rerunning the failing test-case.
[ Not committing this as obvious because I'm not sure about the
(dump_flags & TDF_DETAILS) bit. ]
OK for trunk?
Thanks,
- Tom
[tree-ssa-loop-ch] Add missing NULL test for dump_file
gcc/ChangeLog:
2020-10-07 Tom de Vries <tdevries@suse.de>
* tree-ssa-loop-ch.c (ch_base::copy_headers): Add missing NULL test
for dump_file.
---
gcc/tree-ssa-loop-ch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index b86acf7c39d..1f3d9321a55 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -425,7 +425,8 @@ ch_base::copy_headers (function *fun)
if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs,
true))
{
- fprintf (dump_file, "Duplication failed.\n");
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Duplication failed.\n");
continue;
}
copied.safe_push (std::make_pair (entry, loop));
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][tree-ssa-loop-ch] Add missing NULL test for dump_file
2020-10-07 5:53 [PATCH][tree-ssa-loop-ch] Add missing NULL test for dump_file Tom de Vries
@ 2020-10-07 6:04 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-10-07 6:04 UTC (permalink / raw)
To: Tom de Vries; +Cc: gcc-patches
On Wed, 7 Oct 2020, Tom de Vries wrote:
> Hi,
>
> If we change gimple_can_duplicate_bb_p to return false instead of true, we run
> into a segfault in ch_base::copy_headers due to using dump_file while it's
> NULL:
> ...
> if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs,
> true))
> {
> fprintf (dump_file, "Duplication failed.\n");
> continue;
> }
> ...
>
> Fix this by adding the missing dump_file != NULL test.
>
> Tested by rebuilding lto1 and rerunning the failing test-case.
>
> [ Not committing this as obvious because I'm not sure about the
> (dump_flags & TDF_DETAILS) bit. ]
>
> OK for trunk?
OK.
Richard.
> Thanks,
> - Tom
>
> [tree-ssa-loop-ch] Add missing NULL test for dump_file
>
> gcc/ChangeLog:
>
> 2020-10-07 Tom de Vries <tdevries@suse.de>
>
> * tree-ssa-loop-ch.c (ch_base::copy_headers): Add missing NULL test
> for dump_file.
>
> ---
> gcc/tree-ssa-loop-ch.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
> index b86acf7c39d..1f3d9321a55 100644
> --- a/gcc/tree-ssa-loop-ch.c
> +++ b/gcc/tree-ssa-loop-ch.c
> @@ -425,7 +425,8 @@ ch_base::copy_headers (function *fun)
> if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs,
> true))
> {
> - fprintf (dump_file, "Duplication failed.\n");
> + if (dump_file && (dump_flags & TDF_DETAILS))
> + fprintf (dump_file, "Duplication failed.\n");
> continue;
> }
> copied.safe_push (std::make_pair (entry, loop));
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-07 6:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 5:53 [PATCH][tree-ssa-loop-ch] Add missing NULL test for dump_file Tom de Vries
2020-10-07 6:04 ` 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).