re PR c/54559 (, ICE in gimplify_expr, at gimplify.c:7592)

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: r191271
This commit is contained in:
Jakub Jelinek 2012-09-13 19:04:44 +02:00 committed by Jakub Jelinek
parent 7ccba73cef
commit 90980ad346
4 changed files with 26 additions and 0 deletions

View 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-09-12 Teresa Johnson <tejohnson@google.com>
Backport from mainline.

View File

@ -8771,12 +8771,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. */

View 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

View File

@ -0,0 +1,9 @@
/* PR c/54559 */
typedef double _Complex T;
T
foo (double x, double y)
{
return x + y * (T) (__extension__ 1.0iF);
}