From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 544EC3848417 for ; Wed, 14 Jul 2021 17:11:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 544EC3848417 Received: by mail-pf1-x42c.google.com with SMTP id 17so2619807pfz.4 for ; Wed, 14 Jul 2021 10:11:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=16Hs3JgxOSHQq4AQLXtAYwwHJl1rBE4PjFtXt5ynlwg=; b=AsRRgWPcJjo0mZsh1Ke+Ggny1oHN+PtnoZDFMrhIbQr/5RPQlwk68GnAU1ZM4w9fwq IZlIuB0oLy8N2TVwvi0ouHzaiSotfYeUbxg4ZjWQEMiCgipZFAP3n8Mvp2rhGm5Ux+We 5lD49wf68gHKxdV9Xg3qsIHv3Ys6H6OfIX8mpUEX8cocQpwMTwlRQQiBEal66zZRdHTn 1WRoxCohUDk3VGFZMSkHFkh7Wj0Uyn02cn+cQG62SDm9YiPLhw7yXhWVObTdUEu5ScMX 2fRqR+6ZDXy3WDyJAhpci4j9JZ+VXuo2/a1TSW/rfw8QxfEiHQXtmtEx0G0CPVgtPCz9 sxyA== X-Gm-Message-State: AOAM5314fQNj3HwkXjvxVuRYiqu7t1SZI7MqkYyASJ0Z2S6J49d/j5t6 6piNLtp980NHrsdfO7Pe9mw= X-Google-Smtp-Source: ABdhPJwGULq/WosYZXeWjL9Qp4vPuwzfMcni5C5mJ3hqf+I5734Actj9DnBifKPTmFkBvc48/B25KQ== X-Received: by 2002:aa7:818d:0:b029:303:513c:b2c with SMTP id g13-20020aa7818d0000b0290303513c0b2cmr11168969pfi.61.1626282699393; Wed, 14 Jul 2021 10:11:39 -0700 (PDT) Received: from [192.168.100.5] ([103.214.61.65]) by smtp.gmail.com with ESMTPSA id b33sm3666845pgb.92.2021.07.14.10.11.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jul 2021 10:11:38 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.21\)) Subject: Re: daily report on extending static analyzer project [GSoC] From: Ankur Saini In-Reply-To: Date: Wed, 14 Jul 2021 22:41:34 +0530 Cc: gcc@gcc.gnu.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <35A0246A-D4F8-4B41-A009-4A98F78E0395@gmail.com> <06DBCE04-B3AC-4091-979D-430507352213@gmail.com> <425d5e711663bbf0c1ebcfe05097780ebb2126a0.camel@redhat.com> <9e97b67cc5eb55a3a526b1c263a9980915556ce1.camel@redhat.com> <6ea20fa9093b566db6884cc2af51ae1bb7deee95.camel@redhat.com> <0ba8ad1a23fd87ef123ec51f76ccaf29ea114c79.camel@redhat.com> <0558C377-5A39-4D71-A2DC-DE23E737C65D@gmail.com> <0324cb3d52c80b3a6ff70488aa28e2322de7b832.camel@redhat.com> <9CDE4E6A-D7DB-43DE-AB00-95D1B4667061@gmail.com> <00236f15381ae32ac62704d40d064a726a849f50.camel@redhat.com> <0F8999E7-C7E8-4499-9293-55BF4185EF49@gmail.com> <3ff03555914a6ab2e42a288c420050679f615a7b.camel@redhat.com> To: David Malcolm X-Mailer: Apple Mail (2.3654.20.0.2.21) X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 17:11:42 -0000 CURRENT STATUS OF PROJECT: - The analyzer can now sucessfully detect and analyze function calls = that=20 doesn't have a callgraph edge ( like a call via function pointer ) - A weird indentation problem caused by my text editor pointed out in=20 one of the previous mails = (https://gcc.gnu.org/pipermail/gcc/2021-July/236747.html)=20 , that despite being fixed, still messed up indentation in all of the = changes I have done so far. - the analyser can still not detect a call via vtable pointer --- AIM FOR TODAY:=20 - Complete the first evaluation of GSoC - Fix the indentation errors my generated by my editor on changes done = till now - Add the tests to regress testing=20 - Create a ChangeLog for the next patch=20 - Attach the patch with this mail=20 - Layout a new region subclass for vtables ( getting ready for next = patch ) --- PROGRESS : - To fix the indentaion problem, I simply created a diff and fixed all = of them manually. I also found and read a doc regarding coding convention used = by GCC=20 (https://gcc.gnu.org/codingconventions.html) and refactored the = chagnes and changelog to follow this. - After that I branched out and layed out foundation for next update and started created a subclass region for vtable ( vtable_region ), = which =20 currently do nothing - After that in order to give some final finishing touches to previous = changes, I created chagnelog and added 2 more tests to the analyzer testsuite = as follows : 1. (function-ptr-4.c) ``` #include #include =20 void fun(int *int_ptr) { free(int_ptr); /* { dg-warning "double-=E2=80=98free=E2=80=99 = of =E2=80=98int_ptr=E2=80=99" } */ } =20 void single_call() { int *int_ptr =3D (int*)malloc(sizeof(int)); void (*fun_ptr)(int *) =3D &fun; (*fun_ptr)(int_ptr); } =20 void double_call() { int *int_ptr =3D (int*)malloc(sizeof(int)); void (*fun_ptr)(int *) =3D &fun; (*fun_ptr)(int_ptr); (*fun_ptr)(int_ptr); } =20 /*{ dg-begin-multiline-output "" } 6 | free(int_ptr); | ^~~~~~~~~~~~~ =E2=80=98double_call=E2=80=99: events 1-2 | | 16 | void double_call() | | ^~~~~~~~~~~ | | | | | (1) entry to =E2=80=98double_call=E2=80=99 | 17 | { | 18 | int *int_ptr =3D (int*)malloc(sizeof(int)); | | ~~~~~~~~~~~~~~~~~~~ | | | | | (2) allocated here | +--> =E2=80=98fun=E2=80=99: events 3-6 | | 4 | void fun(int *int_ptr) | | ^~~ | | | | | (3) entry to =E2=80=98fun=E2=80=99 | | (5) entry to =E2=80=98fun=E2=80=99 | 5 | { | 6 | free(int_ptr); | | ~~~~~~~~~~~~~ | | | | | (4) first =E2=80=98free=E2=80=99 here | | (6) second =E2=80=98free=E2=80=99 here; = first =E2=80=98free=E2=80=99 was at (4) | */ ``` (godbolt link ) 2. ( pr100546.c )= ``` #include #include =20 static void noReturn(const char *str) __attribute__((noreturn)); static void noReturn(const char *str) { printf("%s\n", str); exit(1); } =20 void (*noReturnPtr)(const char *str) =3D &noReturn; =20 int main(int argc, char **argv) { char *str =3D 0; if (!str) noReturnPtr(__FILE__); return printf("%c\n", *str); } ``` (godbolt link ) - But at the time of testing ( command used=20 was `make check-gcc RUNTESTFLAGS=3D"-v -v analyzer.exp=3Dpr100546.c"`), = both of=20 them failed unexpectedly with Segmentation fault at the call - =46rom further inspection, I found out that this is due=20 "-fanalyzer-call-summaries" option, which looks like activats call = summaries - I would look into this in more details ( with gdb ) tomorrow, right = now=20 my guess is that this is either due too the changes I did in = state-purge.cc or is a call-summary related problem ( I remember it not being=20 perfetly implemented right now).=20 --- STATUS AT THE END OF THE DAY :-=20 - Complete the first evaluation of GSoC ( done ) - Fix the indentation errors my generated by my editor on changes done = till now ( done ) - Layout a new region subclass for vtables ( done ) - Create a ChangeLog for the next patch ( done ) - Add the tests to regress testing ( pending ) - Attach the patch with this mail ( pending ) --- HOUR-O-METER :-=20 no. of hours spent on the project today : 4 hours Grand total (by the end of 14th July 2021): 195 hours Thank you - Ankur=