diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-12 15:41:49 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-12 15:41:49 +0000 |
commit | 0dc99c85ab5d64d9df3244ba25f0d52c41654d5a (patch) | |
tree | 4d63038be796e8fcc6cbc95e125ec2ead6069df9 | |
parent | 8458c9e9352e2a6695f24cee1948237d77a4df75 (diff) | |
download | gcc-0dc99c85ab5d64d9df3244ba25f0d52c41654d5a.tar.gz |
PR middle-end/55771
* convert.c (convert_to_real): Reject non-float inner types.
testsuite/
* c-c++-common/pr55771.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200926 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/convert.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr55771.c | 12 |
4 files changed, 25 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf75708f585..cc3b7daf790 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-07-12 Michael Matz <matz@suse.de> + + PR middle-end/55771 + * convert.c (convert_to_real): Reject non-float inner types. + 2013-07-12 Tejas Belagod <tejas.belagod@arm.com> * config/aarch64/aarch64-protos.h diff --git a/gcc/convert.c b/gcc/convert.c index 62ff224b566..9ecef4247ba 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -213,11 +213,12 @@ convert_to_real (tree type, tree expr) switch (TREE_CODE (expr)) { /* Convert (float)-x into -(float)x. This is safe for - round-to-nearest rounding mode. */ + round-to-nearest rounding mode when the inner type is float. */ case ABS_EXPR: case NEGATE_EXPR: if (!flag_rounding_math - && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr))) + && FLOAT_TYPE_P (itype) + && TYPE_PRECISION (type) < TYPE_PRECISION (itype)) return build1 (TREE_CODE (expr), type, fold (convert_to_real (type, TREE_OPERAND (expr, 0)))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 061a8427258..41cea555cd2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-12 Michael Matz <matz@suse.de> + + PR middle-end/55771 + * c-c++-common/pr55771.c: New test. + 2013-07-12 Tejas Belagod <tejas.belagod@arm.com> * gcc.target/aarch64/vect-movi.c: New. diff --git a/gcc/testsuite/c-c++-common/pr55771.c b/gcc/testsuite/c-c++-common/pr55771.c new file mode 100644 index 00000000000..16f02442c11 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr55771.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ + +float global; +int main() +{ + unsigned long z = 1; + float x = -z; + global = x; + if (global < 0) + __builtin_abort (); + return 0; +} |