diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-22 23:04:24 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-22 23:04:24 +0000 |
commit | 64214dabd303be6b1134238ee99d05be78e83ff8 (patch) | |
tree | 72ccc17238a98a5218797e0019368cff25e58e57 /gcc/testsuite/gcc.dg/float-range-1.c | |
parent | f2c255d4fa65514614d673a9e440dbe2b92b60b7 (diff) | |
download | gcc-64214dabd303be6b1134238ee99d05be78e83ff8.tar.gz |
2007-03-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123137 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/float-range-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/float-range-1.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/testsuite/gcc.dg/float-range-1.c b/gcc/testsuite/gcc.dg/float-range-1.c index e14e345aba3..386d75dccd4 100644 --- a/gcc/testsuite/gcc.dg/float-range-1.c +++ b/gcc/testsuite/gcc.dg/float-range-1.c @@ -1,13 +1,14 @@ /* Floating constants outside the range of their type should receive a - pedwarn, not a warning. */ + just a warning if the target supports infinities. Otherwise, a + pedwarn should be produced. */ /* Origin: Joseph Myers <jsm@polyomino.org.uk> */ /* { dg-do compile } */ -/* { dg-options "-ansi -pedantic-errors" } */ +/* { dg-options "-ansi -pedantic-errors -Woverflow" } */ void f (void) { - float a = 1e+100000000f; /* { dg-error "error: floating constant exceeds range of 'float'" } */ - double b = 1e+100000000; /* { dg-error "error: floating constant exceeds range of 'double'" } */ - long double c = 1e+100000000l; /* { dg-error "error: floating constant exceeds range of 'long double'" } */ + float a = 1e+100000000f; /* { dg-warning "warning: floating constant exceeds range of 'float'" "" } */ + double b = 1e+100000000; /* { dg-warning "warning: floating constant exceeds range of 'double'" } */ + long double c = 1e+100000000l; /* { dg-warning "warning: floating constant exceeds range of 'long double'" } */ } |