Bug 21026

Summary: gcc bug with -mno-ieee-fp and -march=pentiumpro
Product: Base System Reporter: Steve Roome <steve>
Component: gnuAssignee: David E. O'Brien <obrien>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   

Description Steve Roome 2000-09-04 15:00:08 UTC
	compiling code with -mno-ieee-fp and -march=pentiumpro
	cause cc1 to die with sig11 on comparison between float
	and integer

	e.g.
	gcc -mno-ieee-fp -march=pentiumpro -c particlesys.c -o particlesys.o
	gcc: Internal compiler error: program cc1 got fatal signal 11
	*** Error code 1

How-To-Repeat: 
	int main() {
        	double xv=0.2;
	        return (xv>0);
	}

	try to compile the above with -mno-ieee-fp and -march=pentiumpro
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-09-04 16:04:45 UTC
Responsible Changed
From-To: freebsd-bugs->obrien

The problem exists in 5.0-CURRENT as well.  Over to the 
maintainer.
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 2000-09-04 16:05:16 UTC
State Changed
From-To: open->feedback

David will probably want to know whether the problem exists 
in stock gcc without FreeBSD's modifications.  Can you test 
this out and provide feedback in the form of an e-mail 
message sent to <freebsd-gnats-submit@FreeBSD.org> with 
the subject line of this message?
Comment 3 sprice 2000-09-05 14:58:52 UTC
On Mon, Sep 04, 2000 at 08:06:26AM -0700, sheldonh@FreeBSD.org wrote:
> Synopsis: gcc bug with -mno-ieee-fp and -march=pentiumpro
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: sheldonh
> State-Changed-When: Mon Sep 4 08:05:16 PDT 2000
> State-Changed-Why: 
> David will probably want to know whether the problem exists
> in stock gcc without FreeBSD's modifications.  Can you test
> this out and provide feedback in the form of an e-mail
> message sent to <freebsd-gnats-submit@FreeBSD.org> with
> the subject line of this message?
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=21026

This problem appears also in a stock gcc-2.95.2 I've just built
on FreeBSD without any mods, same sig11 in cc1 when comparisons
between floats and ints are made.

N.B. the following code cause the problem :

main() {
	float a;
	if (a>0);
}

but this doesn't :

main() {
 	float a;
	if ((int)a>0);
}

Granted the second is effectively a little more correct, however it
still shouldn't segfault but warn about either casting the float to
int for the comparison or casting the 0 to float for comparison with
a. I'm still unsure which way round the problem is though, but it does
appear to be a gcc bug rather than a bug with the FreeBSD
modifications.

{
This stock gcc also crashes with -mno-move and -march=pentiumpro
as well, but that's triggering what seems like buggy gcc code rather
than some obscure sig11. : 
/usr/tempgcc/bin/gcc -O6 -march=pentiumpro -mno-move -c main.c -o main.o
main.c: In function `main':
main.c:206: Internal compiler error in `instantiate_virtual_regs_1', at function.c:3863
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
*** Error code 1
}
 
	Steve Roome
Comment 4 David E. O'Brien freebsd_committer freebsd_triage 2000-11-11 06:18:27 UTC
State Changed
From-To: feedback->closed

Since this bug also occurs in stock 2.95.2 GCC, it needs to be reported 
to gcc-bugs@gcc.gnu.org.