PR c++/81607
* cp-gimplify.c (cp_fold): If folding exposed a branch of
a COND_EXPR, convert it to the original type of the COND_EXPR, if
they differ.
* g++.dg/other/bitfield6.C: New test.
From-SVN: r250948
+2017-08-08 Marek Polacek <polacek@redhat.com>
+
+ PR c++/81607
+ * cp-gimplify.c (cp_fold): If folding exposed a branch of
+ a COND_EXPR, convert it to the original type of the COND_EXPR, if
+ they differ.
+
2017-08-08 Martin Liska <mliska@suse.cz>
* call.c: Include header files.
/* A COND_EXPR might have incompatible types in branches if one or both
arms are bitfields. If folding exposed such a branch, fix it up. */
- if (TREE_CODE (x) != code)
- if (tree type = is_bitfield_expr_with_lowered_type (x))
- x = fold_convert (type, x);
+ if (TREE_CODE (x) != code
+ && !useless_type_conversion_p (TREE_TYPE (org_x), TREE_TYPE (x)))
+ x = fold_convert (TREE_TYPE (org_x), x);
break;
+2017-08-08 Marek Polacek <polacek@redhat.com>
+
+ PR c++/81607
+ * g++.dg/other/bitfield6.C: New test.
+
2017-08-07 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/81593
--- /dev/null
+// PR c++/81607
+
+int a;
+
+struct b {
+ long c : 32;
+} d;
+
+char f = (903092 ? int(d.c) : 0) << a;