In compilation of a large library of code for decimal floating-point
arithmetic, I found that compilations with -g would succeed, but most
would fail with -O1, -O2, or -O3 on IA-32. I've taken a single example
and chopped away extraneous code to produce a standalone file
that exhibits the compiler error:
% cat bug002.c
typedef _Decimal32 fp_t;
extern fp_t g(fp_t);
fp_t
bug(fp_t x)
{
fp_t result;
int n;
fp_t f, f3, y, z;
n = 0;
y = 1.DF;
f = g(x);
if (f < 0.DF)
f = -f;
f3 = 2.DF;
z = (y + y + f / (y * y));
y = (z + z) / (9.DF) + f3 / (z * z);
result = y;
return (result);
}
% gcc --version
gcc (GCC) 4.3.0 20070316 (experimental)
% gcc -c -O1 bug002.c
bug002.c: In function 'bug':
bug002.c:27: error: unable to find a register to spill in class 'GENERAL_REGS'
bug002.c:27: error: this is the insn:
(insn 25 24 26 3 (set (subreg:SI (reg/v:SD 59 [ f ]) 0)
(plus:SI (subreg:SI (reg/v:SD 59 [ f ]) 0)
(const_int -2147483648 [0x80000000]))) 144 {*lea_1} (nil)
(nil))
bug002.c:27: internal compiler error: in spill_failure, at reload1.c:1944
--
Summary: gcc fails to find spill register for decimal arithmetic
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: beebe at math dot utah dot edu
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31385