[GSoC][Static Analyzer] Some questions and request for a small patch to work on

David Malcolm dmalcolm@redhat.com
Wed Feb 22 15:43:41 GMT 2023


On Wed, 2023-02-22 at 15:11 +0100, Shengyu Huang wrote:
> Hi Dave,
> 
> 
> > But a better place to look would probably be in our bugzilla; see
> > the
> > links on the wiki page:
> >  https://gcc.gnu.org/wiki/StaticAnalyzer 
> > The "open bugs" list currently has 41 "RFE" bugs ("request for
> > enhancement" i.e. ideas for new features), some of which might make
> > suitable GSoC ideas, and/or be of interest to you (ideally both!)
> > 
> > Also, the GSoC wiki page has some project ideas:
> >  https://gcc.gnu.org/wiki/SummerOfCode#Selected_Project_Ideas
> > 
> 
> Yeah I was also searching for interesting ideas on the bugzilla, and
> I will communicate to you once I have any more concrete ideas.
> > 
> > If you haven't seen it yet, you might find my guide to GCC for new
> > contributors helpful:
> >  https://gcc-newbies-guide.readthedocs.io/en/latest/index.html
> > 
> 
> Just started reading it. Thanks for sharing!
> 
> > IIRC I saw you post a few days ago about trying to build gcc on
> > your M2
> > laptop; did you manage this?  Building GCC trunk from a git
> > checkout,
> > and hacking in a "hello world" warning would be a great place to
> > start.
> > See the guide above for some hints on how to make this process
> > quicker,
> > and let me know if you need help if you run into difficulties. 
> > Given
> > that the analyzer is about emitting warnings, rather than
> > generating
> > code, it may be that although we don't yet fully support your
> > hardware,
> > we *might* already support it enough to allow for hacking on the
> > analyzer, perhaps with some judicious choices of "configure"
> > options.
> 
> I just finished building it today on my laptop (Thanks Iain!). The
> GCC-12 branch did not work (I got `configure: error: C preprocessor
> "/lib/cpp" fails sanity check`) but the development branch works for
> me (haven’t encountered the potential pitfalls mentioned yet after
> testing it with some simple programs). Besides, I have also set up
> everything on both my university server and the compile farm machine,
> so I can test my work on these two machines as well.
> 
> What do you mean by a “hello world” warning? You meant to write some
> simple code like
> 
> ```
> #include <stdio.h>
> int main ()
> {
>   int a;
>   printf ("hello world\n");
>   return a;
> }
> ```
> 
> and to get the warning “warning: use of uninitialized value ‘a’ [CWE-
> 457] [-Wanalyzer-use-of-uninitialized-value]”? 

Sorry, I was unclear; I was referring to this part of my guide:
https://gcc-newbies-guide.readthedocs.io/en/latest/getting-started.html#hello-world-from-the-compiler

i.e. try writing a new warning that simply emits something like:

test.c:2:1: warning: hello world, I'm compiling 'main'
    2 | int main ()
      |     ^~~~

for each function that it sees.

That way you can easily see that you've modified the compiler, that
your code is running inside it.

Dave



More information about the Gcc mailing list