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]

Re: i*86 structure assignment bug with global register vars


On 23-Oct-2000, Bernd Schmidt <bernds@redhat.co.uk> wrote:
> On Mon, 23 Oct 2000, Fergus Henderson wrote:
> 
> > gcc 2.95.2 on i*86 systems has a bug that shows up if you try to use
> > structure assignment and global register variables in the same
> > program.  It reports the error message "fixed or forbidden register
> > ... was spilled ... This may be due to a compiler bug or to
> > impossible asm statements or clauses.".
> 
> > $ cat bug.c
> > 	register int reg __asm__("esi");
> > 	struct s {
> > 		int a;
> > 		int b;
> > 		long c;
> > 		long d;
> > 		void* e;
> > 	} x, y;
> > 	void foo() {
> > 		x = y;
> > 	}
> 
> GCC can't guarantee that it will be able to compile every program using
> global register variables.  This is obvious if you consider a program
> that uses up all available registers for such variables;

Well, I understand that it can't guarantee to compile every such
program, but nevertheless it ought to be able to compile the
particular program above.

> it may be less
> obvious for this example where only one register is global - but then the
> x86 simply doesn't have very many registers.

The issue is not that the x86 has too few registers.  That's not the
problem.  The problem is that gcc's code generation unnecessarily
assumes that it can use all of them (or at least "esi" in particular).
This assumption is not necessary, and as demonstrated above, it is
quite clearly harmful.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

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