This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Reg alloc (?) bug in gcc-3.0.1, i586-linux
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Reg alloc (?) bug in gcc-3.0.1, i586-linux
- From: "Bradley G. Kaiser" <bkaiser at acelink dot net>
- Date: Mon, 27 Aug 2001 13:06:39 -0500
The following code fragment (taken from the mutt email program by
Michael Elkins, v1.2.5) generates invalid code with gcc-3.0.1
(i586-linux) with either "-O -fgcse -frerun-cse-after-loop
-fomit-frame-pointer" or "-O2 -fomit-frame-pointer". ("-O3
-fomit-frame-pointer" obviously triggers the problem as well).
The resulting assembly code uses the ebp register as a ptr
into the stack frame without initializing it.
(I believe this problem also causes a gcc bootstrap with "-O3
-fomit-frame-pointer -fno-inline-functions" to segfault in stage2.)
The problem seems to be in global register allocation or
reload, but I haven't been successful in narrowing it down further
than that.
Regards,
Brad Kaiser
(bkaiser@acelink.net)
---------------8<----------------8<-----------------
#define FILE struct iobuf_
#define NULL ((void *)0)
#define LONG_STRING 1024
extern int COLS;
void format_line (FILE *f, int ismacro,
const char *t1, const char *t2, const char *t3)
{
int col;
int col_a, col_b;
int split;
fputs (t1, f);
if ((split = COLS < 40))
{
col_a = col = 0;
col_b = LONG_STRING;
fputc ('\n', f);
}
else
{
col_a = COLS > 83 ? (COLS - 32) >> 2 : 12;
col_b = COLS > 49 ? (COLS - 10) >> 1 : 19;
col = pad (f, mutt_strlen(t1), col_a);
}
if (ismacro > 0)
{
if (!split)
{
col += print_macro (f, col_b - col - 4, &t2);
}
}
col += print_macro (f, col_b - col - 1, &t2);
if (split)
fputc ('\n', f);
else
col = pad (f, col, col_b);
}
--------------->8---------------->8-----------------