This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/13122] New: h8300 - local variable gets corrupted by function call when -fomit-frame-pointer is given
- From: "dhananjayd at kpitcummins dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Nov 2003 10:44:58 -0000
- Subject: [Bug c/13122] New: h8300 - local variable gets corrupted by function call when -fomit-frame-pointer is given
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Try compiling code below with
h8300-coff-gcc -fomit-frame-pointer -mh -mn bug.c
==================================================
void foo(int a, int b, int c, int d)
{
}
void bar ( char a, char b )
{
}
void main(void)
{
char a ;
foo(1,2,3,4);
a = 10;
bar(a, 1);
printf("a=%d\n", a);
}
==================================================
h8300-hms-run a.out prints
a=244
If you see the generated assembly, variable a is accessed using -ve offset from
SP. It should be +ve offset.
mov.b r2l,@(-1,er7) ;# a
The problem doesn't appear if line calling function foo() is commented.
I think this is related to INITIAL_ELIMINATION_OFFSET.
-Dhananjay
--
Summary: h8300 - local variable gets corrupted by function call
when -fomit-frame-pointer is given
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dhananjayd at kpitcummins dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: h8300-unknown-hms
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13122