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

reza_agha@yahoo.com reza_agha@yahoo.com
Mon Feb 3 13:46:00 GMT 2003


>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:



More information about the Gcc-bugs mailing list