Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: renwei <renwei@huawei.com>
To: linux-mips@oss.sgi.com
Subject: mipsel-gcc sick with #pragma?
Date: Sun, 28 Jul 2002 16:01:41 +0800	[thread overview]
Message-ID: <001b01c2360d$07aabd20$690d6e0a@huawei.com> (raw)

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.

             reply	other threads:[~2002-07-28  7:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-28  8:01 renwei [this message]
2002-07-28 15:32 ` mipsel-gcc sick with #pragma? H. J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001b01c2360d$07aabd20$690d6e0a@huawei.com' \
    --to=renwei@huawei.com \
    --cc=linux-mips@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox