I tried compilers 4.1.0 through mainline and none of them warn about nitializing a float variable with a value that will overflow, underflow, or lose precision for -W or -Wextra.
But in GCC info, It is said like this: in GCC info(GCC 3.3.4). `-Wextra' (This option used to be called `-W'. The older name is still supported, but the newer name is more descriptive.) Print extra warning messages for these events: ........ * Any of several floating-point events that often indicate errors, such as overflow, underflow, loss of precision, etc. Is this a bug either in GCC or a bug in documentation? -- Summary: No warning for assigning a value to a 'float' variable that overflows with option -Wextra Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: qiyaoltc at cn dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org,janis187 at us dot ibm dot com GCC build triplet: ppc64-redhat-linux GCC host triplet: ppc64-redhat-linux GCC target triplet: ppc64-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572