Bug#6047: badly initialized union in gcc include file
Package: gcc
Version: 2.7.2.1-2
-- Please describe the problems with the package here
Found a small syntactical blunder in
/usr/lib/gcc-lib/i486-linux/2.7.2.1/include/float.h:
/* float.h */
#ifndef _FLOAT_H___
#define _FLOAT_H___
/* Produced by enquire version 4.3, CWI, Amsterdam */
[...]
/* Number of base-FLT_RADIX digits in the significand of a long double */
#undef LDBL_MANT_DIG
#define LDBL_MANT_DIG 64
/* Number of decimal digits of precision in a long double */
#undef LDBL_DIG
#define LDBL_DIG 18
/* Difference between 1.0 and the minimum long double greater than 1.0 */
#undef LDBL_EPSILON
#ifndef __LDBL_UNION__
#define __LDBL_UNION__
union __convert_long_double {
unsigned __convert_long_double_i[4];
long double __convert_long_double_d;
};
#endif
#define LDBL_EPSILON (__extension__ ((union __convert_long_double) {0x0, 0x80000
000, 0x3fc0, 0x0}).__convert_long_double_d)
/* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
#undef LDBL_MIN_EXP
#define LDBL_MIN_EXP (-16381)
/* Minimum normalised long double */
#undef LDBL_MIN
#define LDBL_MIN (__extension__ ((union __convert_long_double) {0x0, 0x80000000,
0x1, 0x0}).__convert_long_double_d)
/* Minimum int x such that 10**x is a normalised long double */
#undef LDBL_MIN_10_EXP
#define LDBL_MIN_10_EXP (-4931)
/* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
#undef LDBL_MAX_EXP
#define LDBL_MAX_EXP 16384
/* Maximum long double */
#undef LDBL_MAX
#define LDBL_MAX (__extension__ ((union __convert_long_double) {0xffffffff, 0xff
ffffff, 0x107ffe, 0x0}).__convert_long_double_d)
/* Maximum int x such that 10**x is a representable long double */
#undef LDBL_MAX_10_EXP
#define LDBL_MAX_10_EXP 4932
#endif /* _FLOAT_H___ */
When initializing the int array in the union __convert_long_double, only a
single pair of braces is used, but since initialization rules apply
recursively, a pair is needed for both the union itself and the array.
Without them, innocent programs can generate compiler warnings.
Use the following code, compiled with -Wall, to demonstrate this:
#include <stdio.h>
#include <float.h>
void main(void)
{
/* These next two lines both generate this message:
* warning: missing braces around initializer for
* `(anonymous).__convert_long_double_i'
*/
printf("long double minimum = %Le\n", LDBL_MIN);
printf("long double maximum = %Le\n", LDBL_MAX);
}
This is probably something for the upstream maintainer.
-- System Information
Debian Release: 1.2
Kernel Version: Linux apocalypse 2.0.20 #1 Sat Sep 14 04:03:34 EST 1996 i486
Versions of the packages this package depends on:
libc5 Version: 5.4.13-1
-- bug report generated by the debmake bug tool
--
"If a man ate a pound of pasta and a pound of | G. Branden Robinson
antipasto, would they cancel out, leaving him | Purdue University
still hungry?" -- Scott Adams | branden@purdue.edu
Reply to: