Re: [PATCH] analyzer: fix ICE casued by dup2 in sm-fd.cc[PR106551]

2022-08-11 Thread Mir Immad via Gcc-patches
With the fix for bogus warning in fd-uninit.c, the analyzer now does not warning for the following code for which it would previously emit -Wanalyzer-fd-use-without-check extern int m; test() { int fd = dup2(m, 1); close(fd); } So I had to remove such warnings from fd-dup-1.c test_20,21,22 (in

Re: [PATCH] analyzer: fix ICE casued by dup2 in sm-fd.cc[PR106551]

2022-08-10 Thread Mir Immad via Gcc-patches
> Can you please rebase and see if your patch > does fix it? No, the patch that I sent did not attempt to fix this. Now that I have made the correction, XFAIL in fd-uninit-1.c has changed to XPASS. Should i remove the dg-bogus warning from fd-uninit-1.c test_1? Thanks. Immad. On Wed, Aug 10,

Re: [PATCH] analyzer: fix ICE casued by dup2 in sm-fd.cc[PR106551]

2022-08-10 Thread Mir Immad via Gcc-patches
> if you convert the "int m;" locals into an extern global, like in > comment #0 of bug 106551, does that still trigger the crash on the > unpatched sm-fd.cc? Yes, it does, since m would be in "m_start" state. I'm sending an updated patch. Thanks Immad. On Wed, Aug 10, 2022 at 1:32 AM David Mal

Re: [PATCH] analyzer: fix ICE casued by dup2 in sm-fd.cc[PR106551]

2022-08-09 Thread Mir Immad via Gcc-patches
Thanks. I've added few testcases that use uninitialized ints in dup, dup2, and dup3. Immad. On Tue, Aug 9, 2022 at 8:43 PM David Malcolm wrote: > On Tue, 2022-08-09 at 13:16 +0530, Immad Mir wrote: > > This patch fixes the ICE caused by valid_to_unchecked_state, > > at analyzer/sm-fd.cc by hand

Re: [PATCH] analyzer: support for creat, dup, dup2 and dup3 [PR106298]

2022-08-02 Thread Mir Immad via Gcc-patches
The above patch is bootstrapped, lightly tested (on x86_64 Linux) and approved for trunk by David. On Tue, Aug 2, 2022 at 10:04 PM Immad Mir wrote: > This patch extends the state machine in sm-fd.cc to support > creat, dup, dup2 and dup3 functions. > > Lightly tested on x86_64 Linux. > > gcc/ana

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-20 Thread Mir Immad via Gcc-patches
> Sorry to nitpick -- I assume stmt here refers to a call stmt ? > In that case, I suppose it'd be better to use const gcall *stmt ? Thanks for the catch, Prathamesh. Immad. On Wed, Jul 20, 2022 at 11:59 PM Prathamesh Kulkarni < prathamesh.kulka...@linaro.org> wrote: > On Wed, 20 Jul 2022 at

[PATCH 2/2] analyzer: reorder initialization of state m_invalid in sm-fd.cc [PR106184]

2022-07-05 Thread Mir Immad via Gcc-patches
>From 3de908fa0c3e515b49df24460f85924211802d6c Mon Sep 17 00:00:00 2001 From: Immad Mir Date: Tue, 5 Jul 2022 21:21:13 +0530 Subject: [PATCH 2/2] analyzer: reorder initialization of state m_invalid in sm-fd.cc [PR106184] This patch reorders the initization of state m_invalid in sm-fd.cc to confo

[PATCH 1/2] analyzer: show close event for use_after_close diagnostic

2022-07-05 Thread Mir Immad via Gcc-patches
>From be60d5194068355ccdbf832d0de9dbfed1e0b074 Mon Sep 17 00:00:00 2001 From: Immad Mir Date: Tue, 5 Jul 2022 21:14:06 +0530 Subject: [PATCH 1/2] analyzer: show close event for use_after_close diagnostic This patch saves the "close" event in use_after_close diagnostic and shows it where possible.