From: Roger Sayle Date: Sun, 8 Aug 2004 18:55:34 +0000 (+0000) Subject: re PR middle-end/16790 (Integer down cast ignored in larger expression) X-Git-Tag: releases/gcc-3.3.5~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=468c57cf1f1358b5643abaa05b247665dde1a0df;p=thirdparty%2Fgcc.git re PR middle-end/16790 (Integer down cast ignored in larger expression) 2004-08-08 Roger Sayle PR middle-end/16790 Backport from mainline. * fold-const.c (expand_muldiv_1) : Disallow local truncations, not just global truncations. * gcc.c-torture/execute/pr16790-1.c: New test case. From-SVN: r85691 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2088262f4b2..2a64568f9cb4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-08-08 Roger Sayle + + PR middle-end/16790 + * fold-const.c (expand_muldiv_1) : Disallow local + truncations, not just global truncations. + 2004-08-02 Ulrich Weigand Backport from mainline: diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9be3ddfa6abf..308d60e6bbe9 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4114,9 +4114,9 @@ extract_muldiv_1 (t, c, code, wide_type) && TYPE_IS_SIZETYPE (TREE_TYPE (op0))) && (GET_MODE_SIZE (TYPE_MODE (ctype)) > GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0))))) - /* ... or its type is larger than ctype, - then we cannot pass through this truncation. */ - || (GET_MODE_SIZE (TYPE_MODE (ctype)) + /* ... or this is a truncation (t is narrower than op0), + then we cannot pass through this narrowing. */ + || (GET_MODE_SIZE (TYPE_MODE (type)) < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0)))) /* ... or signedness changes for division or modulus, then we cannot pass through this conversion. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12fb3d6834ce..a9a5863efd9f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-08 Roger Sayle + + PR middle-end/16790 + * gcc.c-torture/execute/pr16790-1.c: New test case. + 2004-08-04 Ulrich Weigand Backport from mainline: