This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/9544: buggy prolog code generation for functions, make room for local vars


>Number:         9544
>Category:       c
>Synopsis:       buggy prolog code generation for functions, make room for local vars
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 03 13:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Reza A. Naini
>Release:        2.95.2 19991024 (release)   AVR version
>Organization:
>Environment:
Win2K
>Description:
the prolog code of function when want to make room for local variables, is buggy.
void aFunction(void)
{
    char localVars[100];
}
is translated to:
	in	r0,SREG
	cli		<----
	preperation code for local variables
	sei		<---- BUG!
the I (interrupt) flag is set at beginning of this function.
>How-To-Repeat:
char global[100];

void aFunction(void)
{
   char local[100];
   int  i;
   for(i=0; i<100; i++)
      global[i] = local[i];
}
>Fix:
prolog code must be:
   in r0,SREG
   cli
   .......
   out SREG,r0    <---- Fix!
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]