delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/06/20/05:53:47

Message-ID: <000d01c33711$d3286f00$0100a8c0@acp42g>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: <djgpp-workers AT delorie DOT com>
References: <000b01c31df6$5e2e9fa0$0100a8c0 AT acp42g>
Subject: LIBC patch for GCC 3.3 - preminary check
Date: Fri, 20 Jun 2003 19:53:38 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Reply-To: djgpp-workers AT delorie DOT com

All,

Before I submit patches for the files I have changed (and before I finish
making all of the changes) I would like to find out if the changes are
potentially acceptable. Below is a diff for strtod.c so it will build with
GCC 3.3 as an example of the type of changes that I may need to make to a
number of files.

Is this type of change okay?  If not, any info on pointing me in the right
direction would be gratfully appreciated.

If all goes well I should be able to work on this for allot of tomorrow in
order to do a second attempt at a set of patches for the source code in
order to get GCC 3.3 to be able to build the LIBC source with some makefile
changes for C++ files. Once I do the source patches I will have another look
at the C++ makefile changes.

Index: strtod.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdlib/strtod.c,v
retrieving revision 1.7
diff -u -w -b -i -r1.7 strtod.c
--- strtod.c 25 May 2003 19:03:43 -0000 1.7
+++ strtod.c 20 Jun 2003 09:48:04 -0000
@@ -73,12 +73,17 @@
/* Handle NAN and NAN(<whatever>). */
if ( ! strnicmp( "NAN", s, 3 ) )
{
- double tmp_d = NAN;
- double_t n = *(double_t *)(&tmp_d);
+ union a_union
+ {
+ double tmp_d ;
+ double_t n;
+ } t;
+
+ t.tmp_d = NAN;
if ( sign < 0 )
{
- n.sign = 1;
+ t.n.sign = 1;
}
if( s[3] == '(' )
@@ -92,14 +97,14 @@
mantissa_bits = mantissa_bits & 0xfffffffffffffULL;
if( mantissa_bits )
{
- n.mantissal = mantissa_bits & 0xffffffff;
- n.mantissah = (mantissa_bits >> 32) & 0xfffff;
+ t.n.mantissal = mantissa_bits & 0xffffffff;
+ t.n.mantissah = (mantissa_bits >> 32) & 0xfffff;
}
if( sret )
{
*sret = endptr+1;
}
- return *(double *)(&n);
+ return (t.tmp_d);
}
/* The subject sequence didn't match NAN(<hex-number>), so match
@@ -110,7 +115,7 @@
{
*sret = unconst((&s[3]), char *);
}
- return *(double *)(&n);
+ return (t.tmp_d);
}
/* Handle ordinary numbers. */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019