CURRENT STATUS OF PROJECT:

- The analyzer can now sucessfully detect and analyze function calls that 
  doesn't have a callgraph edge ( like a call via function pointer )

- A weird indentation problem caused by my text editor pointed out in 
  one of the previous mails 
(https://gcc.gnu.org/pipermail/gcc/2021-July/236747.html) 
  , 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: 

- 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 
- Create a ChangeLog for the next patch 
- Attach the patch with this mail 
- 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 
  (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  
  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 <stdio.h>
  #include <stdlib.h>
  
  void fun(int *int_ptr)
  {
          free(int_ptr);  /* { dg-warning "double-‘free’ of ‘int_ptr’" } */
  }
  
  void single_call()
  {
          int *int_ptr = (int*)malloc(sizeof(int));
          void (*fun_ptr)(int *) = &fun;
          (*fun_ptr)(int_ptr);
  }
  
  void double_call()
  {
          int *int_ptr = (int*)malloc(sizeof(int));
          void (*fun_ptr)(int *) = &fun;
          (*fun_ptr)(int_ptr);
          (*fun_ptr)(int_ptr);
  }
  
  /*{ dg-begin-multiline-output "" }
      6 |         free(int_ptr);
        |         ^~~~~~~~~~~~~
    ‘double_call’: events 1-2
      |
      |   16 | void double_call()
      |      |      ^~~~~~~~~~~
      |      |      |
      |      |      (1) entry to ‘double_call’
      |   17 | {
      |   18 |         int *int_ptr = (int*)malloc(sizeof(int));
      |      |                              ~~~~~~~~~~~~~~~~~~~
      |      |                              |
      |      |                              (2) allocated here
      |
      +--> ‘fun’: events 3-6
             |
             |    4 | void fun(int *int_ptr)
             |      |      ^~~
             |      |      |
             |      |      (3) entry to ‘fun’
             |      |      (5) entry to ‘fun’
             |    5 | {
             |    6 |         free(int_ptr);
             |      |         ~~~~~~~~~~~~~
             |      |         |
             |      |         (4) first ‘free’ here
             |      |         (6) second ‘free’ here; first ‘free’ was at (4)
             |
  */
  ```
  (godbolt link <https://godbolt.org/z/1o3cK4aYo>)

  2. ( pr100546.c <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100546>)
  ```
  #include <stdio.h>
  #include <cstdlib.h>
  
  static void noReturn(const char *str) __attribute__((noreturn));
  static void noReturn(const char *str) {
      printf("%s\n", str);
      exit(1);
  }
  
  void (*noReturnPtr)(const char *str) = &noReturn;
  
  int main(int argc, char **argv) {
      char *str = 0;
      if (!str)
          noReturnPtr(__FILE__);
      return printf("%c\n", *str);
  }
  ```
  (godbolt link <https://godbolt.org/z/aWfW51se3>)

- But at the time of testing ( command used 
  was `make check-gcc RUNTESTFLAGS="-v -v analyzer.exp=pr100546.c"`), both of 
  them failed unexpectedly with Segmentation fault at the call

- From further inspection, I found out that this is due 
  "-fanalyzer-call-summaries" option, which looks like activats call summaries

- I would look into this in more details ( with gdb ) tomorrow, right now 
  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 
  perfetly implemented right now). 

---
STATUS AT THE END OF THE DAY :- 

- 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 :- 
no. of hours spent on the project today : 4 hours
Grand total (by the end of 14th July 2021): 195 hours

Thank you
- Ankur

Reply via email to