Re: GSoC: Working on the static analyzer

2022-04-08 Thread David Malcolm via Gcc
On Mon, 2022-04-04 at 21:46 +0530, Mir Immad wrote: > Hi David, > > Sorry for such late reply. I've been busy with classes and exams. > > As the contributor applications are opening, I would like to put > forward a > proposal for a medium project for extending the static analyzer to work > with

Re: GSoC: Working on the static analyzer

2022-04-04 Thread Mir Immad via Gcc
Hi David, Sorry for such late reply. I've been busy with classes and exams. As the contributor applications are opening, I would like to put forward a proposal for a medium project for extending the static analyzer to work with POSIX file descriptor APIs. As evident in this thread, I've been

Re: GSoC: Working on the static analyzer

2022-02-14 Thread Basile Starynkevitch
On 2/14/22 13:59, Basile Starynkevitch wrote: Hello, Mir Immad asked: Should the analyzer warn for code like this "when open fails" (like strchr does when 'strchr' returns NULL) int fd = open("NOFILE", O_RDONLY); write(fd, "a", 1); because of the bad file descriptor. unless it is

GSoC: Working on the static analyzer

2022-02-14 Thread Basile Starynkevitch
Hello, Mir Immad asked: Should the analyzer warn for code like this "when open fails" (like strchr does when 'strchr' returns NULL) int fd = open("NOFILE", O_RDONLY); write(fd, "a", 1); because of the bad file descriptor. unless it is written like this: if (!errno) write(fd, "a", 1);

Re: GSoC: Working on the static analyzer

2022-02-13 Thread David Malcolm via Gcc
On Sun, 2022-02-13 at 17:57 -0500, David Malcolm wrote: > On Sun, 2022-02-13 at 21:16 +0530, Mir Immad wrote: > > Hi, > > > > I wanted some clarification on bifurcating the exploded graph at > > call > > to > > open(). > > Should the analyzer warn for code like this "when open fails" (like > >

Re: GSoC: Working on the static analyzer

2022-02-13 Thread David Malcolm via Gcc
On Sun, 2022-02-13 at 21:16 +0530, Mir Immad wrote: > Hi, > > I wanted some clarification on bifurcating the exploded graph at call > to > open(). > Should the analyzer warn for code like this "when open fails" (like > strchr > does when  'strchr' returns NULL) > > int fd = open("NOFILE",

Re: GSoC: Working on the static analyzer

2022-02-13 Thread Mir Immad via Gcc
Hi, I wanted some clarification on bifurcating the exploded graph at call to open(). Should the analyzer warn for code like this "when open fails" (like strchr does when 'strchr' returns NULL) int fd = open("NOFILE", O_RDONLY); write(fd, "a", 1); because of the bad file descriptor. unless it

Re: GSoC: Working on the static analyzer

2022-02-01 Thread Mir Immad via Gcc
I worked around the leak detection and also handled the case where the fd is not saved. I wonder why sm-file hasn't implemented it yet. I'm attaching a text file with analyzer warnings. I'm still on gcc-11.2.0, will move to v12 next thing. > I wonder if it's worth checking for attempts to write

Re: GSoC: Working on the static analyzer

2022-01-29 Thread David Malcolm via Gcc
On Sat, 2022-01-29 at 20:22 +0530, Mir Immad wrote: > Thank you for the detailed information. > > I've been looking into the integer posix  file descriptor APIs and I > decided to write proof-of-concept  checker for them. (not caring > about > errno). The checker tracks the fd returned by open(),

Re: GSoC: Working on the static analyzer

2022-01-29 Thread Mir Immad via Gcc
Thank you for the detailed information. I've been looking into the integer posix file descriptor APIs and I decided to write proof-of-concept checker for them. (not caring about errno). The checker tracks the fd returned by open(), warns if dup() is called with closed fd otherwise tracks the fd

Re: GSoC: Working on the static analyzer

2022-01-26 Thread David Malcolm via Gcc
On Mon, 2022-01-24 at 19:49 +0530, Ankur Saini wrote: > The following can be a possible example of a case where the analyzer > fails > to understand POSIX file-descriptor API. > > - - - > #include > #include > > void test() > { >     int fd; >     fd = open("foo.txt", O_RDONLY | O_CREAT); > }

Re: GSoC: Working on the static analyzer

2022-01-26 Thread David Malcolm via Gcc
On Mon, 2022-01-24 at 01:41 +0530, Mir Immad wrote: > Hi, sir. > > I've been trying to understand the static analyzer's code. I spent most > of > my time learning the state machine's API. I learned how state machine's > on_stmt is supposed to "recognize" specific functions and how > on_transition

Re: GSoC: Working on the static analyzer

2022-01-24 Thread Ankur Saini via Gcc
The following can be a possible example of a case where the analyzer fails to understand POSIX file-descriptor API. - - - #include #include void test() { int fd; fd = open("foo.txt", O_RDONLY | O_CREAT); } void test_2() { FILE *f; f = fopen("demo.c", "r"); } godbolt link:

Re: GSoC: Working on the static analyzer

2022-01-23 Thread Mir Immad via Gcc
Hi, sir. I've been trying to understand the static analyzer's code. I spent most of my time learning the state machine's API. I learned how state machine's on_stmt is supposed to "recognize" specific functions and how on_transition takes a specific tree from one state to another, and how the

Re: GSoC: Working on the static analyzer

2022-01-16 Thread David Malcolm via Gcc
On Fri, 2022-01-14 at 22:15 +0530, Mir Immad wrote: > HI David, > I've been tinkering with the static analyzer for the last few days. I > find > the project of adding SARIF output to the analyzer intresting. I'm > writing > this to let you know that I'm trying to learn the codebase. > Thank you.

Re: GSoC: Working on the static analyzer

2022-01-14 Thread Mir Immad via Gcc
HI David, I've been tinkering with the static analyzer for the last few days. I find the project of adding SARIF output to the analyzer intresting. I'm writing this to let you know that I'm trying to learn the codebase. Thank you. On Tue, Jan 11, 2022, 7:09 PM David Malcolm wrote: > On Tue,

Re: GSoC: Working on the static analyzer

2022-01-11 Thread David Malcolm via Gcc
On Tue, 2022-01-11 at 11:03 +0530, Mir Immad via Gcc wrote: > Hi everyone, Hi, and welcome. > I intend to work on the static analyzer. Are these documents enough to > get > started: https://gcc.gnu.org/onlinedocs/gccint and >

GSoC: Working on the static analyzer

2022-01-10 Thread Mir Immad via Gcc
Hi everyone, I intend to work on the static analyzer. Are these documents enough to get started: https://gcc.gnu.org/onlinedocs/gccint and https://gcc.gnu.org/onlinedocs/gccint/Analyzer-Internals.html#Analyzer-Internals . Thank you.