This is the mail archive of the
mailing list for the GCC project.
Re: Patch to pedwarn for out-of-range floating constants
- From: Zack Weinberg <zack at codesourcery dot com>
- To: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 08 Oct 2004 13:09:46 -0700
- Subject: Re: Patch to pedwarn for out-of-range floating constants
- References: <Pine.LNX.firstname.lastname@example.org>
"Joseph S. Myers" <email@example.com> writes:
> The diagnostic for an out-of-range floating-point constant was a
> warning rather than a pedwarn, with the comment
> /* A diagnostic is required for "soft" overflow by some ISO C
> testsuites. This is not pedwarn, because some people don't want
> an error for this.
> ??? That's a dubious reason... is this a mandatory diagnostic or
> isn't it? -- zw, 2001-08-21. */
> C90, C99 and C++03 all require a diagnostic here, so it should be a
> pedwarn: if you want an infinity, use __builtin_inf*. This patch
> makes it a pedwarn. Indeed, I wonder whether it should actually be a
> mandatory pedwarn rather than a pedwarn-if-pedantic, since
> __builtin_inf* exist, users should be using the C99 macro INFINITY and
> system headers can be fixincluded to use __builtin_inf* if needed.
> (The pedwarn for __builtin_inf* if the target does not support
> infinities is also required by the definition of INFINITY in C99;
> there's even a footnote pointing to the relevant constraint; and
> __builtin_inf* are meant to be usable to define INFINITY for all targets.)
> Bootstrapped with no regressions on i686-pc-linux-gnu. OK to commit
> (the builtins.c change)?
OK. Could you please add a comment to builtins.c pointing to the
relevant section of C99?
I'm delighted to see this query of mine getting addressed, only three
years later. ;-)