gcc-4.3-20070316 and gcc-4.2-20070307 both fail to compile this
one-line file on Mac OS X 10.4.9 (up to current Apple patch levels):
% cat foo.c
static const long double X = (27.0L) / (35.0L);
% gcc-4.3-20070316 -c foo.c
foo.c:1: error: initializer element is not constant
If the divisor is changed to 32.0L, it compiles, as does any similar
statement where the right-hand side can be evaluated exactly.
The compilers were built like this:
nice time env LDFLAGS="-L/usr/local/lib" \
../gcc-4.3-20070316/configure \
--enable-decimal-float \
--enable-languages=c,c++ \
--with-gmp=/usr/local \
--with-mpfr=/usr/local
nice time make bootstrap
Similar code with float and double initializers compiles without problems.
--
Summary: gcc fails to compile simple long double initializers
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: powerpc-apple-darwin8.9.0
GCC host triplet: powerpc-apple-darwin8.9.0
GCC target triplet: powerpc-apple-darwin8.9.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31321