Manuel López-Ibáñez - PR 23572 warnings for out of range floating-point constants (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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] |
- From: "Manuel López-Ibáñez"
- To: gcc-patches
- Date: Sun, 21 Jan 2007 15:57:12 +0000
- Subject: PR 23572 warnings for out of range floating-point constants
:ADDPATCH c/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. It also adds the possibility of enabling the warning not only with -pedantic but also with -Wconversion (since it fits its definition).
Bootstrapped and regression tested with --enable-languages=all.
I could only test using i686-pc-linux-gnu. Any suggestions to make the tests more portable?
OK for mainline?2007-01-21 Manuel Lopez-Ibanez manu@gcc.gnu.org
PR other/23572
- c-lex.c (interpret_float): Warn if the constant is too small and thus it is taken as 0. Warn with -pedantic or -Wconversion.
testsuite/
- gcc.dg/gcc.dg/pr23572.c: New. Test with -pedantic
- gcc.dg/gcc.dg/pr23572-2.c: New. Test with -pedantic-errors.
- gcc.dg/gcc.dg/pr23572-3.c: New. Test with -Wconversion.
Attachment:wfloatunderflow.diff
Description: Text document
- Follow-Ups:
- Re: PR 23572 warnings for out of range floating-point constants
* From: Joseph S. Myers
- Re: PR 23572 warnings for out of range floating-point constants
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |