validating signed/unsigned comparisons with Coccinelle, was Re: [PATCH 0/3] A couple of CI fixes regarding the built-in add --patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux