git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, jrnieder@gmail.com, sbeller@google.com
Subject: [PATCH 1/5] t/helper/test-lazy-name-hash: fix compilation
Date: Tue,  2 Jan 2018 17:12:22 -0800	[thread overview]
Message-ID: <20180103011226.160185-2-sbeller@google.com> (raw)
In-Reply-To: <20180103011226.160185-1-sbeller@google.com>

I was compiling origin/master today with stricter compiler flags today
and was greeted by

t/helper/test-lazy-init-name-hash.c: In function ‘cmd_main’:
t/helper/test-lazy-init-name-hash.c:172:5: error: ‘nr_threads_used’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     printf("avg [size %8d] [single %f] %c [multi %f %d]\n",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         nr,
         ~~~
         (double)avg_single/1000000000,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         (avg_single < avg_multi ? '<' : '>'),
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         (double)avg_multi/1000000000,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         nr_threads_used);
         ~~~~~~~~~~~~~~~~
t/helper/test-lazy-init-name-hash.c:115:6: note: ‘nr_threads_used’ was declared here
  int nr_threads_used;
      ^~~~~~~~~~~~~~~

I do not see how we can arrive at that line without having `nr_threads_used`
initialized, as we'd have `count > 1`  (which asserts that we ran the
loop above at least once, such that it *should* be initialized).

I do not have time to dive into further analysis.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/helper/test-lazy-init-name-hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
index 6368a89345..297fb01d61 100644
--- a/t/helper/test-lazy-init-name-hash.c
+++ b/t/helper/test-lazy-init-name-hash.c
@@ -112,7 +112,7 @@ static void analyze_run(void)
 {
 	uint64_t t1s, t1m, t2s, t2m;
 	int cache_nr_limit;
-	int nr_threads_used;
+	int nr_threads_used = 0;
 	int i;
 	int nr;
 
-- 
2.15.1.620.gb9897f4670-goog


  reply	other threads:[~2018-01-03  1:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 22:26 [PATCH 0/5] Fix --recurse-submodules for submodule worktree changes Stefan Beller
2017-12-19 22:26 ` [PATCH 1/5] t/lib-submodule-update.sh: clarify test Stefan Beller
2017-12-19 22:26 ` [PATCH 2/5] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2017-12-22 19:34   ` Junio C Hamano
2017-12-27 19:27     ` Stefan Beller
2017-12-19 22:26 ` [PATCH 3/5] t/lib-submodule-update.sh: add new test for submodule internal change Stefan Beller
2017-12-19 22:31   ` Jonathan Nieder
2017-12-19 22:35     ` Stefan Beller
2017-12-19 22:26 ` [PATCH 4/5] unpack-trees: Fix same() for submodules Stefan Beller
2017-12-19 22:26 ` [PATCH 5/5] submodule: submodule_move_head omits old argument in forced case Stefan Beller
2017-12-19 22:44   ` Jonathan Nieder
2017-12-19 22:54     ` Stefan Beller
2017-12-19 23:15       ` Jonathan Nieder
2017-12-20  0:01       ` Jonathan Nieder
2017-12-20 19:36         ` Stefan Beller
2017-12-20 19:38           ` Stefan Beller
2017-12-27 22:57 ` [PATCHv2 0/5] Fix --recurse-submodules for submodule worktree changes Stefan Beller
2017-12-27 22:57   ` [PATCHv2 1/5] t/helper/test-lazy-name-hash: fix compilation Stefan Beller
2017-12-27 22:57   ` [PATCHv2 2/5] t/lib-submodule-update.sh: clarify test Stefan Beller
2017-12-27 22:57   ` [PATCHv2 3/5] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2017-12-27 22:57   ` [PATCHv2 4/5] unpack-trees: oneway_merge to update submodules Stefan Beller
2018-01-02 19:43     ` Junio C Hamano
2018-01-02 23:04       ` Stefan Beller
2018-01-03  1:12       ` [PATCHv3 0/5] Fix --recurse-submodules for submodule worktree changes Stefan Beller
2018-01-03  1:12         ` Stefan Beller [this message]
2018-01-03  1:12         ` [PATCH 2/5] t/lib-submodule-update.sh: clarify test Stefan Beller
2018-01-03  1:12         ` [PATCH 3/5] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2018-01-03  1:12         ` [PATCH 4/5] unpack-trees: oneway_merge to update submodules Stefan Beller
2018-01-03  1:12         ` [PATCH 5/5] submodule: submodule_move_head omits old argument in forced case Stefan Beller
2018-01-03 20:49         ` [PATCHv3 0/5] Fix --recurse-submodules for submodule worktree changes Junio C Hamano
2018-01-03 21:16           ` Stefan Beller
2018-01-05 20:03           ` [PATCHv4 0/4] " Stefan Beller
2018-01-05 20:03             ` [PATCHv4 1/4] t/lib-submodule-update.sh: clarify test Stefan Beller
2018-01-05 20:03             ` [PATCHv4 2/4] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2018-01-05 20:03             ` [PATCHv4 3/4] unpack-trees: oneway_merge to update submodules Stefan Beller
2018-01-05 20:03             ` [PATCHv4 4/4] submodule: submodule_move_head omits old argument in forced case Stefan Beller
2018-01-09 22:45             ` [PATCHv4 0/4] Fix --recurse-submodules for submodule worktree changes Junio C Hamano
2017-12-27 22:57   ` [PATCHv2 5/5] submodule: submodule_move_head omits old argument in forced case Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180103011226.160185-2-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).