[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-04-06 Thread manu at gcc dot gnu dot org


--- Comment #14 from manu at gcc dot gnu dot org  2007-04-06 12:25 ---
 /home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/float-range-3.c:10: error:
 'FP_INFINITE' undeclared (first use in this function)

Is FP_INFINITE undeclared in spu-elf?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-04-06 Thread danglin at gcc dot gnu dot org


--- Comment #15 from danglin at gcc dot gnu dot org  2007-04-06 19:58 
---
The same errors occur on hppa*-*-hpux*.  FP_INFINITE isn't defined in
HP-UX 10.  For HP-UX 11, we need -D_HPUX_SOURCE to get math.h to define
FP_INFINITE.


-- 

danglin at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||danglin at gcc dot gnu dot
   ||org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-04-05 Thread pinskia at gcc dot gnu dot org


--- Comment #13 from pinskia at gcc dot gnu dot org  2007-04-06 00:58 
---
These testcases fail on spu-elf:
+FAIL: gcc.dg/float-range-1.c  (test for warnings, line 11)
+FAIL: gcc.dg/float-range-1.c (test for excess errors)
+FAIL: gcc.dg/float-range-3.c (test for excess errors)
+FAIL: gcc.dg/float-range-4.c (test for excess errors)
+FAIL: gcc.dg/float-range-5.c  (test for warnings, line 9)
+FAIL: gcc.dg/float-range-5.c  (test for warnings, line 10)
+FAIL: gcc.dg/float-range-5.c (test for excess errors)


FAIL: gcc.dg/float-range-1.c (test for excess errors) Excess errors:
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/float-range-1.c:11: error:
floating constant exceeds range of 'float'

Excess errors:
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/float-range-3.c:10: error:
'FP_INFINITE' undeclared (first use in this function)
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/float-range-3.c:10: error:
(Each undeclared identifier is reported only once
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/float-range-3.c:10: error: for
each function it appears in.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-03-22 Thread manu at gcc dot gnu dot org


--- Comment #11 from manu at gcc dot gnu dot org  2007-03-22 23:04 ---
Subject: Bug 23572

Author: manu
Date: Thu Mar 22 23:04:24 2007
New Revision: 123137

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=123137
Log:
2007-03-22  Manuel Lopez-Ibanez  [EMAIL PROTECTED]

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.
* real.c (real_from_string): Return -1 if underflow, +1 if overflow
and 0 otherwise.
* real.h (real_from_string): Update declaration
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.

Added:
trunk/gcc/testsuite/gcc.dg/float-range-3.c
trunk/gcc/testsuite/gcc.dg/float-range-4.c
trunk/gcc/testsuite/gcc.dg/float-range-5.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-lex.c
trunk/gcc/real.c
trunk/gcc/real.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/float-range-1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-03-22 Thread manu at gcc dot gnu dot org


--- Comment #12 from manu at gcc dot gnu dot org  2007-03-22 23:12 ---
Fixed for GCC 4.3


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-03-21 Thread patchapp at dberlin dot org


--- Comment #10 from patchapp at dberlin dot org  2007-03-21 21:05 ---
Subject: Bug number PR 23572

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01437.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-03-14 Thread patchapp at dberlin dot org


--- Comment #9 from patchapp at dberlin dot org  2007-03-14 18:15 ---
Subject: Bug number PR 23572

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00943.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-01-22 Thread manu at gcc dot gnu dot org


--- Comment #8 from manu at gcc dot gnu dot org  2007-01-22 17:05 ---
*** Bug 20764 has been marked as a duplicate of this bug. ***


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-01-21 Thread patchapp at dberlin dot org


--- Comment #7 from patchapp at dberlin dot org  2007-01-21 16:01 ---
Subject: Bug number PR 23572

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01730.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2007-01-09 Thread manu at gcc dot gnu dot org


--- Comment #6 from manu at gcc dot gnu dot org  2007-01-09 15:09 ---
(In reply to comment #0)
 
 Is this a bug either in GCC or a bug in documentation?
 

It is a bug in the documentation. As today in GCC 4.3 there is not a single
Wextra warning that has anything to do with floating-point events.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2006-11-25 Thread manu at gcc dot gnu dot org


--- Comment #5 from manu at gcc dot gnu dot org  2006-11-25 15:24 ---
Why this is marked as other ? This is either a problem on the C/C++
front-ends or it is a problem in the middle-end that doesn't handle the
overflow/underflow correctly during conversion, isn't it?

Also, this happens also for i686-pc-gnu-linux and I guess for almost any
possible host/target, so perhaps Host and Target should say something
different.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||manu at gcc dot gnu dot org
  Known to fail|2.95.3 3.2.3 3.4.0 4.0.0|2.95.3 3.2.3 3.4.0 4.0.0
   |4.1.0   |4.1.0 4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572



[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2005-08-28 Thread qiyaoltc at cn dot ibm dot 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 #includestdio.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.00e+00,inf,0.00e+00
0


I hope this example would be helpful.  Any comments are highly aprreciated!

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572


[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2005-08-28 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-29 
03:10 ---
I think there are some real interesting issues here.
First with -pedantic we get a warning for line 9 but nothing more.  If we add f 
to the end of the 
constant on line 5, we then get a warning.  

And yes your example was useful. 

The interesting thing is that we don't get a warning for the following code:
  double d1 = 1.9E+308 + 1.;
which should warn.

-- 
   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
   Keywords||diagnostic
  Known to work||2.95.3 3.2.3 3.4.0 4.0.0
   ||4.1.0
   Last reconfirmed|-00-00 00:00:00 |2005-08-29 03:10:00
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572


[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2005-08-28 Thread qiyaoltc at cn dot ibm dot com

--- Additional Comments From qiyaoltc at cn dot ibm dot com  2005-08-29 
05:00 ---
I add suffix f to the end of float constants at line 5 and line 7, and add
option -pedantic, the output from gcc is like this:

overflow-test.c:5: warning: floating constant exceeds range of float
overflow-test.c:9: warning: floating constant exceeds range of double
overflow-test.c:13: warning: integer constant is too large for long type
overflow-test.c:13: warning: overflow in implicit constant conversion

It seems that gcc has checked initialization which caused overflow, but do not
check underflow, that is to say:
1 GCC does not check underflow event, at least options -pedantic does not enable
underflow check.
2 If there is some mechanism in GCC internal to check underflow and overflow,
there is a bug in gcc info about the description of -Wextra option.

Could you tell me what I could do to this problem?  Maybe, it is impossible for
me to fix it, but I just want to do something more.  Please give me some
suggestions and I will try to do it.

Thanks.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572


[Bug other/23572] No warning for assigning a value to a 'float' variable that overflows with option -Wextra

2005-08-26 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-26 
12:51 ---
Can you show an example?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23572