public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-28 15:26 kazu
0 siblings, 0 replies; 7+ messages in thread
From: kazu @ 2003-03-28 15:26 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, kazu, mnmoran
Synopsis: Incorrect code generated for H8300 "normal" mode
State-Changed-From-To: analyzed->closed
State-Changed-By: kazu
State-Changed-When: Fri Mar 28 15:24:45 2003
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10205
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-28 16:56 Kazu Hirata
0 siblings, 0 replies; 7+ messages in thread
From: Kazu Hirata @ 2003-03-28 16:56 UTC (permalink / raw)
To: kazu; +Cc: gcc-prs
The following reply was made to PR target/10205; it has been noted by GNATS.
From: Kazu Hirata <kazu@cs.umass.edu>
To: <gcc-bugs@gcc.gnu.org>, <mnmoran@bellsouth.net>, <gcc-gnats@gcc.gnu.org>,
<gcc-patches@gcc.gnu.org>
Cc:
Subject: Re: target/10205: Incorrect code generated for H8300 "normal" mode
Date: Fri, 28 Mar 2003 10:21:26 -0500 (EST)
Hi,
Here is the final patch I committed to 3.3 branch and mainline.
Kazu Hirata
2003-03-28 Kazu Hirata <kazu@cs.umass.edu>,
Dhananjay Deshpande <dhananjayd@kpit.com>
PR target/10205
* config/h8300/h8300.c (h8300_initial_elimination_offset):
Correct the offset computation when TARGET_NORMAL.
Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.221
diff -u -r1.221 h8300.c
--- h8300.c 22 Mar 2003 15:22:37 -0000 1.221
+++ h8300.c 28 Mar 2003 14:50:38 -0000
@@ -1715,9 +1715,11 @@
int from, to;
{
int offset = 0;
+ /* The number of bytes that the return address takes on the stack. */
+ int pc_size = POINTER_SIZE / BITS_PER_UNIT;
if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
- offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
+ offset = pc_size + frame_pointer_needed * UNITS_PER_WORD;
else if (from == RETURN_ADDRESS_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
offset = frame_pointer_needed * UNITS_PER_WORD;
else
@@ -1734,11 +1736,9 @@
offset += round_frame_size (get_frame_size ());
if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- offset += UNITS_PER_WORD; /* Skip saved PC */
+ /* Skip saved PC. */
+ offset += pc_size;
}
-
- if ((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
- offset -= 2;
return offset;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-28 15:07 Kazu Hirata
0 siblings, 0 replies; 7+ messages in thread
From: Kazu Hirata @ 2003-03-28 15:07 UTC (permalink / raw)
To: kazu; +Cc: gcc-prs
The following reply was made to PR target/10205; it has been noted by GNATS.
From: Kazu Hirata <kazu@cs.umass.edu>
To: dhananjayd@kpit.com
Cc: gcc-bugs@gcc.gnu.org, mnmoran@bellsouth.net, gcc-gnats@gcc.gnu.org,
gcc-patches@gcc.gnu.org
Subject: Re: target/10205: Incorrect code generated for H8300 "normal" mode
Date: Fri, 28 Mar 2003 08:14:31 -0500 (EST)
Hi Dhananjay,
> The patch below fixes this. If it is OK, it should be applied to
> both mainline and 3.3 branch.
Actually, I have come up with a basically identical patch, which I am
asking the submitter to test in private mail. When he responds, I'll
add your name in the ChangeLog entry. Mine looks like this, but I
like your POINTER_SIZE approach.
Kazu Hirata
Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.221
diff -c -r1.221 h8300.c
*** h8300.c 22 Mar 2003 15:22:37 -0000 1.221
--- h8300.c 28 Mar 2003 03:33:36 -0000
***************
*** 1715,1723 ****
int from, to;
{
int offset = 0;
if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
! offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
else if (from == RETURN_ADDRESS_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
offset = frame_pointer_needed * UNITS_PER_WORD;
else
--- 1715,1726 ----
int from, to;
{
int offset = 0;
+ /* The number of bytes that the return address takes on the stack. */
+ int pc_size = (((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
+ ? (UNITS_PER_WORD / 2) : UNITS_PER_WORD);
if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
! offset = pc_size + frame_pointer_needed * UNITS_PER_WORD;
else if (from == RETURN_ADDRESS_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
offset = frame_pointer_needed * UNITS_PER_WORD;
else
***************
*** 1734,1744 ****
offset += round_frame_size (get_frame_size ());
if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
! offset += UNITS_PER_WORD; /* Skip saved PC */
}
-
- if ((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
- offset -= 2;
return offset;
}
--- 1737,1744 ----
offset += round_frame_size (get_frame_size ());
if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
! offset += pc_size; /* Skip saved PC */
}
return offset;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-28 7:56 Dhananjay R. Deshpande
0 siblings, 0 replies; 7+ messages in thread
From: Dhananjay R. Deshpande @ 2003-03-28 7:56 UTC (permalink / raw)
To: kazu; +Cc: gcc-prs
The following reply was made to PR target/10205; it has been noted by GNATS.
From: "Dhananjay R. Deshpande" <dhananjayd@kpit.com>
To: <kazu@gcc.gnu.org>,
<gcc-bugs@gcc.gnu.org>,
<mnmoran@bellsouth.net>,
<gcc-gnats@gcc.gnu.org>,
<gcc-patches@gcc.gnu.org>
Cc: "Kazu Hirata" <kazu@cs.umass.edu>
Subject: Re: target/10205: Incorrect code generated for H8300 "normal" mode
Date: Fri, 28 Mar 2003 13:01:11 +0530
Hi,
>Synopsis: Incorrect code generated for H8300 "normal" mode
>State-Changed-From-To: open->analyzed
>State-Changed-By: kazu
>State-Changed-When: Thu Mar 27 19:59:48 2003
>State-Changed-Why:
> Still present in mainline. Here is a smaller testcase.
=20
The patch below fixes this. If it is OK, it should be applied to both =
mainline=20
and 3.3 branch.
- Dhannajay
Changelog
2003-03-28 Dhananjay Deshpande <dhananjayd@kpit.com>
PR target/10205
* config/h8300/h8300.c (h8300_initial_elimination_offset): =
Remove hack in=20
adjustment of offset for normal mode.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
--- h8300.c.orig Fri Mar 28 12:07:21 2003
+++ h8300.c Fri Mar 28 12:04:57 2003
@@ -1717,7 +1717,8 @@ h8300_initial_elimination_offset (from,=20
int offset =3D 0;
=20
if (from =3D=3D ARG_POINTER_REGNUM && to =3D=3D FRAME_POINTER_REGNUM)
- offset =3D UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
+ offset =3D (POINTER_SIZE / BITS_PER_UNIT) + frame_pointer_needed *
+ UNITS_PER_WORD;
else if (from =3D=3D RETURN_ADDRESS_POINTER_REGNUM && to =3D=3D =
FRAME_POINTER_REGNUM)
offset =3D frame_pointer_needed * UNITS_PER_WORD;
else
@@ -1734,11 +1735,8 @@ h8300_initial_elimination_offset (from,=20
offset +=3D round_frame_size (get_frame_size ());
=20
if (from =3D=3D ARG_POINTER_REGNUM && to =3D=3D =
STACK_POINTER_REGNUM)
- offset +=3D UNITS_PER_WORD; /* Skip saved PC */
+ offset +=3D (POINTER_SIZE / BITS_PER_UNIT); /* Skip saved =
PC */
}
-
- if ((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
- offset -=3D 2;
=20
return offset;
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-27 20:12 kazu
0 siblings, 0 replies; 7+ messages in thread
From: kazu @ 2003-03-27 20:12 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, kazu, mnmoran
Synopsis: Incorrect code generated for H8300 "normal" mode
State-Changed-From-To: open->analyzed
State-Changed-By: kazu
State-Changed-When: Thu Mar 27 19:59:48 2003
State-Changed-Why:
Still present in mainline. Here is a smaller testcase.
class B {
public:
virtual void x () throw () = 0;
};
class MX : public B {
short _save;
public:
void x () throw ();
};
extern void z (B &a);
void
foo ()
{
MX mx;
z (mx);
z (mx);
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10205
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-27 13:12 kazu
0 siblings, 0 replies; 7+ messages in thread
From: kazu @ 2003-03-27 13:12 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, kazu, mnmoran, nobody
Synopsis: Incorrect code generated for H8300 "normal" mode
Responsible-Changed-From-To: unassigned->kazu
Responsible-Changed-By: kazu
Responsible-Changed-When: Thu Mar 27 13:07:43 2003
Responsible-Changed-Why:
I maintain the H8 port.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10205
^ permalink raw reply [flat|nested] 7+ messages in thread
* target/10205: Incorrect code generated for H8300 "normal" mode
@ 2003-03-25 5:46 mnmoran
0 siblings, 0 replies; 7+ messages in thread
From: mnmoran @ 2003-03-25 5:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 10205
>Category: target
>Synopsis: Incorrect code generated for H8300 "normal" mode
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 25 05:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Mike Moran
>Release: gcc-20030324 snapshot
>Organization:
>Environment:
Linux glass 2.2.18-4hpmac #1 Thu Dec 21 15:16:15 MST 2000 ppc unknown
$ gcc -v
Reading specs from /usr/lib/gcc-lib/ppc-redhat-linux/2.95.3/specs
gcc version 2.95.3 20001130 (prerelease/franzo/20001204)
>Description:
subs #0x4,er7 --- reserve space for object
mov.l er4,@-er7 --- save non-volatile register
mov.w r7,r4 --- copy of SP/FP
adds #0x2,er4 --- BUG! should add 4 to SP/FP
mov.w #0x0,r2
mov.w r2,@er4 --- Overwrites saved non-volatile
I tried the snapshot since the same type of problem
in GCC-3.2.1
>How-To-Repeat:
../gcc-20030324/configure --prefix=/tools/gnu/h8300-elf --target=h8300-elf --enable-languages=c c++ --with-newlib
h8300-elf-gcc -c -fno-builtin -mn -mh -fomit-frame-pointer -fno-exceptions -O2 testcase.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="testcase.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="testcase.cpp"
CmNsYXNzIEIgewoJcHVibGljOgoJCXZpcnR1YWwgdm9pZAl4KCkgdGhyb3coKT0wOwoJCXZpcnR1
YWwgdm9pZAl5KCkgdGhyb3coKT0wOwoJfTsKCmNsYXNzIE1YIDogcHVibGljIEIgewoJdW5zaWdu
ZWQgY2hhcglfc2F2ZTsKCXB1YmxpYzoKCQl2b2lkIHgoKSB0aHJvdygpOwoJCXZvaWQgeSgpIHRo
cm93KCk7Cgl9OwoKY2xhc3MgREEgewoJcHVibGljOgoJCXZpcnR1YWwgdm9pZAl0KCkgdGhyb3co
KT0wOwoJfTsKCmNsYXNzIEQgOiBwdWJsaWMgREEgewoJcHVibGljOgoJCXZvaWQJdCgpIHRocm93
KCk7Cgl9OwoKZXh0ZXJuIHZvaWQgeihCICZhLEIgJmIpOwovL2V4dGVybiB2b2lkIHooTVggJmEs
TVggJmIpOwoKdm9pZCBEOjp0KCkgdGhyb3coKXsKCU1YCW14OwoJbXgueCgpOwoJeihteCxteCk7
CglteC55KCk7Cgl9Cgo=
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-03-28 15:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-28 15:26 target/10205: Incorrect code generated for H8300 "normal" mode kazu
-- strict thread matches above, loose matches on Subject: below --
2003-03-28 16:56 Kazu Hirata
2003-03-28 15:07 Kazu Hirata
2003-03-28 7:56 Dhananjay R. Deshpande
2003-03-27 20:12 kazu
2003-03-27 13:12 kazu
2003-03-25 5:46 mnmoran
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).