public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/6265: arm-elf toolchain wrong reference to varibles or stack address when using -O2 option
@ 2002-04-11 13:36 davidwu
0 siblings, 0 replies; 2+ messages in thread
From: davidwu @ 2002-04-11 13:36 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: target/6265: arm-elf toolchain wrong reference to varibles or stack address when using -O2 option
@ 2003-01-31 16:11 rearnsha
0 siblings, 0 replies; 2+ messages in thread
From: rearnsha @ 2003-01-31 16:11 UTC (permalink / raw)
To: davidwu, gcc-bugs, gcc-prs, nobody
Synopsis: arm-elf toolchain wrong reference to varibles or stack address when using -O2 option
State-Changed-From-To: open->feedback
State-Changed-By: rearnsha
State-Changed-When: Fri Jan 31 16:11:55 2003
State-Changed-Why:
I'm unable to see anything wrong with any the compilers I've tried this on (2.95.3 NetBSD/ARM 3.4 NetBSD/ARM, 2.95.4 Debian, 3.4 arm-elf). If think there is still a problem can you provide sample good and bad output that I can use to compare against.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6265
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-01-31 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-11 13:36 target/6265: arm-elf toolchain wrong reference to varibles or stack address when using -O2 option davidwu
2003-01-31 16:11 rearnsha
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).