This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Itai Nahshon <nahshon@actcom.co.il>] RedHat-6.0 fails to compile with -ansi -pedantic



The patch in the appended email addresses a problem that Thorsten
Kukuk already mentioned last week (Subject: mathinline.h).  Should we
add this or is there a better solution?

Andreas



Topics:
   RedHat-6.0 fails to compile with -ansi -pedantic


----------------------------------------------------------------------

Date: Wed, 26 May 1999 01:15:33 +0300
From: Itai Nahshon <nahshon@actcom.co.il>
To: bug-glibc@gnu.org
Subject: RedHat-6.0 fails to compile with -ansi -pedantic
Message-ID: <374B2105.CB7596C9@actcom.co.il>
Content-Type: multipart/mixed;
 boundary="------------2AE47368733C3D738C0A2E17"

This is a multi-part message in MIME format.
- -------------2AE47368733C3D738C0A2E17
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,
I recently upgraded my system to RedHat-6.0 and afterwards fail to compile programs that
include <math.h> and use the compile options -ansi and -pedantic.

RH-6.0 installs the following RPM packages:
  glibc-devel-2.1.1-6
  egcs-1.1.2-12

I found that the problem is with the include file "/usr/include/bits/mathinline.h" which is
part of glibc-1.1.2. When using these options, any files in /usr/include/bits probably should
not be included at all as they contain machine dependent and compiler dependent code.
(but I would not know how to check these options in preprocessor directives).

As a quick fix I suggest the attached patch. That removes any dependence on GCC special
syntax which is not part of the ANSI C standard.
Dependency on endian-ness and on machine representation of floating point types remains.

Comparing assembly output from compiling with both files does not give identical
results. Maybe the egcs guys should take a look at that.

Thank you very much,
Itai
- - 
Itai Nahshon   nahshon@actcom.co.il
        Also   nahshon@vnet.ibm.com
- -------------2AE47368733C3D738C0A2E17
Content-Type: text/plain; charset=us-ascii;
 name="glibc211.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="glibc211.diff"

- -- usr/include/bits/mathinline.h.ORIG	Sat Apr 17 01:48:35 1999
+++ usr/include/bits/mathinline.h	Mon May 24 20:53:55 1999
@@ -114,17 +114,17 @@
 __MATH_INLINE int
 __signbitf (float __x)
 {
-   union { float __f; int __i; } __u = { __f: __x }; return __u.__i < 0;
+  union { float __f; int __i; } __u; __u.__f = __x; return __u.__i < 0;
 }
 __MATH_INLINE int
 __signbit (double __x)
 {
-   union { double __d; int __i[2]; } __u = { __d: __x }; return __u.__i[1] < 0;
+  union { double __d; int __i[2]; } __u; __u.__d = __x; return __u.__i[1] < 0;
 }
 __MATH_INLINE int
 __signbitl (long double __x)
 {
-   union { long double __l; int __i[3]; } __u = { __l: __x };
+  union { long double __l; int __i[3]; } __u; __u.__l = __x;
   return (__u.__i[2] & 0x8000) != 0;
 }
 #endif

- -------------2AE47368733C3D738C0A2E17--


------------------------------

End of forwardGPAcJV Digest
***************************



-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]