public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/3516] New: Simplify bits/mathdef.h files
@ 2006-11-13 17:54 jsm28 at gcc dot gnu dot org
  2006-11-13 17:55 ` [Bug libc/3516] " jsm28 at gcc dot gnu dot org
  2006-11-13 19:32 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-11-13 17:54 UTC (permalink / raw)
  To: glibc-bugs

bits/mathdef.h defines float_t to be the type the compiler uses for arithmetic
on float values.  If FLT_EVAL_METHOD is 0, then C99 (7.12#2) requires float_t to
be float; FLT_EVAL_METHOD is 0 with GCC on all processors except x86 and m68k
(so float_t being something else in glibc indicates a bug in either GCC or
glibc, except on those processors).

For some processors such as PowerPC, glibc has the following logic to determine
float_t:

# ifdef __GNUC__
#  if __STDC__ == 1

/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
typedef float float_t;          /* `float' expressions are evaluated as
                                   `float'.  */
typedef double double_t;        /* `double' expressions are evaluated as
                                   `double'.  */

#  else

/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
typedef double float_t;         /* `float' expressions are evaluated as
                                   `double'.  */
typedef double double_t;        /* `double' expressions are evaluated as
                                   `double'.  */

#  endif
# else

/* Wild guess at types for float_t and double_t. */
typedef double float_t;
typedef double double_t;

# endif

This has several problems:

* The __STDC__ == 1 conditional is interpreted by GCC's fixincludes as intended
to mean strict conformance mode, and so is rewritten to check __STRICT_ANSI__,
meaning that in default non-strict mode you actually get the incorrect double type.

* glibc doesn't support pre-standard C at all.  There's no point in having
__STDC__ checks *anywhere* in glibc to allow for pre-standard C.  GCC hasn't
supported -traditional for some time either.  Anyway, these are C99 definitions;
hardly likely to be of use in a compatibility mode for ancient code.

* The "Wild guess" default of double for float_t for other compilers is unlikely
to be right; these processors support float arithmetic, so other compilers are
more likely to use float arithmetic.

Thus it's simpler, more accurate and avoids the header being changed by
fixincludes just to use

typedef float float_t;
typedef double double_t;

unconditionally for these targets.  I'll attach a patch to do so.

-- 
           Summary: Simplify bits/mathdef.h files
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3516

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/3516] Simplify bits/mathdef.h files
  2006-11-13 17:54 [Bug libc/3516] New: Simplify bits/mathdef.h files jsm28 at gcc dot gnu dot org
@ 2006-11-13 17:55 ` jsm28 at gcc dot gnu dot org
  2006-11-13 19:32 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-11-13 17:55 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2006-11-13 17:55 -------
Created an attachment (id=1416)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1416&action=view)
Patch to simplify bits/mathdef.h files.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3516

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/3516] Simplify bits/mathdef.h files
  2006-11-13 17:54 [Bug libc/3516] New: Simplify bits/mathdef.h files jsm28 at gcc dot gnu dot org
  2006-11-13 17:55 ` [Bug libc/3516] " jsm28 at gcc dot gnu dot org
@ 2006-11-13 19:32 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2006-11-13 19:32 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-11-13 19:32 -------
There is *NO* reason whatsoever to make the change.  Changing just for the sake
of it won't happen.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


http://sourceware.org/bugzilla/show_bug.cgi?id=3516

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-13 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-13 17:54 [Bug libc/3516] New: Simplify bits/mathdef.h files jsm28 at gcc dot gnu dot org
2006-11-13 17:55 ` [Bug libc/3516] " jsm28 at gcc dot gnu dot org
2006-11-13 19:32 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).