This is the mail archive of the 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]

target/7798: unable to find a register to spill in class `FLOAT_REGS'

>Number:         7798
>Category:       target
>Synopsis:       unable to find a register to spill in class `FLOAT_REGS'
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 01 09:46:01 PDT 2002
>Release:        3.2
	gcc fails to compile a floating point function, complaining that is "unable to find a register to spill in class `FLOAT_REGS'"
	Save the text below as 'test.c'
		typedef struct {
		    float   x, y;
		} Vector;

		int circle_intersect( Vector m, int r, Vector pos, Vector v, Vector *t1, Vector *t2 )
		    Vector delta = { pos.x - m.x, pos.y - m.y };
		    float  delta_v = delta.x * v.x + delta.y * v.y;
		    float dis = delta_v * delta_v + r * r - ( delta.x * delta.x + delta.y * delta.y );
		    float t;

		    if ( dis < 0 ) {
				return 0; 
			dis = sqrt( dis );

		    t = -delta_v + dis;
		    t1->x = pos.x + t * v.x; t1->y = pos.y + t * v.y;
		    t = -delta_v - dis;
		    t2->x = pos.x + t * v.x; t2->y = pos.y + t * v.y;
		    return 1;

	and compile it as

		gcc -march=pentium3 -O3 -Wall -c test.c
	and gcc will produce

		test.c: In function `circle_intersect':
		test.c:15: warning: implicit declaration of function `sqrt'
		test.c:22: unable to find a register to spill in class `FLOAT_REGS'
		test.c:22: this is the insn:
		(insn 23 21 24 (set (subreg:SF (reg/v:DI 29 rmm0 [65]) 0)
			(minus:SF (subreg:SF (reg/v:DI 61) 0)
			    (subreg:SF (reg/v:DI 0 rax [59]) 0))) 533 {*fop_sf_1_nosse} (insn_list 8 (insn_list 4 (nil)))
		test.c:22: confused by earlier errors, bailing out
	invoking the compiler without the '-march=pentium3' or '-O3' option avoids the bug
 System: Linux localhost 2.4.19-gentoo-r7 #2 Wed Aug 28 12:19:51 WEST 2002 i686 GenuineIntel
 Architecture: i686
 	Toshiba Satellite 1700-500
 	Gentoo Linux 1.4beta
 host: i686-pc-linux-gnu
 build: i686-pc-linux-gnu
 target: i686-pc-linux-gnu
 configured with: /var/tmp/portage/gcc-3.2-r1/work/gcc-3.2/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable- languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/include/g++-v32 --with- local-prefix=/usr/local --enable-shared --disable-nls

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