From: Joseph Myers Date: Thu, 14 Oct 2010 15:48:52 +0000 (+0100) Subject: re PR c/45969 (ICE in build_binary_op, at c-typeck.c:9833) X-Git-Tag: upstream/12.2.0~89362 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=180f8dbbb3361ce1728425ba7537e401f595f866;p=platform%2Fupstream%2Fgcc.git re PR c/45969 (ICE in build_binary_op, at c-typeck.c:9833) PR c/45969 * c-typeck.c (build_binary_op): Don't try to compute a semantic type with excess precision for boolean operations. testsuite: * gcc.c-torture/compile/pr45969-1.c: New test. From-SVN: r165472 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c92f30..303ea78 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-14 Joseph Myers + + PR c/45969 + * c-typeck.c (build_binary_op): Don't try to compute a semantic + type with excess precision for boolean operations. + 2010-10-14 Jeremie Salvucci Basile Starynkevitch diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 14bc281..fe10e8b 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -9423,6 +9423,10 @@ build_binary_op (location_t location, enum tree_code code, precision. */ bool may_need_excess_precision; + /* True means this is a boolean operation that converts both its + operands to truth-values. */ + bool boolean_op = false; + if (location == UNKNOWN_LOCATION) location = input_location; @@ -9650,6 +9654,7 @@ build_binary_op (location_t location, enum tree_code code, op0 = c_common_truthvalue_conversion (location, op0); op1 = c_common_truthvalue_conversion (location, op1); converted = 1; + boolean_op = true; } if (code == TRUTH_ANDIF_EXPR) { @@ -10192,7 +10197,8 @@ build_binary_op (location_t location, enum tree_code code, if (build_type == NULL_TREE) { build_type = result_type; - if (type0 != orig_type0 || type1 != orig_type1) + if ((type0 != orig_type0 || type1 != orig_type1) + && !boolean_op) { gcc_assert (may_need_excess_precision && common); semantic_result_type = c_common_type (orig_type0, orig_type1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe240d4..a81938d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-14 Joseph Myers + + PR c/45969 + * gcc.c-torture/compile/pr45969-1.c: New test. + 2010-10-14 Richard Guenther PR lto/45382 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c b/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c new file mode 100644 index 0000000..ccf68bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c @@ -0,0 +1,6 @@ +/* { dg-options "-std=c89" } */ +void crash() { + double l[4]; + if((l[0]+l[2]) && (l[1]+l[3])){ + } +}