public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: a question about memory access on IA64
Date: Fri, 16 Jan 2004 04:59:56 +0000	[thread overview]
Message-ID: <16391.28620.39161.362377@napali.hpl.hp.com> (raw)
In-Reply-To: <40075464.6010202@sinosoft.com.cn>

Sorry, but your problem report is still very incomplete.  Please
provide a _self-contained_ minimal test program that reproduces the
problem for you and describe you how compile the program.  Without a
complete test-case there are a million variations of what could be
wrong.

	--david

>>>>> On Fri, 16 Jan 2004 12:02:02 +0800, liuduo <liuduo@sinosoft.com.cn> said:

  Liuduo> David:
  Liuduo> Sorry, i only describe the process about the error occurs .

  Liuduo> typedef struct b{
  Liuduo> char*  pDescriptName;
  Liuduo> char*           pVendorName;
  Liuduo> unsigned int	RevisionID;
  Liuduo> }B;

  Liuduo> typedef struct pci{
  Liuduo> int c;
  Liuduo> struct b bb[512];
  Liuduo> }PCI;

  Liuduo> int main()
  Liuduo> {


  Liuduo> struct pci a;

  Liuduo> //function for operation a
  Liuduo> func(&a);
  Liuduo> return 0;
  Liuduo> }
  Liuduo> the func is in an lib, it's an lib export function, and the func is as 
  Liuduo> follows;

  Liuduo> func(struct pci* a)
  Liuduo> {
  Liuduo> char tmp[256];
  Liuduo> for(num=0;num<512;num++)
  Liuduo> {
  a-> bb[num].pDescriptName = (char*)malloc(100);
  Liuduo> strcpy(a->bb[num].pDescriptName , "dddd");
  a-> bb[num].pVendorName = (char*)malloc(100);
  Liuduo> strcpy(a->bb[num].pVendorName , "fffff");
  a-> bb[num].RevisionID = 22;
  Liuduo> }
  a-> c = 512;
  Liuduo> }
  Liuduo> when call the func , the segmentation fault occurs,
  Liuduo> and then we modified the struct A as follows
  Liuduo> typedef struct pci{
  Liuduo> struct b bb[512];
  Liuduo> int c;
  Liuduo> }PCI;
  Liuduo> it's normal.
  Liuduo> please tell me why?
  Liuduo> thanks a lot.
  Liuduo> -- 
  Liuduo> ===================  Liuduo> Liu duo
  Liuduo> tel:(010)62570007-509
  Liuduo> email:liuduo@sinosoft.com.cn
  Liuduo> Sinosoft Software.Co.Ltd.
  Liuduo> Esmpro Group.Secic Department
  Liuduo> ===================


  parent reply	other threads:[~2004-01-16  4:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16  3:03 a question about memory access on IA64 liuduo
2004-01-16  3:16 ` David Mosberger
2004-01-16  3:56 ` liuduo
2004-01-16  4:16 ` Martin Pool
2004-01-16  4:59 ` David Mosberger [this message]
2004-01-16  7:01 ` Martin Pool
2004-01-16  7:12 ` liuduo

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=16391.28620.39161.362377@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=linux-ia64@vger.kernel.org \
    /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