diff options
author | Michael Matz <matz@suse.de> | 2013-07-12 15:41:49 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2013-07-12 15:41:49 +0000 |
commit | 18b0ea8fce2dfd832d6a66c8b02bbf0af62502e9 (patch) | |
tree | 4d63038be796e8fcc6cbc95e125ec2ead6069df9 /gcc | |
parent | e4f0f84d56bccc7ffcbf2ba7def8bcc7cb921b6b (diff) | |
download | gcc-18b0ea8fce2dfd832d6a66c8b02bbf0af62502e9.zip gcc-18b0ea8fce2dfd832d6a66c8b02bbf0af62502e9.tar.gz gcc-18b0ea8fce2dfd832d6a66c8b02bbf0af62502e9.tar.bz2 |
re PR middle-end/55771 (Negation and type conversion incorrectly exchanged)
PR middle-end/55771
* convert.c (convert_to_real): Reject non-float inner types.
testsuite/
* c-c++-common/pr55771.c: New test.
From-SVN: r200926
Diffstat (limited to 'gcc')
-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 bf75708..cc3b7da 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 62ff224..9ecef42 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 061a842..41cea55 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 0000000..16f0244 --- /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; +} |