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

ruby-changes:66481

From: Nobuyoshi <ko1@a...>
Date: Mon, 14 Jun 2021 23:25:27 +0900 (JST)
Subject: [ruby-changes:66481] 70833fab7f (master): Suppress gcc11 clobbered warning

https://git.ruby-lang.org/ruby.git/commit/?id=70833fab7f

From 70833fab7fc2e912f5a405157b3afa101b482c17 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 14 Jun 2021 13:49:10 +0900
Subject: Suppress gcc11 clobbered warning

---
 load.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/load.c b/load.c
index fdc329c..cc758db 100644
--- a/load.c
+++ b/load.c
@@ -1036,12 +1036,14 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception) https://github.com/ruby/ruby/blob/trunk/load.c#L1036
     enum ruby_tag_type state;
     char *volatile ftptr = 0;
     VALUE path;
+    volatile VALUE saved_path;
     volatile bool reset_ext_config = false;
     struct rb_ext_config prev_ext_config;
 
     fname = rb_get_path(fname);
     path = rb_str_encode_ospath(fname);
     RUBY_DTRACE_HOOK(REQUIRE_ENTRY, RSTRING_PTR(fname));
+    saved_path = path;
 
     EC_PUSH_TAG(ec);
     ec->errinfo = Qnil; /* ensure */
@@ -1051,8 +1053,9 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception) https://github.com/ruby/ruby/blob/trunk/load.c#L1053
 	int found;
 
 	RUBY_DTRACE_HOOK(FIND_REQUIRE_ENTRY, RSTRING_PTR(fname));
-        found = search_required(path, &path, rb_feature_p);
+        found = search_required(path, &saved_path, rb_feature_p);
 	RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, RSTRING_PTR(fname));
+        path = saved_path;
 
 	if (found) {
             if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
@@ -1086,6 +1089,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception) https://github.com/ruby/ruby/blob/trunk/load.c#L1089
     th2->top_wrapper = saved.wrapper;
     if (reset_ext_config) ext_config_pop(th2, &prev_ext_config);
 
+    path = saved_path;
     if (ftptr) load_unlock(RSTRING_PTR(path), !state);
 
     if (state) {
-- 
cgit v1.1


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

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