diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-20 16:09:45 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-20 16:09:45 +0000 |
commit | 9c591bd0849e4ed59a584aeced67053944f13b0b (patch) | |
tree | e4b280fa4d233f4a7258a47cdc899fe8254038f0 /gcc/testsuite/gcc.dg/Wconversion-real-integer.c | |
parent | 0011dedbd9dbfa01b2f4d3390ef3ed2d6ea1dd6d (diff) | |
download | gcc-9c591bd0849e4ed59a584aeced67053944f13b0b.zip gcc-9c591bd0849e4ed59a584aeced67053944f13b0b.tar.gz gcc-9c591bd0849e4ed59a584aeced67053944f13b0b.tar.bz2 |
re PR c/35701 (Quieten -Wconversion warnings)
2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 35701
* c-common.c (conversion_warning): Do not warn if applying bit-and
operator to unsigned constant that fits in the target type.
testsuite/
* gcc.dg/pr35701.c: New.
* gcc.dg/Wconversion-real-integer.c: Add more tests.
* gcc.dg/Wconversion-pr34389.c: Update.
* g++.dg/warn/Wconversion-pr34389.C: Update.
From-SVN: r139329
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wconversion-real-integer.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wconversion-real-integer.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/Wconversion-real-integer.c b/gcc/testsuite/gcc.dg/Wconversion-real-integer.c index 1c03ba4..1625fc0 100644 --- a/gcc/testsuite/gcc.dg/Wconversion-real-integer.c +++ b/gcc/testsuite/gcc.dg/Wconversion-real-integer.c @@ -4,7 +4,7 @@ /* { dg-do compile } /* { dg-skip-if "doubles are floats,ints are 16bits" { "avr-*-*" } { "*" } { "" } } */ /* { dg-options "-std=c99 -Wconversion" } */ - +/* { dg-require-effective-target int32plus } */ #include <limits.h> void fsi (signed int x); @@ -71,4 +71,42 @@ void h (void) } +void fss (signed short x); +void fus (unsigned short x); +void fsc (signed char x); +void fuc (unsigned char x); + +void h2 (void) +{ + unsigned short int us; + short int ss; + unsigned char uc; + signed char sc; + + fss (4294967294.0); /* { dg-warning "conversion" } */ + ss = 4294967294.0; /* { dg-warning "conversion" } */ + fss (-4294967294.0); /* { dg-warning "conversion" } */ + ss = -4294967294.0; /* { dg-warning "conversion" } */ + fus (4294967294.0); /* { dg-warning "conversion" } */ + us = 4294967294.0; /* { dg-warning "conversion" } */ + fus (-4294967294.0); /* { dg-warning "conversion" } */ + us = -4294967294.0; /* { dg-warning "conversion" } */ + fsc (500.0); /* { dg-warning "conversion" } */ + sc = 500.0; /* { dg-warning "conversion" } */ + fsc (-500.0); /* { dg-warning "conversion" } */ + sc = -500.0; /* { dg-warning "conversion" } */ + fuc (500.0); /* { dg-warning "conversion" } */ + uc = 500.0; /* { dg-warning "conversion" } */ + fuc (-500.0); /* { dg-warning "conversion" } */ + uc = -500.0; /* { dg-warning "conversion" } */ + + fss (500.0); + ss = 500.0; + fss (-500.0); + ss = -500.0; + fus (500.0); + us = 500.0; + fus (-500.0); /* { dg-warning "conversion" } */ + us = -500.0; /* { dg-warning "conversion" } */ +} |