[Gambas-devel] Compiling gambas using clang-analyzer

Sebastian Kulesz sebikul at ...176...
Tue Aug 14 20:32:51 CEST 2012


Hi! I would first want to note that i'm not a C/C++ developer,
although i can easily read the code, so some of the following bugs may
be a misunderstanding.

I had the crazy idea of compiling gambas (rev 5042) using
clang-analyzer [0] to see if it could finds some bugs, and here are
some of them (as stated before, some may be invalid)

---
File: main/gbc/gbc_read.c

Line: 481, 544, 575
Code: car = next_char();
Message: Value stored to 'car' is never read

Line: 1073
Code: after -= n;
Message: Value stored to 'after' is never read

---

File: main/gbc/gbc_output.c

Line: 1070
Code: sym = (SYMBOL *)TABLE_get_symbol(Class->table, func->name);
Message: Value stored to 'sym' is never read

Line: 1087
Code: param = &func->local[j];
Message: Value stored to 'param' is never read

---

File: main/gbx /gbx_watch.c
Line: 364
Code: pos = ARRAY_count(watch_callback);
Message: Value stored to 'pos' is never read

Note that this only applies if DEBUG_WATCH is set

---

File: gb.jit/jit_runtime.c
Line: 524, 518, 430
Value stored to 'variant' is never read

Line: 438
Value stored to 'type' is never read

Line: 844
Value stored to 'val' during its initialization is never read

Line: 430
Value stored to 'result' during its initialization is never read

---

There are also a lot of "Dereference of null pointer" bugs but i
really don't know what they are ;)

If these are valid bugs (and are worth fixing), please let me know so
i do a project-wide report. There are a lot of entries on the report,
and it has only been run on some of the components! Here are some
quick stats:

gb.gtk: 18 bugs
gb.xml: 4 bugs
main: 29 bugs
gb.jit: 12 bugs

I really hope this helps!!

[0] http://clang-analyzer.llvm.org/




More information about the Devel mailing list