Subject: Re: Building gcc on cygwin w/ Herman Ten Brugge's bounds checking patch
From: Bill Priest <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 12 Nov 2003 00:02:13 -0600

On Mon, 10 Nov 2003 12:28:38 -0500
"Joe Buehler" <[email-masked]> wrote:

> I had downloaded this but not tried it yet.  If you get it
> working it would be "interesting" to recompile Cygwin and
> all of its packages and see what happens.  We have most of
> the core dumps out of our local Cygwin setup but there are
> still some happening from time to time...

Ok. I've got it working for trivial (hello world) type programs
that don't have errors; and it reports errors then seg faults
for a program w/ an array bounds error; similar operation vs.
the Linux version of the same program.

The main problem was that it was checking "char **environ"
which from limited googling appears to be defined in
cygwin1.dll; which explains the "funny" message I was getting
from gdb wrt "ptype environ".

This was w/ 3.3.2 (FSF) w/ the appropriate bounds check patch from
Herman's site, w/ a couple of tweaks that I made.  I don't
anticipate it being difficult to make the "same" changes to the
cygwin version of 3.3.1 and provide a working patch; but we
will see.

For the impatient
change libgcc2.c so that __bounds_checking_on declaration is outside
of #ifndef __CYGWIN__ (keeping #ifdef L__main so there is only one of these.

change init.c so that for (i = 0; environ[i]; ++i)  block is commented out
could change #ifndef __vxworks to #ifndef __CYGWIN__ or equivalent.

This is all I can remember changing off the top of my head.

Of course this checking only works for "C" & not "C++" or any other language
AFAIK.

FYI,

Bill
PS.  I'm sure it should be possible to process the environ; but I'd need so
direction from cygwin experts or a pointer to an example in existing source
code.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/