]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/54559 (, ICE in gimplify_expr, at gimplify.c:7592)
authorJakub Jelinek <jakub@redhat.com>
Thu, 13 Sep 2012 16:57:15 +0000 (18:57 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 13 Sep 2012 16:57:15 +0000 (18:57 +0200)
PR c/54559
* c-typeck.c (c_finish_return): Do convert to BOOLEAN_TYPE or
COMPLEX_TYPE with in_late_binary_op set temporarily to true.

* gcc.c-torture/compile/pr54559.c: New test.

From-SVN: r191270

gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr54559.c [new file with mode: 0644]

index 11f9be7b5359c1f117b2906eb98fcc980c695b1c..f075776c39b35f70f8db4c6fa4bfe74ae4fbf560 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/54559
+       * c-typeck.c (c_finish_return): Do convert to BOOLEAN_TYPE or
+       COMPLEX_TYPE with in_late_binary_op set temporarily to true.
+
 2012-08-31  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/54428
index b5fb9c984eec4fa284428c482d2024a5373310e0..2d74da8cde4412dc4a34e74f9fc4b504c541e7e5 100644 (file)
@@ -8682,12 +8682,18 @@ c_finish_return (location_t loc, tree retval, tree origtype)
                                       npc, NULL_TREE, NULL_TREE, 0);
       tree res = DECL_RESULT (current_function_decl);
       tree inner;
+      bool save;
 
       current_function_returns_value = 1;
       if (t == error_mark_node)
        return NULL_TREE;
 
+      save = in_late_binary_op;
+      if (TREE_CODE (TREE_TYPE (res)) == BOOLEAN_TYPE
+          || TREE_CODE (TREE_TYPE (res)) == COMPLEX_TYPE)
+        in_late_binary_op = true;
       inner = t = convert (TREE_TYPE (res), t);
+      in_late_binary_op = save;
 
       /* Strip any conversions, additions, and subtractions, and see if
         we are returning the address of a local variable.  Warn if so.  */
index 0820a05bfd1855b5e4693cba411c326cc2e8a9c2..95def4c16cb076ad05f37a563b309762fe3d9669 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/54559
+       * gcc.c-torture/compile/pr54559.c: New test.
+
 2012-09-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/53839
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54559.c b/gcc/testsuite/gcc.c-torture/compile/pr54559.c
new file mode 100644 (file)
index 0000000..847497f
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR c/54559 */
+
+typedef double _Complex T;
+
+T
+foo (double x, double y)
+{
+  return x + y * (T) (__extension__ 1.0iF);
+}