OSDN Git Service

2009-06-03 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jun 2009 15:30:52 +0000 (15:30 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jun 2009 15:30:52 +0000 (15:30 +0000)
PR middle-end/40328
* fold-const.c (fold_convert): Fold the build COMPLEX_EXPR.

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

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

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

index 523c161..d426129 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-03  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/40328
+       * fold-const.c (fold_convert): Fold the build COMPLEX_EXPR.
+
 2009-06-03  Andrey Belevantsev  <abel@ispras.ru>
 
        * statistics.c (statistics_counter_event): Do not record event 
index 03f6805..ab3942f 100644 (file)
@@ -2643,9 +2643,10 @@ fold_convert (tree type, tree arg)
        case POINTER_TYPE: case REFERENCE_TYPE:
        case REAL_TYPE:
        case FIXED_POINT_TYPE:
-         return build2 (COMPLEX_EXPR, type,
-                        fold_convert (TREE_TYPE (type), arg),
-                        fold_convert (TREE_TYPE (type), integer_zero_node));
+         return fold_build2 (COMPLEX_EXPR, type,
+                             fold_convert (TREE_TYPE (type), arg),
+                             fold_convert (TREE_TYPE (type),
+                                           integer_zero_node));
        case COMPLEX_TYPE:
          {
            tree rpart, ipart;
index 2fe13e1..d2c9247 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-03  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/40328
+       * gcc.dg/torture/pr40328.c: New testcase.
+
 2009-06-03  Martin Jambor  <mjambor@suse.cz>
 
        * g++.dg/torture/pr40323.C: New file.
diff --git a/gcc/testsuite/gcc.dg/torture/pr40328.c b/gcc/testsuite/gcc.dg/torture/pr40328.c
new file mode 100644 (file)
index 0000000..e378e63
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-tree-sra" } */
+
+_Complex float foo(void)
+{
+  _Complex float a[64] = {};
+  _Complex float x;
+  x =  a[1];
+  return x;
+}
+