+2012-04-19 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/52283/37985
+ * stmt.c (warn_if_unused_value): Skip NOP_EXPR.
+ * convert.c (convert_to_integer): Don't set TREE_NO_WARNING.
+
2012-04-19 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/44688
case SAVE_EXPR:
case NON_LVALUE_EXPR:
+ case NOP_EXPR:
exp = TREE_OPERAND (exp, 0);
goto restart;
else if (outprec >= inprec)
{
enum tree_code code;
- tree tem;
/* If the precision of the EXPR's type is K bits and the
destination mode has more bits, and the sign is changing,
else
code = NOP_EXPR;
- tem = fold_unary (code, type, expr);
- if (tem)
- return tem;
-
- tem = build1 (code, type, expr);
- TREE_NO_WARNING (tem) = 1;
- return tem;
+ return fold_build1 (code, type, expr);
}
/* If TYPE is an enumeral type or a type with a precision less
+2012-04-19 Christian Bruel <christian.bruel@st.com>
+
+ * gcc.dg/pr52283.c: New test.
+
+2012-04-19 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * gcc.dg/pr37985.c: New test.
+
2012-04-19 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/44688
--- /dev/null
+/* PR c37985 */
+/* { dg-do compile } */
+/* { dg-options " -Wall -Wextra " } */
+unsigned char foo(unsigned char a)
+{
+ a >> 2; /* { dg-warning "no effect" } */
+ return a;
+}
--- /dev/null
+/* Test for case labels not integer constant expressions but folding
+ to integer constants (used in Linux kernel). */
+/* { dg-do compile } */
+
+extern unsigned int u;
+
+void
+b (int c)
+{
+ switch (c)
+ {
+ case (int) (2 | ((4 < 8) ? 8 : u)):
+ ;
+ }
+}
+