This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR 23572 warnings for out of range floating-point constants


:ADDPATCH C:

At the moment, there is a warning if a floating-point constant is too
large to fit in the type's range. In such cases the constant is
converted to +inf or -inf. However, there is no warning if the
constant is too small and it is taken as 0. The following patch adds
such warning following the advice of Joseph Myers
[http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01739.html], that is,
for overflow, emit a pedantic warning if infinities are not supported,
otherwise emit just a warning iff -Woverflow, while for underflow,
emit a warning iff -Woverflow.

The testcases are a bit weak. I am not sure how to check that the
target supports or doesn't support infinities. Do we have a
'check_effective_target_support_inf' ? How can I add one?

Cheers,

Manuel.

2007-03-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>

 PR other/23572
 * c-lex.c (interpret_float): On overflow, emit pedantic warning if
infinities not supported, otherwise emit warning if -Woverflow. On
underflow, emit warning if -Woverflow.

testsuite/
 * gcc.dg/float-range-4.c: New.
 * gcc.dg/float-range-1.c: Update. Test for a warning.
 * gcc.dg/float-range-3.c: New.
 * gcc.dg/float-range-5.c: New.

Attachment: wfloatunderflow-try3.diff
Description: Text document


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