File 3601-v3_kernel-Mark-k_goto-arguments-as-used.patch of Package erlang

From b83f31b5b41d9308402d001b0d565415352c22d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org>
Date: Wed, 4 Jan 2023 11:39:50 +0100
Subject: [PATCH] v3_kernel: Mark #k_goto{} arguments as used

---
 lib/compiler/src/v3_kernel.erl    | 5 +++--
 lib/compiler/test/maybe_SUITE.erl | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl
index b2ddf1afd5..2134260337 100644
--- a/lib/compiler/src/v3_kernel.erl
+++ b/lib/compiler/src/v3_kernel.erl
@@ -1834,8 +1834,9 @@ ubody(#ivalues{anno=A,args=As}, return, St) ->
 ubody(#ivalues{anno=A,args=As}, {break,_Vbs}, St) ->
     Au = lit_list_vars(As),
     {#k_break{anno=A,args=As},Au,St};
-ubody(#k_goto{}=Goto, _Br, St) ->
-    {Goto,[],St};
+ubody(#k_goto{args=As}=Goto, _Br, St) ->
+    Au = lit_list_vars(As),
+    {Goto,Au,St};
 ubody(E, return, St0) ->
     %% Enterable expressions need no trailing return.
     case is_enter_expr(E) of
diff --git a/lib/compiler/test/maybe_SUITE.erl b/lib/compiler/test/maybe_SUITE.erl
index 6c6e21f547..4d44184b23 100644
--- a/lib/compiler/test/maybe_SUITE.erl
+++ b/lib/compiler/test/maybe_SUITE.erl
@@ -90,6 +90,8 @@ basic(_Config) ->
                    E2 -> E2
                end,
 
+    <<0>> = basic_4(id({<<0>>})),
+
     ok.
 
 basic_1(V0, M) ->
@@ -207,6 +209,11 @@ basic_3b(V0, M) ->
         end,
     {wrapped,Result}.
 
+basic_4({X}) ->
+    maybe 
+        <<_:(ok)>> ?= X
+    end.
+
 nested(_Config) ->
     {outer_fail,not_ok} = nested_1(0, #{0 => not_ok}),
     {x,{error,inner}} = nested_1(0, #{0 => {ok,x}, x => {error,inner}}),
-- 
2.35.3

openSUSE Build Service is sponsored by