Skip to content

Commit dd68853

Browse files
ntynitonycoz
authored andcommitted
Configure: fix garbage filtering with 80-bit long doubles
The test had several problems that resulted in the excess bytes not getting zeroed out. This caused random contents in $Config{longdblinfbytes}, observed on Debian with GCC 6.2.0 (but not 5.4.1). Bug-Debian: https://bugs.debian.org/844752
1 parent 3816c65 commit dd68853

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Configure

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20661,8 +20661,8 @@ $cat >try.c <<EOP
2066120661
#define DOUBLESIZE $doublesize
2066220662
#$d_longdbl HAS_LONG_DOUBLE
2066320663
#ifdef HAS_LONG_DOUBLE
20664-
#define LONGDBLSIZE $longdblsize
20665-
#define LONGDBLKIND $longdblkind
20664+
#define LONG_DOUBLESIZE $longdblsize
20665+
#define LONG_DOUBLEKIND $longdblkind
2066620666
#endif
2066720667
#$i_math I_MATH
2066820668
#ifdef I_MATH
@@ -20699,16 +20699,14 @@ int main(int argc, char *argv[]) {
2069920699
#ifdef HAS_LONG_DOUBLE
2070020700
long double ldinf = (long double)exp(1e9);
2070120701
long double ldnan = (long double)sqrt(-1.0);
20702-
#endif
20703-
if (argc == 2) {
20704-
switch (argv[1][0]) {
20705-
case '1': bytes(&dinf, sizeof(dinf)); break;
20706-
case '2': bytes(&dnan, sizeof(dnan)); break;
20707-
#ifdef HAS_LONG_DOUBLE
2070820702
# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
2070920703
/* the 80-bit long doubles might have garbage in their excess bytes */
2071020704
memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
2071120705
# endif
20706+
if (argc == 2) {
20707+
switch (argv[1][0]) {
20708+
case '1': bytes(&dinf, sizeof(dinf)); break;
20709+
case '2': bytes(&dnan, sizeof(dnan)); break;
2071220710
case '3': bytes(&ldinf, sizeof(ldinf)); break;
2071320711
case '4': bytes(&ldnan, sizeof(ldnan)); break;
2071420712
#endif

0 commit comments

Comments
 (0)