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
Related show

Commit Message

Uros Bizjak via Gcc-patches June 14, 2021, 2:16 p.m.
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

Uros Bizjak via Gcc-patches June 15, 2021, 6:09 a.m. | #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);

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);