public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jsm28 at gcc dot gnu dot org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/3516] New: Simplify bits/mathdef.h files Date: Mon, 13 Nov 2006 17:54:00 -0000 [thread overview] Message-ID: <20061113175424.3516.jsm28@gcc.gnu.org> (raw) 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.
next reply other threads:[~2006-11-13 17:54 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-11-13 17:54 jsm28 at gcc dot gnu dot org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20061113175424.3516.jsm28@gcc.gnu.org \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).