{"thread":{"id":"56984","subject":"[PATCH 0/4] Fix LLP64 `(size_t)1` compatibility VS C4334 warnings","startedAt":"2021-11-26T11:46:35Z","lastAt":"2021-11-30T22:28:09Z","messageCount":12,"participants":["Philip Oakley","René Scharfe","Derrick Stolee","Taylor Blau"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"442356","messageId":"20211126113614.709-1-philipoakley@iee.email","threadId":"56984","inReplyTo":null,"subject":"[PATCH 0/4] Fix LLP64 `(size_t)1` compatibility VS C4334 warnings","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-26T11:36:10Z","receivedAt":"2021-11-26T11:46:35Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"The Visual Studio MSVC compilation reports a number of C4334 \"was 64-bit\nshift intended\" size mismatch warnings. In most of these cases a size_t\nis ANDed (masked) with a bit shift of 1, or 1U. On LLP64 systems the unity\nvalue is 32 bits, while size_t is 64 bits. \n\nThe fix is to upcast the unity value to size_t.   \n\nThe first patch has also been reported [1] by René Scharfe as an extra patch\nto the rs/mergesort series. That patch had been on maint.\n\nThe middle two patches are similar changes, though [2/4] is a uintptr_t.\n\nThe final patch is applied to object-file.c, which has recently been\nrenamed from sha1-file.c, so couldn't be applied to the earlier maint\nbranch.[2]\n\nThese fixes clear all the current C4334 warnings.\n\nThe patches can be squashed together if required.\n\n[1] https://lore.kernel.org/git/7fbd4cf4-5f66-a4cd-0c41-e5b12d14d761@iee.email/\n[2] https://lore.kernel.org/git/3e7af5d3-58fd-3a92-371f-3fa26cfe05a0@iee.email/\n\nPhilip Oakley (4):\n  mergesort.c: LLP64 compatibility, upcast unity for left shift\n  repack.c: LLP64 compatibility, upcast unity for left shift\n  diffcore-delta.c: LLP64 compatibility, upcast unity for left shift\n  object-file.c: LLP64 compatibility, upcast unity for left shift\n\n builtin/repack.c | 2 +-\n diffcore-delta.c | 6 +++---\n mergesort.c      | 2 +-\n object-file.c    | 2 +-\n 4 files changed, 6 insertions(+), 6 deletions(-)\n\n-- \n2.34.0.rc1.windows.1.4.ga126985b17\n\n"},{"id":"442357","messageId":"20211126113614.709-5-philipoakley@iee.email","threadId":"56984","inReplyTo":"20211126113614.709-1-philipoakley@iee.email","subject":"[PATCH 4/4] object-file.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-26T11:36:14Z","receivedAt":"2021-11-26T11:46:36Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Visual Studio reports C4334 \"was 64-bit shift intended\" warning because\nof size miss-match.\n\nPromote unity to the matching type to fit with the assignment.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.email>\n\n---\n\nThis cannot be applied to the maint-2.32 branch as the earlier René Scharfe\npatch had been, because the original sha1-file.c, to which the backport\nwould apply, has been renamed in e5afd4449d (object-file.c: rename\nfrom sha1-file.c, 2020-12-31) which was merged in 8b327f1784\n(Merge branch 'ma/sha1-is-a-hash', 2021-01-15)\n---\n object-file.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/object-file.c b/object-file.c\nindex c3d866a287..da8821cb91 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -2425,7 +2425,7 @@ struct oidtree *odb_loose_cache(struct object_directory *odb,\n \tstruct strbuf buf = STRBUF_INIT;\n \tsize_t word_bits = bitsizeof(odb->loose_objects_subdir_seen[0]);\n \tsize_t word_index = subdir_nr / word_bits;\n-\tsize_t mask = 1u << (subdir_nr % word_bits);\n+\tsize_t mask = (size_t)1u << (subdir_nr % word_bits);\n \tuint32_t *bitmap;\n \n \tif (subdir_nr < 0 ||\n-- \n2.34.0.rc1.windows.1.4.ga126985b17\n\n"},{"id":"442358","messageId":"20211126113614.709-2-philipoakley@iee.email","threadId":"56984","inReplyTo":"20211126113614.709-1-philipoakley@iee.email","subject":"[PATCH 1/4] mergesort.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-26T11:36:11Z","receivedAt":"2021-11-26T11:46:37Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Visual Studio reports C4334 \"was 64-bit shift intended\" size mismatch\nwarning because of size miss-match.\n\nPromote unity to the matching type to fit with the `&` operator.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.email>\n\n---\nThis is the same fix that René Scharfe provided in 42c456ff81\n(mergesort: avoid left shift overflow, 2021-11-16)\n\nUse size_t to match n when building the bitmask for checking whether a\nrank is occupied, instead of the default signed int.\n---\n mergesort.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/mergesort.c b/mergesort.c\nindex 6216835566..bd9c6ef8ee 100644\n--- a/mergesort.c\n+++ b/mergesort.c\n@@ -63,7 +63,7 @@ void *llist_mergesort(void *list,\n \t\tvoid *next = get_next_fn(list);\n \t\tif (next)\n \t\t\tset_next_fn(list, NULL);\n-\t\tfor (i = 0; n & (1 << i); i++)\n+\t\tfor (i = 0; n & ((size_t)1 << i); i++)\n \t\t\tlist = llist_merge(ranks[i], list, get_next_fn,\n \t\t\t\t\t   set_next_fn, compare_fn);\n \t\tn++;\n-- \n2.34.0.rc1.windows.1.4.ga126985b17\n\n"},{"id":"442359","messageId":"20211126113614.709-4-philipoakley@iee.email","threadId":"56984","inReplyTo":"20211126113614.709-1-philipoakley@iee.email","subject":"[PATCH 3/4] diffcore-delta.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-26T11:36:13Z","receivedAt":"2021-11-26T11:46:39Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Visual Studio reports C4334 \"was 64-bit shift intended\" warning\nbecause of size miss-match.\n\nPromote unity to the matching type to fit with its subsequent operation.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.email>\n---\n diffcore-delta.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/diffcore-delta.c b/diffcore-delta.c\nindex 5668ace60d..a4e86dfa38 100644\n--- a/diffcore-delta.c\n+++ b/diffcore-delta.c\n@@ -133,10 +133,10 @@ static struct spanhash_top *hash_chars(struct repository *r,\n \n \ti = INITIAL_HASH_SIZE;\n \thash = xmalloc(st_add(sizeof(*hash),\n-\t\t\t      st_mult(sizeof(struct spanhash), 1<<i)));\n+\t\t\t      st_mult(sizeof(struct spanhash), (size_t)1<<i)));\n \thash->alloc_log2 = i;\n \thash->free = INITIAL_FREE(i);\n-\tmemset(hash->data, 0, sizeof(struct spanhash) * (1<<i));\n+\tmemset(hash->data, 0, sizeof(struct spanhash) * ((size_t)1 << i));\n \n \tn = 0;\n \taccum1 = accum2 = 0;\n@@ -159,7 +159,7 @@ static struct spanhash_top *hash_chars(struct repository *r,\n \t\tn = 0;\n \t\taccum1 = accum2 = 0;\n \t}\n-\tQSORT(hash->data, 1ul << hash->alloc_log2, spanhash_cmp);\n+\tQSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp);\n \treturn hash;\n }\n \n-- \n2.34.0.rc1.windows.1.4.ga126985b17\n\n"},{"id":"442360","messageId":"20211126113614.709-3-philipoakley@iee.email","threadId":"56984","inReplyTo":"20211126113614.709-1-philipoakley@iee.email","subject":"[PATCH 2/4] repack.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-26T11:36:12Z","receivedAt":"2021-11-26T11:46:40Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Visual Studio reports C4334 \"was 64-bit shift intended\" warning\nbecause of size miss-match.\n\nPromote unity to the matching type to fit with the `&` operator.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.email>\n---\n builtin/repack.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 0b2d1e5d82..6da66474fd 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -842,7 +842,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\t\tfname_old = mkpathdup(\"%s-%s%s\",\n \t\t\t\t\tpacktmp, item->string, exts[ext].name);\n \n-\t\t\tif (((uintptr_t)item->util) & (1 << ext)) {\n+\t\t\tif (((uintptr_t)item->util) & ((uintptr_t)1 << ext)) {\n \t\t\t\tstruct stat statbuffer;\n \t\t\t\tif (!stat(fname_old, &statbuffer)) {\n \t\t\t\t\tstatbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);\n-- \n2.34.0.rc1.windows.1.4.ga126985b17\n\n"},{"id":"442395","messageId":"9c3d6d3c-1f3b-f51c-6856-b5ced44a8f4b@web.de","threadId":"56984","inReplyTo":"20211126113614.709-2-philipoakley@iee.email","subject":"Re: [PATCH 1/4] mergesort.c: LLP64 compatibility, upcast unity for left shift","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2021-11-27T07:32:31Z","receivedAt":"2021-11-27T07:34:44Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 26.11.21 um 12:36 schrieb Philip Oakley:\n> Visual Studio reports C4334 \"was 64-bit shift intended\" size mismatch\n> warning because of size miss-match.\n>\n> Promote unity to the matching type to fit with the `&` operator.\n>\n> Signed-off-by: Philip Oakley <philipoakley@iee.email>\n>\n> ---\n> This is the same fix that René Scharfe provided in 42c456ff81\n> (mergesort: avoid left shift overflow, 2021-11-16)\n>\n> Use size_t to match n when building the bitmask for checking whether a\n> rank is occupied, instead of the default signed int.\n\nFine with me -- it's just nicer to take the whole set.\n\nRené\n\n> ---\n>  mergesort.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/mergesort.c b/mergesort.c\n> index 6216835566..bd9c6ef8ee 100644\n> --- a/mergesort.c\n> +++ b/mergesort.c\n> @@ -63,7 +63,7 @@ void *llist_mergesort(void *list,\n>  \t\tvoid *next = get_next_fn(list);\n>  \t\tif (next)\n>  \t\t\tset_next_fn(list, NULL);\n> -\t\tfor (i = 0; n & (1 << i); i++)\n> +\t\tfor (i = 0; n & ((size_t)1 << i); i++)\n>  \t\t\tlist = llist_merge(ranks[i], list, get_next_fn,\n>  \t\t\t\t\t   set_next_fn, compare_fn);\n>  \t\tn++;\n>\n\n"},{"id":"442454","messageId":"f721bc99-6d79-e2f2-7810-dd77b777161f@gmail.com","threadId":"56984","inReplyTo":"20211126113614.709-4-philipoakley@iee.email","subject":"Re: [PATCH 3/4] diffcore-delta.c: LLP64 compatibility, upcast unity for left shift","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2021-11-29T14:44:31Z","receivedAt":"2021-11-29T18:14:19Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 11/26/2021 6:36 AM, Philip Oakley wrote:\n> Visual Studio reports C4334 \"was 64-bit shift intended\" warning\n> because of size miss-match.\n> \n> Promote unity to the matching type to fit with its subsequent operation.\n> \n> Signed-off-by: Philip Oakley <philipoakley@iee.email>\n> ---\n>  diffcore-delta.c | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/diffcore-delta.c b/diffcore-delta.c\n> index 5668ace60d..a4e86dfa38 100644\n> --- a/diffcore-delta.c\n> +++ b/diffcore-delta.c\n> @@ -133,10 +133,10 @@ static struct spanhash_top *hash_chars(struct repository *r,\n>  \n>  \ti = INITIAL_HASH_SIZE;\n>  \thash = xmalloc(st_add(sizeof(*hash),\n> -\t\t\t      st_mult(sizeof(struct spanhash), 1<<i)));\n> +\t\t\t      st_mult(sizeof(struct spanhash), (size_t)1<<i)));\n\nThis could use spaces around \"<<\"\n\n>  \thash->alloc_log2 = i;\n>  \thash->free = INITIAL_FREE(i);\n> -\tmemset(hash->data, 0, sizeof(struct spanhash) * (1<<i));\n> +\tmemset(hash->data, 0, sizeof(struct spanhash) * ((size_t)1 << i));\n\nEspecially because you correctly add them here.\n\nThanks,\n-Stolee\n"},{"id":"442455","messageId":"3afe7a17-bf9f-1191-5ed4-407f4f26b9ed@gmail.com","threadId":"56984","inReplyTo":"20211126113614.709-1-philipoakley@iee.email","subject":"Re: [PATCH 0/4] Fix LLP64 `(size_t)1` compatibility VS C4334 warnings","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2021-11-29T14:44:48Z","receivedAt":"2021-11-29T18:14:46Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 11/26/2021 6:36 AM, Philip Oakley wrote:\n> The Visual Studio MSVC compilation reports a number of C4334 \"was 64-bit\n> shift intended\" size mismatch warnings. In most of these cases a size_t\n> is ANDed (masked) with a bit shift of 1, or 1U. On LLP64 systems the unity\n> value is 32 bits, while size_t is 64 bits. \n> \n> The fix is to upcast the unity value to size_t.   \n> \n> The first patch has also been reported [1] by René Scharfe as an extra patch\n> to the rs/mergesort series. That patch had been on maint.\n> \n> The middle two patches are similar changes, though [2/4] is a uintptr_t.\n> \n> The final patch is applied to object-file.c, which has recently been\n> renamed from sha1-file.c, so couldn't be applied to the earlier maint\n> branch.[2]\n> \n> These fixes clear all the current C4334 warnings.\n\nThank you for these changes. They all are obviously correct.\n\nI had one style nitpick that you could take or leave.\n\n> The patches can be squashed together if required.\n\nI'm fine either way.\n\nThanks,\n-Stolee\n"},{"id":"442584","messageId":"384f10ca-81c5-dd89-b66c-6e49d7f23f70@iee.email","threadId":"56984","inReplyTo":"9c3d6d3c-1f3b-f51c-6856-b5ced44a8f4b@web.de","subject":"Re: [PATCH 1/4] mergesort.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-29T23:49:04Z","receivedAt":"2021-11-29T23:49:07Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 27/11/2021 07:32, René Scharfe wrote:\n> Am 26.11.21 um 12:36 schrieb Philip Oakley:\n>> Visual Studio reports C4334 \"was 64-bit shift intended\" size mismatch\n>> warning because of size miss-match.\n>>\n>> Promote unity to the matching type to fit with the `&` operator.\n>>\n>> Signed-off-by: Philip Oakley <philipoakley@iee.email>\n>>\n>> ---\n>> This is the same fix that René Scharfe provided in 42c456ff81\n>> (mergesort: avoid left shift overflow, 2021-11-16)\n>>\n>> Use size_t to match n when building the bitmask for checking whether a\n>> rank is occupied, instead of the default signed int.\n> Fine with me -- it's just nicer to take the whole set.\n>\n> René\n\nThanks, I'm happy either way if others feels it belongs better with your\nmergesort series.\n>\n>> ---\n>>  mergesort.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/mergesort.c b/mergesort.c\n>> index 6216835566..bd9c6ef8ee 100644\n>> --- a/mergesort.c\n>> +++ b/mergesort.c\n>> @@ -63,7 +63,7 @@ void *llist_mergesort(void *list,\n>>  \t\tvoid *next = get_next_fn(list);\n>>  \t\tif (next)\n>>  \t\t\tset_next_fn(list, NULL);\n>> -\t\tfor (i = 0; n & (1 << i); i++)\n>> +\t\tfor (i = 0; n & ((size_t)1 << i); i++)\n>>  \t\t\tlist = llist_merge(ranks[i], list, get_next_fn,\n>>  \t\t\t\t\t   set_next_fn, compare_fn);\n>>  \t\tn++;\n>>\nPhilip\n"},{"id":"442585","messageId":"833261c1-2369-92bc-3c97-5e548e52cf01@iee.email","threadId":"56984","inReplyTo":"f721bc99-6d79-e2f2-7810-dd77b777161f@gmail.com","subject":"Re: [PATCH 3/4] diffcore-delta.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-29T23:50:03Z","receivedAt":"2021-11-29T23:50:04Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 29/11/2021 14:44, Derrick Stolee wrote:\n> On 11/26/2021 6:36 AM, Philip Oakley wrote:\n>> Visual Studio reports C4334 \"was 64-bit shift intended\" warning\n>> because of size miss-match.\n>>\n>> Promote unity to the matching type to fit with its subsequent operation.\n>>\n>> Signed-off-by: Philip Oakley <philipoakley@iee.email>\n>> ---\n>>  diffcore-delta.c | 6 +++---\n>>  1 file changed, 3 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/diffcore-delta.c b/diffcore-delta.c\n>> index 5668ace60d..a4e86dfa38 100644\n>> --- a/diffcore-delta.c\n>> +++ b/diffcore-delta.c\n>> @@ -133,10 +133,10 @@ static struct spanhash_top *hash_chars(struct repository *r,\n>>  \n>>  \ti = INITIAL_HASH_SIZE;\n>>  \thash = xmalloc(st_add(sizeof(*hash),\n>> -\t\t\t      st_mult(sizeof(struct spanhash), 1<<i)));\n>> +\t\t\t      st_mult(sizeof(struct spanhash), (size_t)1<<i)));\n> This could use spaces around \"<<\"\nOK.\n>\n>>  \thash->alloc_log2 = i;\n>>  \thash->free = INITIAL_FREE(i);\n>> -\tmemset(hash->data, 0, sizeof(struct spanhash) * (1<<i));\n>> +\tmemset(hash->data, 0, sizeof(struct spanhash) * ((size_t)1 << i));\n> Especially because you correctly add them here.\nTrue. The spacing isn't that consistent in the code base, but adding the\nspaces here does look better.\n>\n> Thanks,\n> -Stolee\n\nPhilip\n"},{"id":"442591","messageId":"YaVxwFuMeK3QsfZj@nand.local","threadId":"56984","inReplyTo":"20211126113614.709-3-philipoakley@iee.email","subject":"Re: [PATCH 2/4] repack.c: LLP64 compatibility, upcast unity for left shift","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-11-30T00:35:12Z","receivedAt":"2021-11-30T00:35:15Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Fri, Nov 26, 2021 at 11:36:12AM +0000, Philip Oakley wrote:\n> Visual Studio reports C4334 \"was 64-bit shift intended\" warning\n> because of size miss-match.\n\ns/miss-/mis\n\n> diff --git a/builtin/repack.c b/builtin/repack.c\n> index 0b2d1e5d82..6da66474fd 100644\n> --- a/builtin/repack.c\n> +++ b/builtin/repack.c\n> @@ -842,7 +842,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n>  \t\t\tfname_old = mkpathdup(\"%s-%s%s\",\n>  \t\t\t\t\tpacktmp, item->string, exts[ext].name);\n>\n> -\t\t\tif (((uintptr_t)item->util) & (1 << ext)) {\n> +\t\t\tif (((uintptr_t)item->util) & ((uintptr_t)1 << ext)) {\n\nThis line blames to me from back in 2fcb03b52d (builtin/repack.c: don't\nmove existing packs out of the way, 2020-11-17).\n\nThe proposed fix here looks good to me (though we were never at any\npractical risk of getting bitten by a down-cast here since the maximum\nvalue for `ext` is 5).\n\nThanks,\nTaylor\n"},{"id":"442712","messageId":"13a5828d-596f-a215-7053-9570be939e5b@iee.email","threadId":"56984","inReplyTo":"YaVxwFuMeK3QsfZj@nand.local","subject":"Re: [PATCH 2/4] repack.c: LLP64 compatibility, upcast unity for left shift","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-11-30T22:28:05Z","receivedAt":"2021-11-30T22:28:09Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 30/11/2021 00:35, Taylor Blau wrote:\n> On Fri, Nov 26, 2021 at 11:36:12AM +0000, Philip Oakley wrote:\n>> Visual Studio reports C4334 \"was 64-bit shift intended\" warning\n>> because of size miss-match.\n> s/miss-/mis\n\nThanks. Looks like \"miss-pelling\" is my blind spot. Will fix V2 soon.\n>\n>> diff --git a/builtin/repack.c b/builtin/repack.c\n>> index 0b2d1e5d82..6da66474fd 100644\n>> --- a/builtin/repack.c\n>> +++ b/builtin/repack.c\n>> @@ -842,7 +842,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n>>  \t\t\tfname_old = mkpathdup(\"%s-%s%s\",\n>>  \t\t\t\t\tpacktmp, item->string, exts[ext].name);\n>>\n>> -\t\t\tif (((uintptr_t)item->util) & (1 << ext)) {\n>> +\t\t\tif (((uintptr_t)item->util) & ((uintptr_t)1 << ext)) {\n> This line blames to me from back in 2fcb03b52d (builtin/repack.c: don't\n> move existing packs out of the way, 2020-11-17).\n>\n> The proposed fix here looks good to me (though we were never at any\n> practical risk of getting bitten by a down-cast here since the maximum\n> value for `ext` is 5).\nAgreed. It's nice to get a head start on fixing a group of warnings.\n\n> Thanks,\n> Taylor\nPhilip\n"}]}