Subject: bin/5199: problem wrt. long long in in-tree gcc
To: None <gnats-bugs@gnats.netbsd.org>
From: Jason R Thorpe <thorpej@nas.nasa.gov>
List: netbsd-bugs
Date: 03/24/1998 10:29:26
>Number:         5199
>Category:       bin
>Synopsis:       problem wrt. long long in in-tree gcc
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 24 19:20:01 1998
>Last-Modified:
>Originator:     
>Organization:
Numerical Aerospace Simulation Facility - NASA Ames
>Release:        1.3E, March 24, 1998
>Environment:
	
System: NetBSD dracul 1.3E NetBSD 1.3E (DRACUL) #560: Tue Mar 24 09:25:06 PST 1998 thorpej@dracul:/u5/netbsd/src/sys/arch/i386/compile/DRACUL i386


>Description:
	NetBSD's i386 compiler appears to have a problem regarding
	certain uses of `long long'.  A quick test indicates that
	the problem does not occur on the SPARC, Alpha, or the m68k.

	This problem was discovered by George Navas <navas@nas.nasa.gov>
	while porting an HSM tape management system from ConvexOS to
	NetBSD 1.3.

	I have verified that the compiler problem still exists in
	NetBSD 1.3E.

	The test program below produces the following error message
	from the compiler:

foo.c: In function `breakit':
foo.c:17: fixed or forbidden register was spilled.
This may be due to a compiler bug or to impossible asm
statements or clauses.

>How-To-Repeat:
	The following short chunk of code will tickle the bug:

 ----- snip -----

typedef struct usr_fileinfo {
        long long       usr_tdata[2];
} USR_FILEINFO;

struct tape_info {
        long long       ti_livedata;
};

struct tape_info tapes[2];

int
breakit( USR_FILEINFO *dbusr_rec)
{
        int             cur_tape;
        int             i;
        tapes[cur_tape].ti_livedata += dbusr_rec->usr_tdata[i];
}

 ----- snip -----

	If the:

	tapes[cur_tape].ti_livedata += dbusr_rec->usr_tdata[i];

	...line is changed to read:

	long long       tmp;
	tmp = dbusr_rec->usr_tdata[i];
	tapes[cur_tape].ti_livedata += tmp;

	...then the problem does NOT happen.

>Fix:
	Unknown.
>Audit-Trail:
>Unformatted: