[Bug c/22576] New: ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com
Hello. Sorry if the summary is a little vague, I dont really know a whole bunch
about gcc terminology ;) So anyway, I wrote a simple program in C that computes
the factorials of numbers 1 through 100 (yes, after 7 they get super big). When
this program is compiled as 

gcc -ffast-math factorial.c

I get an ICE;

[EMAIL PROTECTED]:~/c$ gcc -Wall -ffast-math factorials.c
factorials.c:8: warning: return type defaults to ‘int’
factorials.c: In function ‘main’:
factorials.c:24: internal compiler error: in instantiate_virtual_regs_lossage,
at function.c:1442
[EMAIL PROTECTED]:~/c$ gcc -dumpversion
4.0.2

This gcc is from Ubuntu-breezy, gcc-4.0 branch, CVS 20050718. Running on a
Pentium 4.

It told me to report this bug, so here I am :) Regardless of whether this can be
done in a simpler manner, and I'm /sure/ it can, I dont think gcc should die
because of it. The offending code is attached. -save-temps output also attached.

-- 
   Summary: ICE with simple factorial program compiled with -ffast-
math on gcc 4.0.2
   Product: gcc
   Version: 4.0.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: black dot hole dot sun16 at gmail dot com
CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576


[Bug c/22576] ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com

--- Additional Comments From black dot hole dot sun16 at gmail dot com  
2005-07-20 19:29 ---
Created an attachment (id=9309)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9309&action=view)
bug causing program...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576


[Bug c/22576] ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com

--- Additional Comments From black dot hole dot sun16 at gmail dot com  
2005-07-20 19:29 ---
Created an attachment (id=9310)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9310&action=view)
-save-temps output


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576


[Bug c/22576] ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com

--- Additional Comments From black dot hole dot sun16 at gmail dot com  
2005-07-20 19:30 ---
Created an attachment (id=9311)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9311&action=view)
-save-temps output


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576


[Bug c/22576] ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com

--- Additional Comments From black dot hole dot sun16 at gmail dot com  
2005-07-20 19:32 ---
If it is at all relevant, I'm using the glibc that breezy provides (2.3.5).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576


[Bug target/22576] ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com

--- Additional Comments From black dot hole dot sun16 at gmail dot com  
2005-07-20 19:33 ---
Created an attachment (id=9312)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9312&action=view)
#included file


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576


[Bug target/22576] [4.0/4.1 regression] ICE with simple factorial program compiled with -ffast-math on gcc 4.0.2

2005-07-20 Thread black dot hole dot sun16 at gmail dot com

--- Additional Comments From black dot hole dot sun16 at gmail dot com  
2005-07-20 23:13 ---
(From update of attachment 9309)
>#include 
>
>/* Program prints the first 10 postitive integers and their factorials */
>
>main()
>{
>long double i, j, k = 1;
>
>for(i = 1; i <= 100; i++) 
>   {
>   for(j = i; j > 0; j = j - 1)
>   {   
>   k = k * j;  
>   if(j == 1)  
>   {
>   printf("factorial of %Lf is %Lf\n", i, k);
>   k = 1; 
>   }
>   }
>   }
>   return 0;
>}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22576