+2008-01-29 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/35006
+ * tree-inline.h (struct copy_body_data): Add remapping_type_depth
+ field.
+ * tree-inline.c (remap_type): Increment remapping_type_depth
+ around remapping types.
+ (copy_body_r): Only add referenced variables if they are referenced
+ from code, not types.
+
2008-01-29 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34055
+2008-01-29 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/35006
+ * gcc.c-torture/compile/pr35006.c: New testcase.
+
2008-01-29 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34055
--- /dev/null
+typedef unsigned long grub_uint64_t;
+typedef grub_uint64_t grub_size_t;
+grub_cmdline_get (unsigned max_len, int echo_char)
+{
+ unsigned xpos, ypos, ystart;
+ grub_size_t lpos, llen;
+ char buf[max_len];
+ void cl_print (int pos, int c)
+ {
+ char *p;
+ for (p = buf + pos; *p; p++)
+ {
+ if (xpos++ > 78)
+ grub_putchar ('\n');
+ grub_putchar (*p);
+ }
+ }
+ void cl_delete (unsigned len)
+ {
+ cl_set_pos ();
+ cl_print (lpos, ' ');
+ grub_memmove ();
+ cl_print (lpos, echo_char);
+ cl_set_pos ();
+ }
+ cl_delete (llen);
+ grub_size_t n = lpos;
+ cl_delete (n);
+}
remap_type (tree type, copy_body_data *id)
{
tree *node;
+ tree tmp;
if (type == NULL)
return type;
return type;
}
- return remap_type_1 (type, id);
+ id->remapping_type_depth++;
+ tmp = remap_type_1 (type, id);
+ id->remapping_type_depth--;
+
+ return tmp;
}
static tree
tweak some special cases. */
copy_tree_r (tp, walk_subtrees, NULL);
- /* Global variables we didn't seen yet needs to go into referenced
- vars. */
- if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL)
+ /* Global variables we haven't seen yet needs to go into referenced
+ vars. If not referenced from types only. */
+ if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL
+ && id->remapping_type_depth == 0)
add_referenced_var (*tp);
/* If EXPR has block defined, map it to newly constructed block.
/* True if this statement will need to be regimplified. */
bool regimplify;
+ /* > 0 if we are remapping a type currently. */
+ int remapping_type_depth;
+
/* Statements that might be possibly folded. */
struct pointer_set_t *statements_to_fold;