Hi Robert,
I'm running Win2k and get the same error with your code.  One possible
solution may be using a macro rather than a function call.  This fixes the
error even with optimisation enabled.  I hope I've guessed the nature of
your function correctly...


//Macro returns TRUE if the specified bit is set.
#define mIsBitSet( BIT, VALUE ) ((uint64_t)(VALUE) & (1<<BIT))

void prettyprintpacket(uint8 id, uint8 length)
{
   <snip>
   //is the 2nd bit set?
   if ( !( mIsBitSet( 1, *msdumem ) ) )
   {
      //yes, so do something
   }
}

Cheers,
Rich.

----- Original Message ----- 
From: "Robert Mitschke" <msp...@robertmitschke.com>
To: <mspgcc-users@lists.sourceforge.net>
Sent: Sunday, June 27, 2004 8:20 PM
Subject: [Mspgcc-users] Segmentation fault while compiling


Hello,

I am new to the list, so hello to everyone from Berlin Germany.

I have a problem with msp-gcc crashing with a segmentation fault
while I compile my current project.

I am using the latest prebuilt windows version of the msp gcc,
which I downloaded an hour ago (to confirm the problem still
exists in the latest version):
msp430-gcc -v
Reading specs from
/cygdrive/c/MSP430/mspgcc2/bin/../lib/gcc-lib/msp430/3.2.3/sp
ecs
Configured with: ./configure --target=msp430
--prefix=/c/daten/mspgcc/build/inst
alled --disable-nls
Thread model: single
gcc version 3.2.3

I am using Windows XP Professional (including Service Pack 1 and
all currently available patches) on a Compaq Armada 1700 Laptop
(I know it is old :-)).

I am using the following command line for compiling and am
getting the error below:
msp430-gcc -Wall -mmcu=msp430x149 -g -O -c src/debug.c      -o out/debug.o
src/debug.c: In function `prettyprintpacket':
src/debug.c:63: warning: unused variable `dstaddrmode'
src/debug.c:64: warning: unused variable `srcaddrmode'
src/debug.c:65: warning: unused variable `intrapan'
src/debug.c:92: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [debug.o] Error 1

Using a less detailed command line I get the same error:
msp430-gcc -c src/debug.c -o out/debug.o
src/debug.c: In function `prettyprintpacket':
src/debug.c:92: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

I have tried various alterations of the line of code the seems to
cause the error (line 327 in the debug.i file).
If I make the cast more explizit (create a 64Bit uint variable, assign the
cast to it first and then supply the 64Bit variable as parameter) I only get
the segmentation fault if I turn on optimization, I guess optimization sort
of eleminates exactly that extra bit of code.

Thus I guess the problem lies within casting/assigning an 8bit value to a
64Bit value and then supplying it as a parameter to a function or procedure.


If you could advise where my mistake is and what I could change
to be able to compile that code, I would  be more than glad.

Have a nice Sunday (or rest of your sunday, depending where you live).

Robert Mitschke


Reply via email to