------- 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:
[EMAIL PROTECTED] 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,
[EMAIL PROTECTED] ./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

Reply via email to