* mipsel-gcc sick with #pragma?
@ 2002-07-28 8:01 renwei
2002-07-28 15:32 ` H. J. Lu
0 siblings, 1 reply; 2+ messages in thread
From: renwei @ 2002-07-28 8:01 UTC (permalink / raw)
To: linux-mips
hi,
I have some mipsel-linux-gcc on my i386 pc
to compile something , just like this:
/*********** begin ************/
#include <stdio.h>
#include <stdlib.h>
#define pack warn
#pragma pack(1)
typedef struct tagHDP_IPPrefix1
{
unsigned long ulIPPrefixNum;
unsigned char pucData[1]; b
}HDP_IPPrefix_S1;
typedef struct tagHTP_Packet_TLV1
{
unsigned short usType; /* Type */
unsigned short usLen; /* Length */
unsigned char pucValue[20]; /* Value */
}HTP_Packet_TLV_S1;
#pragma pack( )
void * test1(HTP_Packet_TLV_S1 stNewTLV)
{
HDP_IPPrefix_S1 *pstIPPrefix = 0;
pstIPPrefix = ( HDP_IPPrefix_S1 * )(stNewTLV.pucValue);
pstIPPrefix->ulIPPrefixNum = 0;
pstIPPrefix->ulIPPrefixNum += stNewTLV.usType * 2;
return pstIPPrefix;
}
/************* end of the file*************/
I compile it with :
mipsel-linux-gcc -c -O2 test.c -o test.o
but the result:
/tmp/ccMTigfE.s: Assembler messages:
/tmp/ccMTigfE.s:22: Error: illegal operands `sw'
compile with this:
mipsel-linux-gcc -c test.c -o test.o
will sucess.
the gcc manual says the use of #pragma is not good,
so it doesn't support it.
I think line
#pragma pack(1)
is of no use , but it seems not the case.
my cross gcc is :
`
mipsel-linux-gcc -v
gcc version 2.95.3 19991030 (prerelease)
that's really a bug , I think.
should I upgrade my toolchain? does the mipsel-gcc 3.1 ok at this case?
who knows the way to fix this?
thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-28 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-28 8:01 mipsel-gcc sick with #pragma? renwei
2002-07-28 15:32 ` H. J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox