thradams / cake

Cake a C23 front end and transpiler written in C
http://thradams.com/cake/index.html
GNU General Public License v3.0
544 stars 24 forks source link

Segfault when running "cake -analize" on itself #110

Closed mingodad closed 8 months ago

mingodad commented 8 months ago
./cake -analyze -D__x86_64__  -I/usr/lib/gcc/x86_64-linux-gnu/11/include/  -I/usr/local/include/  -I/usr/include/x86_64-linux-gnu/  -I/usr/include/  console.h  tokenizer.h  parser.h  error.h  fs.h  hash.h  object.h  hashmap.h  osstream.h  options.h  token.h  type.h  pre_expressions.h  expressions.h  visit.h  format_visit.h  token.c  hash.c  hashmap.c  console.c  tokenizer.c  osstream.c  fs.c  options.c  expressions.c  pre_expressions.c  type.c  object.c  parser.c  visit.c  flow_visit.c  error.c  format_visit.c  tests.c 
Cake 0.7.4

 cake-dad/src/console.h
 cake-dad/src/tokenizer.h
 cake-dad/src/parser.h
 cake-dad/src/error.h
 cake-dad/src/fs.h
 cake-dad/src/hash.h
 cake-dad/src/object.h
 cake-dad/src/hashmap.h
 cake-dad/src/osstream.h
 cake-dad/src/options.h
 cake-dad/src/token.h
 cake-dad/src/type.h
 cake-dad/src/pre_expressions.h
 cake-dad/src/expressions.h
 cake-dad/src/visit.h
 cake-dad/src/format_visit.h
 cake-dad/src/token.c
 cake-dad/src/hash.c
 cake-dad/src/hashmap.c
 cake-dad/src/console.c
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_iflag'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_oflag'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_cflag'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_lflag'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_line'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_cc'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_ispeed'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_ospeed'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_iflag'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_oflag'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_cflag'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_line'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_cc'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_ispeed'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:32:38:  error:  uninitialized object 'newt.c_ospeed'
  32 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &newt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_iflag'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_oflag'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_cflag'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_lflag'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_line'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_cc'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_ispeed'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:38:38:  error:  uninitialized object 'oldt.c_ospeed'
  38 |    tcsetattr(STDIN_FILENO 0 , TCSANOW  0 , &oldt);
     |                                         ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_iflag'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_oflag'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_cflag'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_lflag'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_line'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_cc'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_ispeed'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:56:18:  error:  uninitialized object 'old.c_ospeed'
  56 |    tcgetattr(0, &old);
     |                  ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_iflag'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_oflag'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_cflag'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_line'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_cc'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_ispeed'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:61:27:  error:  uninitialized object 'new.c_ospeed'
  61 |    tcsetattr(0, TCSANOW  0 , &new);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_iflag'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_oflag'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_cflag'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_lflag'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_line'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_cc'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_ispeed'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
  cake-dad/src/console.c:65:27:  error:  uninitialized object 'old.c_ospeed'
  65 |    tcsetattr(0, TCSANOW  0 , &old);
     |                             ^ 
 cake-dad/src/tokenizer.c
  cake-dad/src/tokenizer.c:143:53:  warning:  ' cake-dad/src/tokenizer.c' is uninitialized  [ -Wuninitialized ]
   143 |    /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:143:53:  error:  uninitialized object 'args'
  143 | /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:167:53:  warning:  ' cake-dad/src/tokenizer.c' is uninitialized  [ -Wuninitialized ]
   167 |    /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:167:53:  error:  uninitialized object 'args'
  167 | /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:190:53:  warning:  ' cake-dad/src/tokenizer.c' is uninitialized  [ -Wuninitialized ]
   190 |    /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:190:53:  error:  uninitialized object 'args'
  190 | /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:231:53:  warning:  ' cake-dad/src/tokenizer.c' is uninitialized  [ -Wuninitialized ]
   231 |    /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:231:53:  error:  uninitialized object 'args'
  231 | /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:261:53:  warning:  ' cake-dad/src/tokenizer.c' is uninitialized  [ -Wuninitialized ]
   261 |    /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:261:53:  error:  uninitialized object 'args'
  261 | /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
      |                                                     ^~~~ 
  cake-dad/src/tokenizer.c:3011:50:  warning:  ' cake-dad/src/tokenizer.c' is uninitialized  [ -Wuninitialized ]
   3011 |                   struct token_list r3 = identifier_list(ctx, macro, input_list, level);
       |                                                  ^~~~~ 
  cake-dad/src/tokenizer.c:3011:50:  error:  uninitialized object 'macro'
  3011 |                    struct token_list r3 = identifier_list(ctx, macro, input_list, level);
       |                                                  ^~~~~ 
  cake-dad/src/tokenizer.c:3039:49:  warning:  ' cake-dad/src/tokenizer.c' is uninitiacake: expressions.c:1124: expression_get_object: Assertion `false' failed.
Aborted (core dumped)
thradams commented 8 months ago

(Obs: This must be on Linux only)

mingodad commented 8 months ago

With the latest changes added to https://github.com/mingodad/cake/tree/fix-ubuntu-18:

./cake  -D__x86_64__  -analyze  -I/usr/lib/gcc/x86_64-linux-gnu/11/include/  -I/usr/local/include/  -I/usr/include/x86_64-linux-gnu/  -I/usr/include/  console.h  tokenizer.h  parser.h  error.h  fs.h  hash.h  object.h  hashmap.h  osstream.h  options.h  token.h  type.h  pre_expressions.h  expressions.h  visit.h  format_visit.h  token.c  hash.c  hashmap.c  console.c  tokenizer.c  osstream.c  fs.c  options.c  expressions.c  pre_expressions.c  type.c  object.c  parser.c  visit.c  flow_visit.c  error.c  format_visit.c  tests.c 
Cake 0.7.4

/home/mingo/dev/c/A_programming-languages/cake-dad2/src/console.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/parser.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/error.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/fs.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/hash.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/object.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/hashmap.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/osstream.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/options.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/token.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/type.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/pre_expressions.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/expressions.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/visit.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/format_visit.h
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/token.c
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/hash.c
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/hashmap.c
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/console.c
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:143:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized  [-Wuninitialized]
 143 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:143:53: error: uninitialized object 'args'
 143 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:167:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized  [-Wuninitialized]
 167 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:167:53: error: uninitialized object 'args'
 167 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:190:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized  [-Wuninitialized]
 190 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:190:53: error: uninitialized object 'args'
 190 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:231:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized  [-Wuninitialized]
 231 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:231:53: error: uninitialized object 'args'
 231 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:261:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized  [-Wuninitialized]
 261 |  /*int n =*/ vsnprintf(buffer, sizeof(buffer), fmt, args);
     |                                                    ^~~~
/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:261:53: error: uninitialized object 'args'
 261 |  /*int n =*/ vsnprintf(buffer, cake: expressions.c:1124: expression_get_object: Assertion `false' failed.
Aborted (core dumped)
mingodad commented 8 months ago

Why when trying to fix:

  cake-dad/src/console.c:29:29:  error:  uninitialized object 'oldt.c_iflag'
  29 |    tcgetattr(STDIN_FILENO 0 , &oldt);
     |                              ^ 

with the changes shown bellow it doesn't work ?

#include "ownership.h"

#ifndef WIN32

extern int tcgetattr (int __fd, out struct termios *__termios_p);

bool enable_vt_mode(void)
{
    return true;
}

int c_kbhit(void)
{
    struct termios oldt; // = {0};
    struct termios newt; // = {0};
thradams commented 8 months ago

cake needs to see the declaration with extended qualifier before. for this reason ownership.h must be the first header.

Otherwise I would need (not implemented) to merge declarations adding qualifiers. I think this is something requires for attributes by the way and not implemented yet. The other thing that is not implemented is check declarations against the previous ones to see if they match.

So..I think the problem is you need to put out declaration first.

The out qualifier is not solving the warnings..

The "open problem" is we dont know if the variable has been initialized or not becuase this can be dynamic.


*char *realpath(const char *restrict **path**,*
                      *char *restrict **resolved_path**);*
RETURN VALUE         top
<https://www.man7.org/linux/man-pages/man3/realpath.3.html#top_of_page>

       If there is no error, *realpath*() returns a pointer to the
       *resolved_path*.

       Otherwise, it returns NULL, the contents of the array
       *resolved_path* are undefined, and *errno
<https://www.man7.org/linux/man-pages/man3/errno.3.html>* is set to
indicate the
       error.

So, after calling a function with out parameter we don't know if the object has been initialized or not. Today the only solution is static_set(obj) to override the static state.

On Wed, 21 Feb 2024 at 11:20, Domingo Alvarez Duarte < @.***> wrote:

Why when trying to fix:

cake-dad/src/console.c:29:29: error: uninitialized object 'oldt.c_iflag' 29 | tcgetattr(STDIN_FILENO 0 , &oldt); | ^

with the changes shown bellow it doesn't work ?

include "ownership.h"

ifndef WIN32

extern int tcgetattr (int fd, out struct termios *termios_p);

bool enable_vt_mode(void) { return true; }

int c_kbhit(void) { struct termios oldt; // = {0}; struct termios newt; // = {0};

— Reply to this email directly, view it on GitHub https://github.com/thradams/cake/issues/110#issuecomment-1956757684, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSMZLS47RUUVDQX6AOINITYUX7DHAVCNFSM6AAAAABDSZ26XKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJWG42TONRYGQ . You are receiving this because you commented.Message ID: @.***>

-- www.thradams.com

mingodad commented 8 months ago

I've just added an option to dump the tokens from the tokenizer here https://github.com/mingodad/cake/commit/036ebcebc006a3f8eeb1bccc7399d514dc66c53d and found that it's not a good idea to use -Wno-switch because it throw away the hard work put for the compiler to help us (another segfault):

./cake  -dump-tokens -D__x86_64__  -analyze  -I/usr/lib/gcc/x86_64-linux-gnu/11/include/  -I/usr/local/include/  -I/usr/include/x86_64-linux-gnu/  -I/usr/include/  console.c
Cake 0.7.4

/home/mingo/dev/c/A_programming-languages/cake-dad2/src/console.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0:0    TK_BEGIN_OF_FILE     []                   /home/mingo/dev/c/A_programming-languages/cake-dad2/src/console.c
1:1    TK_PREPROCESSOR_LINE [newline ]           #
1:2    TK_IDENTIFIER        []                   ifdef
1:7    TK_BLANKS            []                    
...
25:5   TK_IDENTIFIER        [space newline ]     struct
25:11  TK_BLANKS            []                    
25:12  TK_IDENTIFIER        [space ]             termios
25:1cake: tokenizer.c:4822: get_token_name: Assertion `false' failed.
Aborted (core dumped)
gcc -g -Wno-multichar   -c -O2 -Wall -MMD -MP -MF "build/Release/GNU-Linux/_ext/511e4115/tokenizer.o.d" -o build/Release/GNU-Linux/_ext/511e4115/tokenizer.o ../src/tokenizer.c
../src/tokenizer.c: In function ‘get_token_name’:
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_PRAGMA’ not handled in switch [-Wswitch]
 4689 |  switch (tk)
      |  ^~~~~~
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_CHAR_CONSTANT’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_ASSERT’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD__OWNER’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD__OUT’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD__OBJ_OWNER’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD__VIEW’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD__OPT’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_ATTR_ADD’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_ATTR_REMOVE’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_ATTR_HAS’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_POINTER’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_LVALUE’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_CONST’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_OWNER’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_ARRAY’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_FUNCTION’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_SCALAR’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_ARITHMETIC’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_FLOATING_POINT’ not handled in switch [-Wswitch]
../src/tokenizer.c:4689:2: warning: enumeration value ‘TK_KEYWORD_IS_INTEGRAL’ not handled in switch [-Wswitch]
../src/tokenizer.c: In function ‘find_and_read_include_file’:
../src/tokenizer.c:336:2: warning: ignoring return value of ‘realpath’, declared with attribute warn_unused_result [-Wunused-result]
  336 |  realpath(newpath, full_path_out);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thradams commented 8 months ago

This is just a Assertion `false' failed.

that can be removed.

On Wed, 21 Feb 2024 at 10:17, Domingo Alvarez Duarte < @.***> wrote:

With the latest changes added to https://github.com/mingodad/cake/tree/fix-ubuntu-18:

./cake -D__x86_64__ -analyze -I/usr/lib/gcc/x86_64-linux-gnu/11/include/ -I/usr/local/include/ -I/usr/include/x86_64-linux-gnu/ -I/usr/include/ console.h tokenizer.h parser.h error.h fs.h hash.h object.h hashmap.h osstream.h options.h token.h type.h pre_expressions.h expressions.h visit.h format_visit.h token.c hash.c hashmap.c console.c tokenizer.c osstream.c fs.c options.c expressions.c pre_expressions.c type.c object.c parser.c visit.c flow_visit.c error.c format_visit.c tests.c Cake 0.7.4

/home/mingo/dev/c/A_programming-languages/cake-dad2/src/console.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/parser.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/error.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/fs.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/hash.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/object.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/hashmap.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/osstream.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/options.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/token.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/type.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/pre_expressions.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/expressions.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/visit.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/format_visit.h /home/mingo/dev/c/A_programming-languages/cake-dad2/src/token.c /home/mingo/dev/c/A_programming-languages/cake-dad2/src/hash.c /home/mingo/dev/c/A_programming-languages/cake-dad2/src/hashmap.c /home/mingo/dev/c/A_programming-languages/cake-dad2/src/console.c /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:143:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized [-Wuninitialized] 143 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:143:53: error: uninitialized object 'args' 143 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:167:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized [-Wuninitialized] 167 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:167:53: error: uninitialized object 'args' 167 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:190:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized [-Wuninitialized] 190 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:190:53: error: uninitialized object 'args' 190 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:231:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized [-Wuninitialized] 231 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:231:53: error: uninitialized object 'args' 231 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:261:53: warning: '/home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c' is uninitialized [-Wuninitialized] 261 | /int n =/ vsnprintf(buffer, sizeof(buffer), fmt, args); | ^~~~ /home/mingo/dev/c/A_programming-languages/cake-dad2/src/tokenizer.c:261:53: error: uninitialized object 'args' 261 | /int n =/ vsnprintf(buffer, cake: expressions.c:1124: expression_get_object: Assertion `false' failed. Aborted (core dumped)

— Reply to this email directly, view it on GitHub https://github.com/thradams/cake/issues/110#issuecomment-1956631915, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSMZLQYMYTX5O24FSWCUM3YUXXXLAVCNFSM6AAAAABDSZ26XKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJWGYZTCOJRGU . You are receiving this because you commented.Message ID: @.***>

-- www.thradams.com

mingodad commented 8 months ago

Thank you for reply !

This is just a Assertion `false' failed. that can be removed.

And the missing entries need to be added too !

mingodad commented 8 months ago

Sorry ! I mean the assertion can remain there, the missing entries need be added.

thradams commented 8 months ago

print tokens were very useful when implementing the preprocessor. They are also useful to check the C backend output. I think there is a function that prints html.

(by the way... The idea of the C backend output is hide and add tokens never delete tokens - the reason is avoiding dangling pointers. To debug the ouput it is also interesting print tokens including hidden ones)

On Wed, 21 Feb 2024 at 13:41, Domingo Alvarez Duarte < @.***> wrote:

Thank you for reply !

This is just a Assertion `false' failed. that can be removed.

And the missing entries need to be added too !

— Reply to this email directly, view it on GitHub https://github.com/thradams/cake/issues/110#issuecomment-1957246312, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSMZLXDU2NU6NOWQO66DJDYUYPTRAVCNFSM6AAAAABDSZ26XKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXGI2DMMZRGI . You are receiving this because you commented.Message ID: @.***>

-- www.thradams.com

mingodad commented 8 months ago

I've added several missing token names but still there is more to be done, mainly because the tokenizer is using the char literals as token.type (see here https://github.com/mingodad/cake/commit/91ee639bdb7feb7686d5389807a4e6519b597f9a).

mingodad commented 8 months ago

Using gdb I've got the point where it fails: Analyzing this part of expressions.c:

double constant_value_to_double(const struct constant_value* a)
{
    switch (a->type)
    {
        case TYPE_LONG_LONG: return (double) a->llvalue; ///!!!!! expression_get_object `a->`
        case TYPE_DOUBLE: return  a->dvalue;
        case TYPE_UNSIGNED_LONG_LONG: return (double) a->ullvalue;
        default:
            return 0;
    }

    return 0;
}

Executing this piece of code:

    else if (p_expression->expression_type == POSTFIX_ARROW)
    {
        struct object* p_obj = expression_get_object(p_expression->left, NULL);
        if (p_obj &&
            p_obj->pointed)
        {
            if (p_type)
                type_set(p_type, &p_expression->type);
            if (p_expression->member_index < p_obj->pointed->members.size) ///!!! see values bellow
                return &p_obj->pointed->members.data[p_expression->member_index];
            else
            {
                fflush(stdout);fflush(stderr);
                assert(false);
            }
        }
    }
p_expression  {expression_type = POSTFIX_ARROW, type = {category = TYPE_CATEGORY_ITSELF, attributes_flags = STD_ATTRIBUTE_NONE, type_specifier_flags = TYPE_SPECIFIER_LONG_LONG, type_qualifier_flags = TYPE_QUALIFIER_CONST, storage_class_specifier_flags = STORAGE_SPECIFIER_NONE, name_opt = 0x555556c49450 \"llvalue\", struct_or_union_specifier = 0x0, enum_specifier = 0x0, array_size = 0, static_array = false, address_of = false, params = {is_var_args = false, is_void = false, head = 0x0, tail = 0x0}, next = 0x0}, constant_value = {type = TYPE_NOT_CONSTANT, {ullvalue = 0, llvalue = 0, dvalue = 0}}, type_name = 0x0, type_name2 = 0x0, braced_initializer = 0x0, compound_statement = 0x0, generic_selection = 0x0, first_token = 0x5555557c1af0, last_token = 0x5555557c1b60, contract_arg_token = 0x0, declarator = 0x0, member_index = 2, argument_expression_list = {head = 0x0, tail = 0x0}, condition_expr = 0x0, left = 0x555556c49210, right = 0x0}

p_obj  {expression_type = POSTFIX_ARROW, type = {category = TYPE_CATEGORY_ITSELF, attributes_flags = STD_ATTRIBUTE_NONE, type_specifier_flags = TYPE_SPECIFIER_LONG_LONG, type_qualifier_flags = TYPE_QUALIFIER_CONST, storage_class_specifier_flags = STORAGE_SPECIFIER_NONE, name_opt = 0x555556c49450 \"llvalue\", struct_or_union_specifier = 0x0, enum_specifier = 0x0, array_size = 0, static_array = false, address_of = false, params = {is_var_args = false, is_void = false, head = 0x0, tail = 0x0}, next = 0x0}, constant_value = {type = TYPE_NOT_CONSTANT, {ullvalue = 0, llvalue = 0, dvalue = 0}}, type_name = 0x0, type_name2 = 0x0, braced_initializer = 0x0, compound_statement = 0x0, generic_selection = 0x0, first_token = 0x5555557c1af0, last_token = 0x5555557c1b60, contract_arg_token = 0x0, declarator = 0x0, member_index = 2, argument_expression_list = {head = 0x0, tail = 0x0}, condition_expr = 0x0, left = 0x555556c49210, right = 0x0}
mingodad commented 8 months ago

The backtrace:

#0  0x00007ffff7a20e87 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7a227f1 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff7a123fa in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff7a12472 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00005555555589ed in expression_get_object (p_expression=0x555556c49360, p_type=0x0) at ../src/expressions.c:1135
#5  0x0000555555558866 in expression_get_object (p_expression=0x555556c48f20, p_type=0x7fffffff9440) at ../src/expressions.c:1105
#6  0x0000555555563aa3 in flow_visit_jump_statement (ctx=0x7fffffff9720, p_jump_statement=0x555556c48ef0) at ../src/flow_visit.c:1917
#7  0x0000555555563e14 in flow_visit_unlabeled_statement (ctx=0x7fffffff9720, p_unlabeled_statement=0x555556c48ed0) at ../src/flow_visit.c:2018
#8  0x0000555555563f13 in flow_visit_block_item (ctx=0x7fffffff9720, p_block_item=0x555556c48ea0) at ../src/flow_visit.c:2054
#9  0x0000555555561e8a in flow_visit_switch_statement (ctx=0x7fffffff9720, p_selection_statement=0x555556c48950) at ../src/flow_visit.c:974
#10 0x0000555555561f9e in flow_visit_selection_statement (ctx=0x7fffffff9720, p_selection_statement=0x555556c48950) at ../src/flow_visit.c:1019
#11 0x0000555555563d61 in flow_visit_primary_block (ctx=0x7fffffff9720, p_primary_block=0x555556c48920) at ../src/flow_visit.c:1996
#12 0x0000555555563dca in flow_visit_unlabeled_statement (ctx=0x7fffffff9720, p_unlabeled_statement=0x555556c48900) at ../src/flow_visit.c:2010
#13 0x0000555555563f13 in flow_visit_block_item (ctx=0x7fffffff9720, p_block_item=0x555556c488d0) at ../src/flow_visit.c:2054
#14 0x0000555555563f6c in flow_visit_block_item_list (ctx=0x7fffffff9720, p_block_item_list=0x555556c488b0) at ../src/flow_visit.c:2068
#15 0x00005555555634dd in flow_visit_compound_statement (ctx=0x7fffffff9720, p_compound_statement=0x555556c488a0) at ../src/flow_visit.c:1709
#16 0x000055555556550e in flow_visit_declaration (ctx=0x7fffffff9720, p_declaration=0x555556c46b80) at ../src/flow_visit.c:2754
#17 0x00005555555655df in flow_visit_function (ctx=0x7fffffff9720, p_declaration=0x555556c46b80) at ../src/flow_visit.c:2776
#18 0x0000555555572165 in function_definition_or_declaration (ctx=0x7fffffff9aa0) at ../src/parser.c:2230
#19 0x000055555557a789 in external_declaration (ctx=0x7fffffff9aa0) at ../src/parser.c:6399
#20 0x000055555557a731 in translation_unit (ctx=0x7fffffff9aa0) at ../src/parser.c:6387
#21 0x000055555557aa22 in parse (ctx=0x7fffffff9aa0, list=0x7fffffff98d0) at ../src/parser.c:6477
#22 0x000055555557b4bc in compile_one_file (file_name=0x7fffffffd000 \"/home/mingo/dev/c/A_programming-languages/cake-dad/src/expressions.c\", options=0x7fffffff9ef0, out_file_name=0x7fffffffb000 \"/home/mingo/dev/c/A_programming-languages/cake-dad/src/out/expressions.c\", argc=3, argv=0x7fffffffe148, report=0x7fffffffe030) at ../src/parser.c:6759
#23 0x000055555557bf05 in compile (argc=3, argv=0x7fffffffe148, report=0x7fffffffe030) at ../src/parser.c:6990
#24 0x0000555555567528 in main (argc=3, argv=0x7fffffffe148) at ../src/main.c:58
mingodad commented 8 months ago

Here is the command line:

gdb --args ./cake -analyze  expressions.c
GNU gdb (Ubuntu 10.2-0ubuntu1~18.04~2) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./cake...
(gdb) r
Starting program: /home/mingo/dev/c/A_programming-languages/cake-dad2/src/cake -analyze expressions.c
Cake 0.7.4

/home/mingo/dev/c/A_programming-languages/cake-dad2/src/expressions.c
cake: expressions.c:1135: expression_get_object: Assertion `false' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff7a227f1 in __GI_abort () at abort.c:79
#2  0x00007ffff7a123fa in __assert_fail_base (fmt=0x7ffff7b996c0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x5555555836fe "false", file=file@entry=0x555555586ab1 "expressions.c", 
    line=line@entry=1135, function=function@entry=0x5555555877b0 <__PRETTY_FUNCTION__.5679> "expression_get_object")
    at assert.c:92
#3  0x00007ffff7a12472 in __GI___assert_fail (assertion=assertion@entry=0x5555555836fe "false", 
    file=file@entry=0x555555586ab1 "expressions.c", line=line@entry=1135, 
    function=function@entry=0x5555555877b0 <__PRETTY_FUNCTION__.5679> "expression_get_object") at assert.c:101
#4  0x00005555555622d9 in expression_get_object (p_expression=<optimized out>, p_type=p_type@entry=0x7fffffff6c50)
    at expressions.c:1135
#5  0x0000555555581abd in flow_visit_jump_statement (p_jump_statement=<optimized out>, ctx=0x7fffffff6f00)
    at flow_visit.c:1917
#6  flow_visit_unlabeled_statement (ctx=0x7fffffff6f00, p_unlabeled_statement=<optimized out>) at flow_visit.c:2018
#7  0x0000555555581ce0 in flow_visit_block_item (p_block_item=<optimized out>, p_block_item=<optimized out>, 
    ctx=0x7fffffff6f00) at flow_visit.c:2054
#8  flow_visit_block_item (p_block_item=0x555556c363f0, p_block_item=0x555556c363f0, ctx=0x7fffffff6f00)
    at flow_visit.c:2045
#9  flow_visit_switch_statement (p_selection_statement=<optimized out>, p_selection_statement=<optimized out>, 
    ctx=0x7fffffff6f00) at flow_visit.c:974
#10 flow_visit_selection_statement (p_selection_statement=<optimized out>, ctx=0x7fffffff6f00) at flow_visit.c:1019
#11 flow_visit_primary_block (p_primary_block=<optimized out>, ctx=0x7fffffff6f00) at flow_visit.c:1996
#12 flow_visit_unlabeled_statement (ctx=0x7fffffff6f00, p_unlabeled_statement=<optimized out>) at flow_visit.c:2010
#13 0x0000555555580923 in flow_visit_block_item (p_block_item=<optimized out>, p_block_item=<optimized out>, 
    ctx=0x7fffffff6f00) at flow_visit.c:2054
#14 flow_visit_block_item (p_block_item=0x555556c35e20, p_block_item=0x555556c35e20, ctx=0x7fffffff6f00)
--Type <RET> for more, q to quit, c to continue without paging--
mingodad commented 8 months ago

And here is the output of valgrind:

valgrind ./cake -analyze  expressions.c
==10320== Memcheck, a memory error detector
==10320== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==10320== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==10320== Command: ./cake -analyze expressions.c
==10320== 
Cake 0.7.4

/home/mingo/dev/c/A_programming-languages/cake-dad2/src/expressions.c
cake: expressions.c:1135: expression_get_object: Assertion `false' failed.
==10320== 
==10320== Process terminating with default action of signal 6 (SIGABRT)
==10320==    at 0x4E81E87: raise (raise.c:51)
==10320==    by 0x4E837F0: abort (abort.c:79)
==10320==    by 0x4E733F9: __assert_fail_base (assert.c:92)
==10320==    by 0x4E73471: __assert_fail (assert.c:101)
==10320==    by 0x1162D8: expression_get_object (expressions.c:1135)
==10320==    by 0x135ABC: flow_visit_jump_statement (flow_visit.c:1917)
==10320==    by 0x135ABC: flow_visit_unlabeled_statement (flow_visit.c:2018)
==10320==    by 0x135CDF: flow_visit_block_item (flow_visit.c:2054)
==10320==    by 0x135CDF: flow_visit_block_item (flow_visit.c:2045)
==10320==    by 0x135CDF: flow_visit_switch_statement (flow_visit.c:974)
==10320==    by 0x135CDF: flow_visit_selection_statement (flow_visit.c:1019)
==10320==    by 0x135CDF: flow_visit_primary_block (flow_visit.c:1996)
==10320==    by 0x135CDF: flow_visit_unlabeled_statement (flow_visit.c:2010)
==10320==    by 0x134922: flow_visit_block_item (flow_visit.c:2054)
==10320==    by 0x134922: flow_visit_block_item (flow_visit.c:2045)
==10320==    by 0x134922: flow_visit_block_item_list (flow_visit.c:2068)
==10320==    by 0x134922: flow_visit_compound_statement (flow_visit.c:1709)
==10320==    by 0x134501: flow_visit_declaration (flow_visit.c:2754)
==10320==    by 0x1365D4: flow_visit_function (flow_visit.c:2776)
==10320==    by 0x12DC2D: function_definition_or_declaration (parser.c:2230)
==10320==    by 0x12DD39: external_declaration (parser.c:6399)
==10320==    by 0x12DD39: translation_unit (parser.c:6387)
==10320== 
==10320== HEAP SUMMARY:
==10320==     in use at exit: 14,240,862 bytes in 365,436 blocks
==10320==   total heap usage: 383,993 allocs, 18,557 frees, 16,494,188 bytes allocated
==10320== 
==10320== LEAK SUMMARY:
==10320==    definitely lost: 0 bytes in 0 blocks
==10320==    indirectly lost: 0 bytes in 0 blocks
==10320==      possibly lost: 0 bytes in 0 blocks
==10320==    still reachable: 14,240,862 bytes in 365,436 blocks
==10320==         suppressed: 0 bytes in 0 blocks
==10320== Rerun with --leak-check=full to see details of leaked memory
==10320== 
==10320== For lists of detected and suppressed errors, rerun with: -s
==10320== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Aborted (core dumped)
mingodad commented 8 months ago

Nice work with the latest changes it doesn't segfault anymore and show several places that need fixes.