+2004-09-11 Steven Bosscher <stevenb@suse.de>
+
+ PR c++/17412
+ * fold-const.c (fold): Do not try to fold the operand of a
+ CLEANUP_POINT_EXPR if that operand does itself not have any
+ operands.
+
+ PR middle-end/17417
+ * langhooks.c (lhd_decl_printable_name): Make sure that this
+ function is called with is a decl node that has an identifier.
+ * tree-pretty-print.c (dump_function_name): New function to
+ wrap PRINT_FUNCTION_NAME and dump_decl_name.
+ (print_call_name): Use it.
+
2004-09-11 Mohan Embar <gnustuff@thisiscool.com>
* ggc-none.c: Include "bconfig.h" if -DGENERATOR_FILE,
TREE_OPERAND (arg0, 1)))));
return t;
+ case CLEANUP_POINT_EXPR:
/* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
appropriate. */
- case CLEANUP_POINT_EXPR:
if (! has_cleanups (arg0))
return TREE_OPERAND (t, 0);
{
enum tree_code code0 = TREE_CODE (arg0);
int kind0 = TREE_CODE_CLASS (code0);
- tree arg00 = TREE_OPERAND (arg0, 0);
- tree arg01;
if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
- return fold (build1 (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00))));
+ {
+ tree arg00 = TREE_OPERAND (arg0, 0);
+ return fold (build1 (code0, type,
+ fold (build1 (CLEANUP_POINT_EXPR,
+ TREE_TYPE (arg00), arg00))));
+ }
if (kind0 == '<' || kind0 == '2'
|| code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
|| code0 == TRUTH_AND_EXPR || code0 == TRUTH_OR_EXPR
|| code0 == TRUTH_XOR_EXPR)
{
- arg01 = TREE_OPERAND (arg0, 1);
+ tree arg00 = TREE_OPERAND (arg0, 0);
+ tree arg01 = TREE_OPERAND (arg0, 1);
if (TREE_CONSTANT (arg00)
|| ((code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR)
const char *
lhd_decl_printable_name (tree decl, int ARG_UNUSED (verbosity))
{
+ gcc_assert (decl && DECL_NAME (decl));
return IDENTIFIER_POINTER (DECL_NAME (decl));
}
+2004-09-11 Steven Bosscher <stevenb@suse.de>
+
+ * g++.dg/parse/break-in-for.C: New test.
+
2004-09-11 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tree-ssa/20040911-1.c: New test.
--- /dev/null
+/* PR17412
+ fold-const would try to fold the operands of the break statement. */
+/* { dg-do compile } */
+
+
+void foo ()
+{
+ for (;;)
+ for (;;({break;}));
+}
+
}
}
+/* Like the above, but used for pretty printing function calls. */
+
+static void
+dump_function_name (pretty_printer *buffer, tree node)
+{
+ if (DECL_NAME (node))
+ PRINT_FUNCTION_NAME (node);
+ else
+ dump_decl_name (buffer, node, 0);
+}
+
/* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
FLAGS are as in dump_generic_node. */
{
case VAR_DECL:
case PARM_DECL:
- PRINT_FUNCTION_NAME (op0);
+ dump_function_name (buffer, op0);
break;
case ADDR_EXPR:
/* The function is a pointer contained in a structure. */
if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
- PRINT_FUNCTION_NAME (TREE_OPERAND (op0, 1));
+ dump_function_name (buffer, TREE_OPERAND (op0, 1));
else
dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
/* else
case ARRAY_REF:
if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
- PRINT_FUNCTION_NAME (TREE_OPERAND (op0, 0));
+ dump_function_name (buffer, TREE_OPERAND (op0, 0));
else
dump_generic_node (buffer, op0, 0, 0, false);
break;