diff mbox series

gcc: trans-mem.c (gate_tm_init): Return false if cfun->cfg is NULL

Message ID CAA42iKzhmc63OjB3fTvF5+pd1mrzeZg09RMxocSPhg9Bpk26ow@mail.gmail.com
State New
Headers show
Series gcc: trans-mem.c (gate_tm_init): Return false if cfun->cfg is NULL | expand

Commit Message

Seija K. June 14, 2021, 2:16 p.m. UTC
This is a patch to fix BUG 87162 by returning false if cfg is null.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87162

Comments

Richard Biener June 15, 2021, 6:09 a.m. UTC | #1
On Mon, Jun 14, 2021 at 4:17 PM Seija K. via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This is a patch to fix BUG 87162 by returning false if cfg is null.

I suppose OK since TM isn't really maintained - but the actual bug is that
this pass does work in its gate function rather than in ::execute ()

Richard.

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87162
>
> diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
> index 1d4eb80620295..326e1c412465b 100644
> --- a/gcc/trans-mem.c
> +++ b/gcc/trans-mem.c
> @@ -2099,6 +2099,9 @@ gate_tm_init (void)
>    if (!flag_tm)
>      return false;
>
> +  if (!cfun->cfg)
> +    return false;
> +
>    calculate_dominance_info (CDI_DOMINATORS);
>    bitmap_obstack_initialize (&tm_obstack);
diff mbox series

Patch

diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 1d4eb80620295..326e1c412465b 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2099,6 +2099,9 @@  gate_tm_init (void)
   if (!flag_tm)
     return false;

+  if (!cfun->cfg)
+    return false;
+
   calculate_dominance_info (CDI_DOMINATORS);
   bitmap_obstack_initialize (&tm_obstack);