re PR middle-end/26632 (spurious warning: value computed is not used)
authorKazu Hirata <kazu@codesourcery.com>
Mon, 28 Aug 2006 17:18:29 +0000 (17:18 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 28 Aug 2006 17:18:29 +0000 (17:18 +0000)
gcc/
PR middle-end/26632
* convert.c (convert_to_integer): Set TREE_NO_WARNING to 1 on
an implicit conversion.

gcc/testsuite/
PR middle-end/26632
* gcc.dg/pr26632.c: New.

From-SVN: r116510

gcc/ChangeLog
gcc/convert.c
gcc/testsuite/ChangeLog

index 745c64217fe3d5e6bec4a4ee3f0d48de68d5d094..733fa47e7f4f6e729d7b95b8772683d0e27bf769 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-28  Kazu Hirata  <kazu@codesourcery.com>
+
+       PR middle-end/26632
+       * convert.c (convert_to_integer): Set TREE_NO_WARNING to 1 on
+       an implicit conversion.
+
 2006-08-28  Prafulla Thakare  <prafullat@kpitcummins.com>
 
        * config/h8300/h8300.c (TARGET_DEFAULT_TARGET_FLAGS): New.
index 27571956a1ead9aa7b93b2d6c95e00a118323e66..118889fad443cd2be396b32baf72103e7a340ff1 100644 (file)
@@ -487,6 +487,7 @@ convert_to_integer (tree type, tree expr)
       else if (outprec >= inprec)
        {
          enum tree_code code;
+         tree tem;
 
          /* If the precision of the EXPR's type is K bits and the
             destination mode has more bits, and the sign is changing,
@@ -504,7 +505,13 @@ convert_to_integer (tree type, tree expr)
          else
            code = NOP_EXPR;
 
-         return fold_build1 (code, type, expr);
+         tem = fold_unary (code, type, expr);
+         if (tem)
+           return tem;
+
+         tem = build1 (code, type, expr);
+         TREE_NO_WARNING (tem) = 1;
+         return tem;
        }
 
       /* If TYPE is an enumeral type or a type with a precision less
index 65900a7e8b30f81c0afbf503e1449d27865cd63c..767f94e3a84d7e1a061ee9f0d86a4f1b3a015ca2 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-28  Kazu Hirata  <kazu@codesourcery.com>
+
+       PR middle-end/26632
+       * gcc.dg/pr26632.c: New.
+
 2006-08-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/28354