Revert "threads.c:6403:6: warning: 'current_idx' may be used uninitialized in this...
authorJay Krell <jaykrell@microsoft.com>
Fri, 14 Jun 2019 04:38:43 +0000 (21:38 -0700)
committerLarry Ewing <lewing@microsoft.com>
Tue, 18 Jun 2019 02:53:08 +0000 (21:53 -0500)
This reverts commit mono/mono@bf2f1abe01978102c22d76b4a10996e8d8b50b0f.

The logic is not clear as to if there is a bug, so leave the warning.
There are two uses of the possibly uninitialized variable.
One is guarded and not a bug.
The other is not clear, and don't want to blindly use 0.

Commit migrated from https://github.com/mono/mono/commit/a97408ac1e9b1e0dedbd67424ca0b0a6fc7b73b6

src/mono/mono/metadata/threads.c

index c509fb9..913f01e 100644 (file)
@@ -6373,7 +6373,6 @@ summarizer_supervisor_end (SummarizerSupervisorState *state)
 static gboolean
 summarizer_state_init (SummarizerGlobalState *state, MonoNativeThreadId current, int *my_index)
 {
-       *my_index = 0;
        gint32 started_state = mono_atomic_cas_i32 (&state->has_owner, 1 /* set */, 0 /* compare */);
        gboolean not_started = started_state == 0;
        if (not_started) {
@@ -6547,7 +6546,7 @@ mono_threads_summarize_execute_internal (MonoContext *ctx, gchar **out, MonoStac
 {
        static SummarizerGlobalState state;
 
-       int current_idx = 0;
+       int current_idx;
        MonoNativeThreadId current = mono_native_thread_id_get ();
        gboolean thread_given_control = summarizer_state_init (&state, current, &current_idx);