[Gambas-devel] Compiling gambas using clang-analyzer

Jussi Lahtinen jussi.lahtinen at ...176...
Tue Aug 14 20:56:11 CEST 2012


As I understand at least this is false positive (wrong assumption):

CTIMER *timer; 51
52 timer = OBJECT_create_native(CLASS_Timer, NULL); 53 OBJECT_REF(timer,
"CTIMER_every"){ if (timer) ((OBJECT *)(timer))->ref++; };
1
Within the expansion of the macro 'OBJECT_REF':
a
Assuming 'timer' is null
 54 timer->callback = callback;
2
Access to field 'callback' results in a dereference of a null pointer
(loaded from variable 'timer')


But anyway this code analyzer looks very promising.

Jussi




On 14 August 2012 21:45, Sebastian Kulesz <sebikul at ...176...> wrote:

> On Tue, Aug 14, 2012 at 3:39 PM, Benoît Minisini
> <gambas at ...1...> wrote:
> > Le 14/08/2012 20:32, Sebastian Kulesz a écrit :
> >> 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!!
> >>
> >
> > Interesting. Can you provide the full output of all warnings?
> >
> > --
> > Benoît Minisini
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-devel mailing list
> > Gambas-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-devel
>
> Sure!
>
> I removed the "Analyzer Failures" to trim the filesize. Open the
> index.html, you will find your way. This is only from the
> main/component. If you need others let me know
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20120814/63fb5672/attachment.html>


More information about the Devel mailing list