public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13122] New: h8300 - local variable gets corrupted by function call when -fomit-frame-pointer is given
@ 2003-11-19 10:44 dhananjayd at kpitcummins dot com
  2003-11-21 11:58 ` [Bug target/13122] " dhananjayd at kpitcummins dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dhananjayd at kpitcummins dot com @ 2003-11-19 10:44 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-12-15 21:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-19 10:44 [Bug c/13122] New: h8300 - local variable gets corrupted by function call when -fomit-frame-pointer is given dhananjayd at kpitcummins dot com
2003-11-21 11:58 ` [Bug target/13122] " dhananjayd at kpitcummins dot com
2003-11-22 16:47 ` kazu at cs dot umass dot edu
2003-11-22 16:53 ` kazu at cs dot umass dot edu
2003-11-22 17:26 ` kazu at cs dot umass dot edu
2003-11-23  2:32 ` kazu at cs dot umass dot edu
2003-11-23 22:34 ` kazu at cs dot umass dot edu
2003-11-24  5:34 ` dhananjayd at kpitcummins dot com
2003-11-24 18:23 ` kazu at cs dot umass dot edu
2003-12-15 20:24 ` cvs-commit at gcc dot gnu dot org
2003-12-15 21:02 ` dhazeghi at yahoo dot com

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).