[(pushed)] riscv: fix error: control reaches end of non-void function

Message ID 0b97cf28-e833-bc0c-28f1-4c6e08a38df7@suse.cz
State Committed
Commit 4bd434fbfc7865961a8e10d7e9601b28765ce7be
Headers
Series [(pushed)] riscv: fix error: control reaches end of non-void function |

Commit Message

Martin Liška May 3, 2023, 2:37 p.m. UTC
  It's pre-approved by Jakub.

Cheers,
Martin

Fixes:
gcc/config/riscv/sync.md:66:1: error: control reaches end of non-void function [-Werror=return-type]
66 |   [(set (attr "length") (const_int 4))])
   | ^

	PR target/109713

gcc/ChangeLog:

	* config/riscv/sync.md: Add gcc_unreachable to a switch.
---
 gcc/config/riscv/sync.md | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Palmer Dabbelt May 3, 2023, 2:54 p.m. UTC | #1
On Wed, 03 May 2023 07:37:07 PDT (-0700), mliska@suse.cz wrote:
> It's pre-approved by Jakub.
>
> Cheers,
> Martin
>
> Fixes:
> gcc/config/riscv/sync.md:66:1: error: control reaches end of non-void function [-Werror=return-type]
> 66 |   [(set (attr "length") (const_int 4))])
>    | ^
>
> 	PR target/109713
>
> gcc/ChangeLog:
>
> 	* config/riscv/sync.md: Add gcc_unreachable to a switch.
> ---
>  gcc/config/riscv/sync.md | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md
> index 6e7c762ac57..9fc626267de 100644
> --- a/gcc/config/riscv/sync.md
> +++ b/gcc/config/riscv/sync.md
> @@ -62,6 +62,8 @@ (define_insn "mem_thread_fence_1"
>  	return "fence\tr,rw";
>      else if (model == MEMMODEL_RELEASE)
>  	return "fence\trw,w";
> +    else
> +	gcc_unreachable ();
>    }
>    [(set (attr "length") (const_int 4))])

Thanks!
  

Patch

diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md
index 6e7c762ac57..9fc626267de 100644
--- a/gcc/config/riscv/sync.md
+++ b/gcc/config/riscv/sync.md
@@ -62,6 +62,8 @@  (define_insn "mem_thread_fence_1"
 	return "fence\tr,rw";
     else if (model == MEMMODEL_RELEASE)
 	return "fence\trw,w";
+    else
+	gcc_unreachable ();
   }
   [(set (attr "length") (const_int 4))])