public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* c/c++ validator
@ 2005-06-18 22:24 Tommy Vercetti
  2005-06-18 22:32 ` Mathieu Malaterre
  2005-06-19  3:04 ` Mark Loeser
  0 siblings, 2 replies; 14+ messages in thread
From: Tommy Vercetti @ 2005-06-18 22:24 UTC (permalink / raw)
  To: gcc

Hi folks

I would like to ask you about source validation software. Software that runs 
trough source code, and attempts to find any possible memory leaks, and other 
problems. Is there anything opensource for C or/and C++ out there ?

I know it's the wrong list to ask for it, but that's quite close to compilers, 
and some of you may know about it.

Thanks.

-- 
Vercetti

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-18 22:24 c/c++ validator Tommy Vercetti
@ 2005-06-18 22:32 ` Mathieu Malaterre
  2005-06-18 22:38   ` Tommy Vercetti
  2005-06-19  3:04 ` Mark Loeser
  1 sibling, 1 reply; 14+ messages in thread
From: Mathieu Malaterre @ 2005-06-18 22:32 UTC (permalink / raw)
  To: Tommy Vercetti; +Cc: gcc

Something like:

http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html

HTH
Mathieu

Tommy Vercetti wrote:
> Hi folks
> 
> I would like to ask you about source validation software. Software that runs 
> trough source code, and attempts to find any possible memory leaks, and other 
> problems. Is there anything opensource for C or/and C++ out there ?
> 
> I know it's the wrong list to ask for it, but that's quite close to compilers, 
> and some of you may know about it.
> 
> Thanks.
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-18 22:32 ` Mathieu Malaterre
@ 2005-06-18 22:38   ` Tommy Vercetti
  2005-06-19  1:03     ` Gabriel Dos Reis
  0 siblings, 1 reply; 14+ messages in thread
From: Tommy Vercetti @ 2005-06-18 22:38 UTC (permalink / raw)
  To: gcc

On Sunday 19 June 2005 00:32, you wrote:
> Something like:
>
> http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html

Yeah, but for more than just STL, and opensource. C++ checker that is going to 
work for instance for KDE.
 Wonder why they use proprietary parser, there are opensource parsers around, 
like elsa, or gcc c++ parser.

> HTH
> Mathieu
>
> Tommy Vercetti wrote:
> > Hi folks
> >
> > I would like to ask you about source validation software. Software that
> > runs trough source code, and attempts to find any possible memory leaks,
> > and other problems. Is there anything opensource for C or/and C++ out
> > there ?
> >
> > I know it's the wrong list to ask for it, but that's quite close to
> > compilers, and some of you may know about it.
> >
> > Thanks.

-- 
Vercetti

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-18 22:38   ` Tommy Vercetti
@ 2005-06-19  1:03     ` Gabriel Dos Reis
  2005-06-19  1:44       ` Tommy Vercetti
  0 siblings, 1 reply; 14+ messages in thread
From: Gabriel Dos Reis @ 2005-06-19  1:03 UTC (permalink / raw)
  To: Tommy Vercetti; +Cc: gcc

Tommy Vercetti <vercetti@zlew.org> writes:

| On Sunday 19 June 2005 00:32, you wrote:
| > Something like:
| >
| > http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html
| 
| Yeah, but for more than just STL, and opensource. C++ checker that
| is going to work for instance for KDE.
|  Wonder why they use proprietary parser,

maybe because they work? ;-p

| there are opensource
| parsers around,  like elsa, or gcc c++ parser.

Elsa does not parse C++.  

GCC/g++ parser is tightly integrated to GCC.

Most of the tools I know of are either "research projects" (which
means that they basically "die" when the professor get promoted or the
students graduate; they are lots of them out there) or are/ use
proprietary tools. 

We need to get GCC/g++ to a competing level of usefulness but the road
is not quite that straight.

-- Gaby

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-19  1:03     ` Gabriel Dos Reis
@ 2005-06-19  1:44       ` Tommy Vercetti
  2005-06-19  2:05         ` Gabriel Dos Reis
  0 siblings, 1 reply; 14+ messages in thread
From: Tommy Vercetti @ 2005-06-19  1:44 UTC (permalink / raw)
  To: gcc

On Sunday 19 June 2005 03:03, you wrote:
> Tommy Vercetti <vercetti@zlew.org> writes:
> | On Sunday 19 June 2005 00:32, you wrote:
> | > Something like:
> | >
> | > http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html
> |
> | Yeah, but for more than just STL, and opensource. C++ checker that
> | is going to work for instance for KDE.
> |  Wonder why they use proprietary parser,
>
> maybe because they work? ;-p

> | there are opensource
> | parsers around,  like elsa, or gcc c++ parser.
>
> Elsa does not parse C++.
Elsa is for C/C++, so it says on their website.

> GCC/g++ parser is tightly integrated to GCC.
>
> Most of the tools I know of are either "research projects" (which
> means that they basically "die" when the professor get promoted or the
> students graduate; they are lots of them out there) or are/ use
> proprietary tools.
>
> We need to get GCC/g++ to a competing level of usefulness but the road
> is not quite that straight.

Yep.

Btw, don't have to cc me, I'm reading that list.

-- 
Vercetti

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-19  1:44       ` Tommy Vercetti
@ 2005-06-19  2:05         ` Gabriel Dos Reis
  2005-06-19  2:16           ` Mathieu Malaterre
  0 siblings, 1 reply; 14+ messages in thread
From: Gabriel Dos Reis @ 2005-06-19  2:05 UTC (permalink / raw)
  To: Tommy Vercetti; +Cc: gcc

Tommy Vercetti <vercetti@zlew.org> writes:

| On Sunday 19 June 2005 03:03, you wrote:
| > Tommy Vercetti <vercetti@zlew.org> writes:
| > | On Sunday 19 June 2005 00:32, you wrote:
| > | > Something like:
| > | >
| > | > http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html
| > |
| > | Yeah, but for more than just STL, and opensource. C++ checker that
| > | is going to work for instance for KDE.
| > |  Wonder why they use proprietary parser,
| >
| > maybe because they work? ;-p
| 
| > | there are opensource
| > | parsers around,  like elsa, or gcc c++ parser.
| >
| > Elsa does not parse C++.
| Elsa is for C/C++, so it says on their website.

I know what the website says.  My comment was about the actual *uses*
of the parser.  Have you tried it on actual C++ programs? 

-- Gaby

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-19  2:05         ` Gabriel Dos Reis
@ 2005-06-19  2:16           ` Mathieu Malaterre
  2005-06-19  2:48             ` Gabriel Dos Reis
  0 siblings, 1 reply; 14+ messages in thread
From: Mathieu Malaterre @ 2005-06-19  2:16 UTC (permalink / raw)
  To: gcc

Gabriel Dos Reis wrote:
> Tommy Vercetti <vercetti@zlew.org> writes:
> 
> | On Sunday 19 June 2005 03:03, you wrote:
> | > Tommy Vercetti <vercetti@zlew.org> writes:
> | > | On Sunday 19 June 2005 00:32, you wrote:
> | > | > Something like:
> | > | >
> | > | > http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html
> | > |
> | > | Yeah, but for more than just STL, and opensource. C++ checker that
> | > | is going to work for instance for KDE.
> | > |  Wonder why they use proprietary parser,
> | >
> | > maybe because they work? ;-p
> | 
> | > | there are opensource
> | > | parsers around,  like elsa, or gcc c++ parser.
> | >
> | > Elsa does not parse C++.
> | Elsa is for C/C++, so it says on their website.
> 
> I know what the website says.  My comment was about the actual *uses*
> of the parser.  Have you tried it on actual C++ programs? 

How about gccxml:

http://www.gccxml.org

Mathieu

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-19  2:16           ` Mathieu Malaterre
@ 2005-06-19  2:48             ` Gabriel Dos Reis
  2005-06-19 20:58               ` Tommy Vercetti
  0 siblings, 1 reply; 14+ messages in thread
From: Gabriel Dos Reis @ 2005-06-19  2:48 UTC (permalink / raw)
  To: Mathieu Malaterre; +Cc: gcc

Mathieu Malaterre <mmalater@nycap.rr.com> writes:

| Gabriel Dos Reis wrote:
| > Tommy Vercetti <vercetti@zlew.org> writes:
| > | On Sunday 19 June 2005 03:03, you wrote:
| > | > Tommy Vercetti <vercetti@zlew.org> writes:
| > | > | On Sunday 19 June 2005 00:32, you wrote:
| > | > | > Something like:
| > | > | >
| > | > | > http://www.cs.rpi.edu/~gregod/STLlint/STLlint.html
| > | > |
| > | > | Yeah, but for more than just STL, and opensource. C++ checker that
| > | > | is going to work for instance for KDE.
| > | > |  Wonder why they use proprietary parser,
| > | >
| > | > maybe because they work? ;-p
| > | | > | there are opensource
| > | > | parsers around,  like elsa, or gcc c++ parser.
| > | >
| > | > Elsa does not parse C++.
| > | Elsa is for C/C++, so it says on their website.
| > I know what the website says.  My comment was about the actual *uses*
| > of the parser.  Have you tried it on actual C++ programs?
| 
| How about gccxml:
| 
| http://www.gccxml.org

It is a not C++ parser :-) -- if you're interested in function bodies
and other more fundamental things, you lose.  It suffers from the same
problems (at least ones we've found quite annoying) of using GCC
currently:  too much of low-level stuff directly geared to code 
generation as understood by GCC now, and C++ programs are not
represented at the most abstract level (contrast that with a
celebrated C++ front-end on the market).  And it also shares problems
with Elsa, no real support for templates (although the case of Elsa is
slightly "worse" :-)).  Now, if you're just interested in simple
"toplevel" decls, then that might be fine :-) 

-- Gaby

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-18 22:24 c/c++ validator Tommy Vercetti
  2005-06-18 22:32 ` Mathieu Malaterre
@ 2005-06-19  3:04 ` Mark Loeser
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Loeser @ 2005-06-19  3:04 UTC (permalink / raw)
  To: Tommy Vercetti; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

Tommy Vercetti wrote:
> Hi folks
> 
> I would like to ask you about source validation software. Software that runs 
> trough source code, and attempts to find any possible memory leaks, and other 
> problems. Is there anything opensource for C or/and C++ out there ?

My summer research project that I'm working on is very closely related
to this.  Its a static analysis tool that looks for problems like buffer
overflows, unitialized variables, and division by zero.  Unfortunately
its not yet open sourced (probably because its still really really
beta), but I'm trying to talk to my advisor to see if he'd let me
continue working on it on my own and open source it, or if he is going
to release it at some point.

If you are interested, email me back off list and I'll talk to my advisor.

Mark Loeser

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-19  2:48             ` Gabriel Dos Reis
@ 2005-06-19 20:58               ` Tommy Vercetti
  2005-06-20 19:53                 ` Kai Henningsen
  0 siblings, 1 reply; 14+ messages in thread
From: Tommy Vercetti @ 2005-06-19 20:58 UTC (permalink / raw)
  To: gcc

On Sunday 19 June 2005 04:48, Gabriel Dos Reis wrote:
> Mathieu Malaterre <mmalater@nycap.rr.com> writes:
> | Gabriel Dos Reis wrote:
> | > Tommy Vercetti <vercetti@zlew.org> writes:
> | > | On Sunday 19 June 2005 03:03, you wrote:
> | > | > Elsa does not parse C++.
> | > |
> | > | Elsa is for C/C++, so it says on their website.
> | >
> | > I know what the website says.  My comment was about the actual *uses*
> | > of the parser.  Have you tried it on actual C++ programs?

They claim it does compile qt, and they work on making it compile KDE. That's 
enough for me. 
On free software "market" there is lack of good static checker/validator of 
c++ code. 
I was looking on different ones, for C, that claimed to have ability to find 
security problems. One that I found the best, is splint. But it's still not 
able to find such obvious problem:

char a[10];
for( unsigned int i; i< 100 ; i++ ) {
	a[i]=a[i]+1;
}

Even thou, it analyzes buffers, and other stuff. So...
Plus it can't do that for c++. 
It shouldn't be so hard, if they have code that gathers so much information 
already, and can find infinite loops, even not easy cases..

Elsa parses c++ code well enough for me, to at least try to write some code 
that will do something like that. Elsa thou has one potential problem, it's 
on bsd licence. Licence issues sux. 
You can't take some code from splint, and stick it into bsd code. I guess, but 
I maybe wrong. I don't even think that it will work from design point of 
view.

> | How about gccxml:
> |
> | http://www.gccxml.org
>
> It is a not C++ parser :-) -- if you're interested in function bodies
> and other more fundamental things, you lose.  It suffers from the same
> problems (at least ones we've found quite annoying) of using GCC
> currently:  too much of low-level stuff directly geared to code
> generation as understood by GCC now, and C++ programs are not
> represented at the most abstract level (contrast that with a
> celebrated C++ front-end on the market).  And it also shares problems
> with Elsa, no real support for templates (although the case of Elsa is
> slightly "worse" :-)).  Now, if you're just interested in simple
> "toplevel" decls, then that might be fine :-)

gccxml parser is a good idea maybe, but I don't think it's good for what I am 
looking for.

-- 
Vercetti

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-19 20:58               ` Tommy Vercetti
@ 2005-06-20 19:53                 ` Kai Henningsen
  2005-06-20 20:58                   ` Tommy Vercetti
  0 siblings, 1 reply; 14+ messages in thread
From: Kai Henningsen @ 2005-06-20 19:53 UTC (permalink / raw)
  To: gcc

vercetti@zlew.org (Tommy Vercetti)  wrote on 19.06.05 in <200506192258.00250@gj-laptop>:

> I was looking on different ones, for C, that claimed to have ability to find
> security problems. One that I found the best, is splint. But it's still not
> able to find such obvious problem:

Did you look at sparse? That seems to do quite a useful job on the Linux  
kernel (which is, of course, the main reason for its existence). I don't  
really have an idea how good it would be on non-kernel C code. (Not C++,  
obviously.)

MfG Kai

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
  2005-06-20 19:53                 ` Kai Henningsen
@ 2005-06-20 20:58                   ` Tommy Vercetti
  0 siblings, 0 replies; 14+ messages in thread
From: Tommy Vercetti @ 2005-06-20 20:58 UTC (permalink / raw)
  To: gcc

On Monday 20 June 2005 10:12, Kai Henningsen wrote:
> vercetti@zlew.org (Tommy Vercetti)  wrote on 19.06.05 in 
<200506192258.00250@gj-laptop>:
> > I was looking on different ones, for C, that claimed to have ability to
> > find security problems. One that I found the best, is splint. But it's
> > still not able to find such obvious problem:
>
> Did you look at sparse? That seems to do quite a useful job on the Linux
> kernel (which is, of course, the main reason for its existence). I don't
> really have an idea how good it would be on non-kernel C code. (Not C++,
> obviously.)
sparse is fairly primitive. So far splint does the job, almost. And only for 
C :/

-- 
Vercetti

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
@ 2005-06-19 23:59 David Bremner
  0 siblings, 0 replies; 14+ messages in thread
From: David Bremner @ 2005-06-19 23:59 UTC (permalink / raw)
  To: gcc

I complied this list for the local C++ users group several months ago, 
it might be helpful.
http://www.nwcpp.org/Misc/Tools_DavidBremner.html

Regards,
David Bremner

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: c/c++ validator
@ 2005-06-19  2:41 Florian Krohm
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Krohm @ 2005-06-19  2:41 UTC (permalink / raw)
  To: gdr; +Cc: vercetti, gcc

> Tommy Vercetti <vercetti@zlew.org> writes:
> 
> | Yeah, but for more than just STL, and opensource. C++ checker that
> | is going to work for instance for KDE.
> |  Wonder why they use proprietary parser,
> 

Gabriel Dos Reis wrote:

> Most of the tools I know of are either "research projects" (which
> means that they basically "die" when the professor get promoted or the
> students graduate; they are lots of them out there) or are/ use
> proprietary tools. 
> 
> We need to get GCC/g++ to a competing level of usefulness but the road
> is not quite that straight.
> 

Yes, twice. Among the things that you need are:

- detailled source code correspondence for every TREE node,
- you want to know whether a TREE node represents something that was
  compiler generated as opposed to written in the source (e.g. for
  cast operations)
- you most likely want an unlowered representation of the C++ source
  (and that will be the real hard part)
- you don't want the frontend to optimize anything, e.g no folding
  (ideally you want both the folded and unfolded expression)
- you might want to know whether a certain TREE node was the result of
  a macro expansion

I used a very old version of GCC (3.0.1) as the frontend for some 
static checker. We succeeded in hacking in support for some of the
above but C++ was a royal pain because of lowering. 

Florian

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-06-20 20:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-18 22:24 c/c++ validator Tommy Vercetti
2005-06-18 22:32 ` Mathieu Malaterre
2005-06-18 22:38   ` Tommy Vercetti
2005-06-19  1:03     ` Gabriel Dos Reis
2005-06-19  1:44       ` Tommy Vercetti
2005-06-19  2:05         ` Gabriel Dos Reis
2005-06-19  2:16           ` Mathieu Malaterre
2005-06-19  2:48             ` Gabriel Dos Reis
2005-06-19 20:58               ` Tommy Vercetti
2005-06-20 19:53                 ` Kai Henningsen
2005-06-20 20:58                   ` Tommy Vercetti
2005-06-19  3:04 ` Mark Loeser
2005-06-19  2:41 Florian Krohm
2005-06-19 23:59 David Bremner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).