PR tree-optimization/37358
PR tree-optimization/37357
* tree.c (build_function_type_skip_args): Build distinct type copy;
set TYPE_CONTEXT.
(build_function_decl_skip_args): Set type of new decl not orig decl;
clear DECL_VINDEX for methods turned into functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139980
138bc75d-0d04-0410-961f-
82ee72b054a4
+2008-09-04 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimization/37345
+ PR tree-optimization/37358
+ PR tree-optimization/37357
+ * tree.c (build_function_type_skip_args): Build distinct type copy;
+ set TYPE_CONTEXT.
+ (build_function_decl_skip_args): Set type of new decl not orig decl;
+ clear DECL_VINDEX for methods turned into functions.
+
2008-09-04 Nick Clifton <nickc@redhat.com>
* configure.ac (HAVE_GAS_LCOMM_WITH_ALIGNMENT): New assembler
+2008-09-03 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimization/37345
+ PR tree-optimization/37358
+ PR tree-optimization/37357
+ * g++.dg/torture/pr37345.c: New file.
+
2008-09-03 Tobias Grosser <grosser@fim.uni-passau.de>
* lib/target-supports.exp (check_effective_target_fgraphite): Fix test.
--- /dev/null
+/* { dg-do compile } */
+class EbmlElement {
+ virtual EbmlElement * Clone() const;
+};
+class KaxTracks : public EbmlElement {
+public:
+ EbmlElement * Clone() const {
+ return new KaxTracks(*this);
+ }
+};
+KaxTracks kax_tracks;
+void finish_file(void)
+{
+ kax_tracks.Clone();
+}
TYPE_ARG_TYPES (new_type) = new_reversed;
}
else
- new_type = build_function_type (TREE_TYPE (orig_type), new_reversed);
+ {
+ new_type
+ = build_distinct_type_copy (build_function_type (TREE_TYPE (orig_type),
+ new_reversed));
+ TYPE_CONTEXT (new_type) = TYPE_CONTEXT (orig_type);
+ }
/* This is a new type, not a copy of an old type. Need to reassociate
variants. We can handle everything except the main variant lazily. */
new_type = TREE_TYPE (orig_decl);
if (prototype_p (new_type))
new_type = build_function_type_skip_args (new_type, args_to_skip);
- TREE_TYPE (orig_decl) = new_type;
+ TREE_TYPE (new_decl) = new_type;
+
+ /* For declarations setting DECL_VINDEX (i.e. methods)
+ we expect first argument to be THIS pointer. */
+ if (bitmap_bit_p (args_to_skip, 0))
+ DECL_VINDEX (new_decl) = NULL_TREE;
return new_decl;
}