gnupic: Thread: Segmentation fault ... did I bite off more then the current release can do?


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Segmentation fault ... did I bite off more then the current release can do?
From: Robert Warner ####@####.####
Date: 28 May 2002 04:39:20 -0000
Message-Id: <02052720303200.03555@amdk62300>

I'm attempting to build the picweb.c module (with appropriate mods to code 
for GNU) from the PICDEM dev board/sw.  After fixing numerous 'portation' 
issues/errors (reported by sdcc)  I get a segmentation fault when I attempt 
to compile.  Should I not attempt something so large with this current 
release of sdcc?  Do you need any more information of the error?  If so, 
please specify the information and I'll attempt to get it.

Thanks in advance.
Bob
Subject: Re: Segmentation fault ... did I bite off more then the current release can do?
From: Scott Dattalo ####@####.####
Date: 28 May 2002 12:07:34 -0000
Message-Id: <Pine.LNX.4.44.0205280450370.9927-100000@ruckus.brouhaha.com>

On Mon, 27 May 2002, Robert Warner wrote:

> I'm attempting to build the picweb.c module (with appropriate mods to code 
> for GNU) from the PICDEM dev board/sw.  After fixing numerous 'portation' 
> issues/errors (reported by sdcc)  I get a segmentation fault when I attempt 
> to compile.  Should I not attempt something so large with this current 
> release of sdcc?  Do you need any more information of the error?  If so, 
> please specify the information and I'll attempt to get it.

In general, if you can boil the source down to the point it exhibits 
the bug and send a copy to me that'd be great. I also monitor the bug 
reports sent to SDCC's web page so you can send it there too if you want.

If you want to send me a copy of what you got now, I'll run it under my 
development version of SDCC. Since it's been over a week that I've checked 
anything in, there are numerous differences between my copy and CVS. (Most 
notable is automatic function in-lining is almost working.)

Scott

Subject: Re: Segmentation fault ... did I bite off more then the current release can do?
From: Robert Warner ####@####.####
Date: 29 May 2002 02:51:18 -0000
Message-Id: <02052818423403.03555@amdk62300>

Ok,  after several compile/edit sequences I've come up with the following.  
It appears an array indexed with a variable causes a problem.

Here is the code:
...
#define RXBUFFLEN  80       // Rx buffer: more than enough for a 32-byte Ping
...
BYTE rxbuff[RXBUFFLEN];     // Receive buffer, I/O ptrs, and 'Rx full' flag
int rxin, rxout, rxcount;
...
void skip_space(void)
{
//    BYTE  rxout;			//RXWTest failed segmentation fault

    while (rxbuff[rxout] <= ' ')
//RXWTest passed no segmentation fault, any const value works
//    while (rxbuff[0] <= ' ')	
        getch_slip();
}
...


Note: 'rxout' bing global or local causes this problem.  I tried various 
simple scalar types with no change in the error.
Note:  This function works (similar, except it uses pointers instead)
/* Write a byte to the Tx buffer */
void write_txbuff(int *oset, BYTE *b)
{
    txbuff[*oset] = *b;
}


I'll attempt to restructure the current problem using pointers to see if this 
fixes the problem.

Thanks
Bob



On Tuesday 28 May 2002 07:57, Scott Dattalo wrote:
> On Mon, 27 May 2002, Robert Warner wrote:
> > I'm attempting to build the picweb.c module (with appropriate mods to
> > code for GNU) from the PICDEM dev board/sw.  After fixing numerous
> > 'portation' issues/errors (reported by sdcc)  I get a segmentation fault
> > when I attempt to compile.  Should I not attempt something so large with
> > this current release of sdcc?  Do you need any more information of the
> > error?  If so, please specify the information and I'll attempt to get it.
>
> In general, if you can boil the source down to the point it exhibits
> the bug and send a copy to me that'd be great. I also monitor the bug
> reports sent to SDCC's web page so you can send it there too if you want.
>
> If you want to send me a copy of what you got now, I'll run it under my
> development version of SDCC. Since it's been over a week that I've checked
> anything in, there are numerous differences between my copy and CVS. (Most
> notable is automatic function in-lining is almost working.)
>
> Scott
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
Subject: Re: Segmentation fault ... did I bite off more then the current release can do?
From: Philip Restuccia ####@####.####
Date: 29 May 2002 13:10:51 -0000
Message-Id: <3CF4CECD.319A016D@nortelnetworks.com>

Robert Warner wrote:
> 
> Ok,  after several compile/edit sequences I've come up with the following.
> It appears an array indexed with a variable causes a problem.
> 
> Here is the code:
> ...
> #define RXBUFFLEN  80       // Rx buffer: more than enough for a 32-byte Ping
> ...
> BYTE rxbuff[RXBUFFLEN];     // Receive buffer, I/O ptrs, and 'Rx full' flag
> int rxin, rxout, rxcount;
> ...
> void skip_space(void)
> {
> //    BYTE  rxout;                      //RXWTest failed segmentation fault
> 
>     while (rxbuff[rxout] <= ' ')

If this is *precisely* the way it was originally coded, with the definition
of the local variable 'rxout' uncommented, then the above while test MAY
fail due to rxout not being initialized. Depending on the particular value in
the location on the stack reserved for the local variable rxout at the time
the function is entered, rxout may be within the range 0 <= rxout < 80, making
it a valid index, but may NOT be.

Try initializing it at the point of definition:

	BYTE rxout = 0;

or whatever.

The reason why it works as a global is that globals are initialized to 0 if
they are not explicitly initialized otherwise.

	Phil

> //RXWTest passed no segmentation fault, any const value works
> //    while (rxbuff[0] <= ' ')
>         getch_slip();
> }
> ...
> 
> Note: 'rxout' bing global or local causes this problem.  I tried various
> simple scalar types with no change in the error.
> Note:  This function works (similar, except it uses pointers instead)
> /* Write a byte to the Tx buffer */
> void write_txbuff(int *oset, BYTE *b)
> {
>     txbuff[*oset] = *b;
> }
> 
> I'll attempt to restructure the current problem using pointers to see if this
> fixes the problem.
> 
> Thanks
> Bob
> 
> On Tuesday 28 May 2002 07:57, Scott Dattalo wrote:
> > On Mon, 27 May 2002, Robert Warner wrote:
> > > I'm attempting to build the picweb.c module (with appropriate mods to
> > > code for GNU) from the PICDEM dev board/sw.  After fixing numerous
> > > 'portation' issues/errors (reported by sdcc)  I get a segmentation fault
> > > when I attempt to compile.  Should I not attempt something so large with
> > > this current release of sdcc?  Do you need any more information of the
> > > error?  If so, please specify the information and I'll attempt to get it.
> >
> > In general, if you can boil the source down to the point it exhibits
> > the bug and send a copy to me that'd be great. I also monitor the bug
> > reports sent to SDCC's web page so you can send it there too if you want.
> >
> > If you want to send me a copy of what you got now, I'll run it under my
> > development version of SDCC. Since it's been over a week that I've checked
> > anything in, there are numerous differences between my copy and CVS. (Most
> > notable is automatic function in-lining is almost working.)
> >
> > Scott
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ####@####.####
> > For additional commands, e-mail: ####@####.####
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####

-- 
Philip Restuccia
Senior Principal Software Engineer
Nortel Networks
####@####.####
Subject: Re: Segmentation fault ... did I bite off more then the current release can do?
From: Scott Dattalo ####@####.####
Date: 29 May 2002 13:41:00 -0000
Message-Id: <Pine.LNX.4.44.0205290628090.22582-100000@ruckus.brouhaha.com>

On Tue, 28 May 2002, Robert Warner wrote:

> Ok,  after several compile/edit sequences I've come up with the following.  
> It appears an array indexed with a variable causes a problem.

And this is undoubtedly a bug in SDCC. I'll look into this right now...

Thanks for the report,
Scott

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.