This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mudflap problem


Hi -


[adding cc: gcc mailing list]

On Fri, Jan 28, 2005 at 01:31:59PM -0500, Chris Scott wrote:
> We've been doing some testing with mudflap. For some reason, mudflap 
> does not detect an overflow here, but the sourceforge bounds checker does:
> 
> int a[1024];
> int b[1024];
> 
> [...]
>        int *i;
>        for (i = &b[0]  ; i < &a[1024] ; i++) {
>              *i = 0;
> [...]
> How come mudflap does not catch this [when sourceforge bounds checker
> does]?

That is because mudflap works differently.  It only checks that each
individual pointer dereference points to a valid object: which for
each value of i in this particular case, it does.  It does not
track the fact that i was originally assigned from &b[0].

A straightforward improvement to mudflap would be to emit padding
between adjacent static (or even auto) objects, and mark those
regions as unaccessible.  Then such simple iteration patterns would
be caught.


- FChE

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]