Using %ebp as explicit local reg variable confuses cc1

Cesar Eduardo Barros cesarb@web4u.com.br
Wed Apr 5 16:16:00 GMT 2000


It looks like using %ebp in a explicit local reg var confuses gcc. It shows the
warning:

m2000.c:5: warning: `mem' might be used uninitialized in this function

Even it being initialized before use. No other register shows this weird
behavior (and since I'm using -fomit-frame-pointer, using %ebp to do whatever I
want should be allowed).

I've noticed also that if gcc runs out of registers (more explicit local regs,
leaving less than gcc needs in a particular place) it fails to notice %ebp is
already allocated and uses it (as if I never used it). Sorry for fixing it in
my code before thinking of filing a bug (no test case for this one :( )


Version: gcc version 2.95.2 20000313 (Debian GNU/Linux)
Input file:
===cut here===
# 1 "m2000.c"
extern void dummy (unsigned char * mem);

static void run (unsigned char * mem_arg)
{
	register unsigned char * mem asm ("%ebp");

	mem = mem_arg;

	dummy (mem);
}
===cut here===
Command line: gcc -O3 -W -Wall -c -fomit-frame-pointer -save-temps -fkeep-inline-functions -march=k6 -funroll-loops m2000.c -ggdb3
Machine info: Debian unstable Linux 2.2.14 glibc 2.1.3 K6II-350
Changes to compiler sources: All from Debian's gcc 1:2.95.2-8

-- 
Cesar Eduardo Barros
cesarb@web4u.com.br
cesarb@dcc.ufrj.br


More information about the Gcc-bugs mailing list