git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org
Subject: validating signed/unsigned comparisons with Coccinelle, was Re: [PATCH 0/3] A couple of CI fixes regarding the built-in add --patch
Date: Tue, 30 Aug 2022 16:19:00 +0200 (CEST)	[thread overview]
Message-ID: <p9p431r8-nq64-02sq-3049-n10rrn1o89o7@tzk.qr> (raw)
In-Reply-To: <pull.1340.git.1661867664.gitgitgadget@gmail.com>

Hi,

On Tue, 30 Aug 2022, Johannes Schindelin via GitGitGadget wrote:

> Note: This patch series is based on ds/github-actions-use-newer-ubuntu (but
> probably applies cleanly even on maint) because I tried to develop a
> semantic patch to fix similar issues in the code base. However, I've since
> run into what looks like a bug in Coccinelle
> [https://github.com/coccinelle/coccinelle/issues/284]. My latest version of
> that semantic patch looks like this, but I stopped when running it on Git's
> source code triggered the bug for 66 of Git's .c files:
>
> @@
> type T = { unsigned int };
> T:n b;
> type S != { unsigned int, size_t };
> S s;
> binary operator o != { &&, || };
> @@
> -s o b
> +s o (S)b
>
> @@
> type T = { unsigned int };
> T:n b;
> type S != { unsigned int, size_t };
> S s;
> binary operator o != { &&, || };
> @@
> -b o s
> +(S)b o s

The bug in Coccinelle is already fixed (are you impressed? I certainly
am at the incredible speed and at the wonderful conversation I had!), and
I verified with this semantic patch that our code is clean:

-- snip --
@@
type T = { unsigned int };
T:n b;
type S != { unsigned int, size_t, float, double };
S s;
binary operator o != { &&, || };
@@
 s o
-b
+(S)b

@@
type T = { unsigned int };
T:n b;
type S != { unsigned int, size_t, float, double };
S s;
binary operator o != { &&, || };
@@
-b
+(S)b
 o s
-- snap --

I do not currently plan on integrating this into `contrib/coccinelle/`,
though, because it will take a while until we can benefit from the fix in
Git's CI/PR runs.

Ciao,
Dscho

  parent reply	other threads:[~2022-08-30 14:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 13:54 [PATCH 0/3] A couple of CI fixes regarding the built-in add --patch Johannes Schindelin via GitGitGadget
2022-08-30 13:54 ` [PATCH 1/3] add -p: avoid ambiguous signed/unsigned comparison Johannes Schindelin via GitGitGadget
2022-08-30 19:09   ` Junio C Hamano
2022-08-30 13:54 ` [PATCH 2/3] t3701: test the built-in `add -i` regardless of NO_PERL Johannes Schindelin via GitGitGadget
2022-08-30 18:54   ` Jeff King
2022-08-30 21:03     ` Johannes Schindelin
2022-08-30 19:09   ` Junio C Hamano
2022-08-30 13:54 ` [PATCH 3/3] t6132(NO_PERL): do not run the scripted `add -p` Johannes Schindelin via GitGitGadget
2022-08-30 14:19 ` Johannes Schindelin [this message]
2022-08-30 15:22   ` validating signed/unsigned comparisons with Coccinelle, was Re: [PATCH 0/3] A couple of CI fixes regarding the built-in add --patch Phillip Wood
2022-08-30 21:12     ` Johannes Schindelin
2022-08-30 21:29       ` Junio C Hamano
2022-08-30 21:46         ` Junio C Hamano
2022-08-30 21:32       ` Jeff King
2022-08-30 15:19 ` Phillip Wood

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=p9p431r8-nq64-02sq-3049-n10rrn1o89o7@tzk.qr \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@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).