OSDN Git Service

2006-05-27 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 27 May 2006 15:57:36 +0000 (15:57 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 27 May 2006 15:57:36 +0000 (15:57 +0000)
PR middle-end/27773
* fold-const.c (fold_plusminus_mult_expr): Use fold_convert
to produce a constant of value 1 of generic type.

* gcc.dg/torture/pr27773.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114158 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr27773.c [new file with mode: 0644]

index 4c73ad8..021e01b 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-27  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/27773
+       * fold-const.c (fold_plusminus_mult_expr): Use fold_convert
+       to produce a constant of value 1 of generic type.
+
 2006-05-27  Dirk Mueller  <dmueller@suse.de>
 
        * cgraphunit.c (decide_is_function_needed): Fix wrong
index a5e57b1..7ef0fa1 100644 (file)
@@ -6702,10 +6702,7 @@ fold_plusminus_mult_expr (enum tree_code code, tree type, tree arg0, tree arg1)
   else
     {
       arg00 = arg0;
-      if (!FLOAT_TYPE_P (type))
-       arg01 = build_int_cst (type, 1);
-      else
-       arg01 = build_real (type, dconst1);
+      arg01 = fold_convert (type, integer_one_node);
     }
   if (TREE_CODE (arg1) == MULT_EXPR)
     {
@@ -6715,10 +6712,7 @@ fold_plusminus_mult_expr (enum tree_code code, tree type, tree arg0, tree arg1)
   else
     {
       arg10 = arg1;
-      if (!FLOAT_TYPE_P (type))
-       arg11 = build_int_cst (type, 1);
-      else
-       arg11 = build_real (type, dconst1);
+      arg11 = fold_convert (type, integer_one_node);
     }
   same = NULL_TREE;
 
index d25ea70..786b6ca 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-27  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/27773
+       * gcc.dg/torture/pr27773.c: New testcase.
+
 2006-05-27  Dirk Mueller  <dmueller@suse.de>
 
        * gcc.dg/pr24561.c: Rename to..
diff --git a/gcc/testsuite/gcc.dg/torture/pr27773.c b/gcc/testsuite/gcc.dg/torture/pr27773.c
new file mode 100644 (file)
index 0000000..e30e540
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+
+_Complex float f(_Complex float a, float b)
+{
+  return a - a*b;
+}