[前][次][番号順一覧][スレッド一覧]

ruby-changes:71255

From: Peter <ko1@a...>
Date: Wed, 23 Feb 2022 00:18:06 +0900 (JST)
Subject: [ruby-changes:71255] 2ea175eb69 (master): Fix compiler warning for uninitialized variable

https://git.ruby-lang.org/ruby.git/commit/?id=2ea175eb69

From 2ea175eb692dfc250af8f1ea8f60ff25490ccf08 Mon Sep 17 00:00:00 2001
From: Peter Zhu <peter@p...>
Date: Tue, 22 Feb 2022 10:15:21 -0500
Subject: Fix compiler warning for uninitialized variable

Fixes this compiler warning:

warning: 'loc' may be used uninitialized in this function [-Wmaybe-uninitialized]
	                     bt_yield_loc(loc - cfunc_counter, cfunc_counter, btobj);
---
 vm_backtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vm_backtrace.c b/vm_backtrace.c
index cc4e8875fc..27e108af61 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -590,7 +590,7 @@ rb_ec_partial_backtrace_object(const rb_execution_context_t *ec, long start_fram https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L590
     ptrdiff_t size;
     rb_backtrace_t *bt;
     VALUE btobj = backtrace_alloc(rb_cBacktrace);
-    rb_backtrace_location_t *loc;
+    rb_backtrace_location_t *loc = NULL;
     unsigned long cfunc_counter = 0;
     GetCoreDataFromValue(btobj, rb_backtrace_t, bt);
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]