public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: davidwu@arcturusnetworks.com
To: gcc-gnats@gcc.gnu.org
Subject: target/6265: arm-elf toolchain wrong reference to varibles or stack address when using -O2 option
Date: Thu, 11 Apr 2002 13:36:00 -0000	[thread overview]
Message-ID: <20020411203041.31418.qmail@sources.redhat.com> (raw)


>Number:         6265
>Category:       target
>Synopsis:       arm-elf toolchain wrong reference to varibles or stack address when using -O2 option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 11 13:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     davidwu@arcturusnetworks.com
>Release:        gcc 2.95.3/ gcc 3.1
>Organization:
>Environment:
Linux version 2.4.4-4GB (gcc version 2.95.3 20010315 (SuSE)) #1 Sat Jun 23 05:26:59 GMT 2001
>Description:
the following codes(file1) compile and execute correctly without using -O2
option. But when using -O2 option, the struct P3 is wrong(gcc 2.95) or 
Struct P2(gcc 3.1) is wrong. 
when using one "printf"( or just unuse bar()),it will be correct. 
 
//======================
typedef struct {
  long int p_x, p_y;
} Point;
 
void
bar ()
{
}
 
void
f (p0, p1, p2, p3, p4, p5)
Point p0, p1, p2, p3, p4, p5;
{
printf("p0x=%d\n",p0.p_x);
printf("p0y=%d\n",p0.p_y);
printf("%d\n",p1.p_x);
printf("%d\n",p1.p_y);
printf("%d\n",p2.p_x);
printf("%d\n",p2.p_y);
printf("%d\n",p1.p_x);
printf("%d\n",p1.p_y);
printf("%d\n",p2.p_x);
printf("%d\n",p2.p_y);
printf("%d\n",p3.p_x);
printf("%d\n",p3.p_y);
printf("%d\n",p4.p_x);
printf("%d\n",p4.p_y);
printf("%d\n",p5.p_x);
printf("%d\n",p5.p_y);
}
 
void
foo ()
{
  Point p0, p1, p2, p3, p4, p5;
  bar();
 
  p0.p_x = 0;
//printf("%d\n",p0.p_x);
  p0.p_y = 1;
  p1.p_x = -1;
  p1.p_y = 0;
  p2.p_x = 1;
  p2.p_y = -1;
  p3.p_x = -1;
  p3.p_y = 1;
  p4.p_x = 0;
  p4.p_y = -1;
  p5.p_x = 1;
  p5.p_y = 0;
f(p0,p1,p2,p3,p4,p5); 
}
 
int
main()
{
  foo ();
  exit(0);
}
//========= end =======
>How-To-Repeat:
configure arm-elf cross gcc with simulator(gdb has a simulator)
compile above file with -O2 and execute.  
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-04-11 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-11 13:36 davidwu [this message]
2003-01-31 16:11 rearnsha

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=20020411203041.31418.qmail@sources.redhat.com \
    --to=davidwu@arcturusnetworks.com \
    --cc=gcc-gnats@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).