public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "qiyaoltc at cn dot ibm dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra Date: Mon, 29 Aug 2005 03:10:00 -0000 [thread overview] Message-ID: <20050829025747.8823.qmail@sourceware.org> (raw) In-Reply-To: <20050826075201.23572.qiyaoltc@cn.ibm.com> ------- Additional Comments From qiyaoltc at cn dot ibm dot com 2005-08-29 02:57 ------- OK. GCC version: 3.4.3 20050227 (Red Hat 3.4.3-22.1) GNU C Library: stable release version 2.3.4 OS : Red Hat Enterprise Linux AS release 4 (Nahant Update 1) I write a small example named overflow-test.c, here is the source code: 1 #include<stdio.h> 2 int main() 3 { 4 /* overflow. */ 5 float f1 = 3.5E+38; 6 /* underflow. */ 7 float f2 = 3.3E-46; 8 /* overflow. */ 9 double d1 = 1.9E+308; 10 /* underflow. */ 11 double d2 = 1.4E-325; 12 /* overflow, 2**32. */ 13 int i = 4294967296; 14 15 printf("%e,%e,%e,%e\n",f1,f2,d1,d2); 16 printf("%d\n",i); 17 return 0; 18 } And I compile it like this: [qiyao@patch]$ gcc -o overflow-test -Wextra -Wall -g overflow-test.c overflow-test.c: In function `main': overflow-test.c:13: warning: integer constant is too large for "long" type overflow-test.c:13: warning: overflow in implicit constant conversion I run it, [qiyao@patch]$ ./overflow-test inf,0.000000e+00,inf,0.000000e+00 0 I hope this example would be helpful. Any comments are highly aprreciated! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572
next prev parent reply other threads:[~2005-08-29 2:57 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-08-26 7:56 [Bug other/23572] New: " qiyaoltc at cn dot ibm dot com 2005-08-26 12:53 ` [Bug other/23572] " pinskia at gcc dot gnu dot org 2005-08-29 3:10 ` qiyaoltc at cn dot ibm dot com [this message] 2005-08-29 3:35 ` pinskia at gcc dot gnu dot org 2005-08-29 5:18 ` qiyaoltc at cn dot ibm dot com [not found] <bug-23572-11241@http.gcc.gnu.org/bugzilla/> 2006-11-25 15:24 ` manu at gcc dot gnu dot org 2007-01-09 15:09 ` manu at gcc dot gnu dot org 2007-01-21 16:01 ` patchapp at dberlin dot org 2007-01-22 17:05 ` manu at gcc dot gnu dot org 2007-03-14 18:15 ` patchapp at dberlin dot org 2007-03-21 21:05 ` patchapp at dberlin dot org 2007-03-22 23:04 ` manu at gcc dot gnu dot org 2007-03-22 23:12 ` manu at gcc dot gnu dot org 2007-04-05 23:58 ` pinskia at gcc dot gnu dot org 2007-04-06 11:25 ` manu at gcc dot gnu dot org 2007-04-06 18:58 ` danglin at gcc dot gnu dot org
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=20050829025747.8823.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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).